Adds signature support
This commit is contained in:
parent
5abc8cc76d
commit
b6be1ecd92
5 changed files with 65 additions and 2 deletions
|
@ -66,6 +66,9 @@
|
|||
fclose($file);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/** This checks if there is a pref file, if there isn't, it will create it. **/
|
||||
function checkForPrefs($data_dir, $username) {
|
||||
$filename = "$data_dir$username.pref";
|
||||
|
@ -77,4 +80,32 @@
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Writes the Signature **/
|
||||
function setSig($data_dir, $username, $string) {
|
||||
$filename = "$data_dir$username.sig";
|
||||
$file = fopen($filename, "w");
|
||||
fwrite($file, $string);
|
||||
fclose($file);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Gets the signature **/
|
||||
function getSig($data_dir, $username) {
|
||||
$filename = "$data_dir$username.sig";
|
||||
if (file_exists($filename)) {
|
||||
$file = fopen($filename, "r");
|
||||
while (!feof($file)) {
|
||||
$sig .= fgets($file, 1024);
|
||||
}
|
||||
fclose($file);
|
||||
} else {
|
||||
echo "Signature file not found.";
|
||||
exit;
|
||||
}
|
||||
return $sig;
|
||||
}
|
||||
?>
|
|
@ -147,7 +147,10 @@
|
|||
echo " </TR>\n";
|
||||
echo " <TR>\n";
|
||||
echo " <TD BGCOLOR=\"$color[4]\" COLSPAN=2>\n";
|
||||
echo " <TEXTAREA NAME=passed_body ROWS=20 COLS=\"$editor_size\" WRAP=HARD>$body</TEXTAREA><BR>";
|
||||
if ($use_signature == true)
|
||||
echo " <TEXTAREA NAME=passed_body ROWS=20 COLS=\"$editor_size\" WRAP=HARD>$body\n\n$signature</TEXTAREA><BR>";
|
||||
else
|
||||
echo " <TEXTAREA NAME=passed_body ROWS=20 COLS=\"$editor_size\" WRAP=HARD>$body</TEXTAREA><BR>";
|
||||
echo " </TD>";
|
||||
echo " </TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
|
|
|
@ -31,5 +31,16 @@
|
|||
$editor_size = getPref($data_dir, $username, "editor_size");
|
||||
if ($editor_size == "")
|
||||
$editor_size = 76;
|
||||
|
||||
$use_signature = getPref($data_dir, $username, "use_signature");
|
||||
if ($use_signature == "")
|
||||
$use_signature = false;
|
||||
|
||||
/** Load up the Signature file **/
|
||||
if ($use_signature == true) {
|
||||
$signature = getSig($data_dir, $username);
|
||||
} else {
|
||||
$signature = "";
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
echo " </TD>";
|
||||
echo " <TD WIDTH=40% ALIGN=LEFT>";
|
||||
echo " <FONT FACE=\"Arial,Helvetica\">";
|
||||
if (isset($editor_size))
|
||||
if ($editor_size >= 5)
|
||||
echo " <TT><INPUT TYPE=TEXT SIZE=5 NAME=editorsize VALUE=\"$editor_size\"></TT><BR>";
|
||||
else
|
||||
echo " <TT><INPUT TYPE=TEXT SIZE=5 NAME=editorsize VALUE=\"76\"></TT><BR>";
|
||||
|
@ -137,6 +137,21 @@
|
|||
echo " </TR>";
|
||||
echo "</TABLE>";
|
||||
|
||||
// SIGNATURE
|
||||
echo "<CENTER>";
|
||||
if ($use_signature == true)
|
||||
echo "<INPUT TYPE=CHECKBOX VALUE=\"1\" NAME=usesignature CHECKED> Use a signature?<BR>";
|
||||
else
|
||||
echo "<INPUT TYPE=CHECKBOX VALUE=\"1\" NAME=usesignature> Use a signature?<BR>";
|
||||
|
||||
if ($editor_size < 5)
|
||||
$sig_size = 76;
|
||||
else
|
||||
$sig_size = $editor_size;
|
||||
|
||||
echo "<BR>Signature:<BR><TEXTAREA NAME=signature_edit ROWS=5 COLS=\"$sig_size\" WRAP=HARD>$signature</TEXTAREA><BR>";
|
||||
echo "</CENTER>";
|
||||
|
||||
|
||||
// SUBMIT BUTTON
|
||||
echo "<BR><CENTER><INPUT TYPE=SUBMIT VALUE=\"Submit\"></CENTER>\n";
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
setPref($data_dir, $username, "move_to_trash", $movetotrash);
|
||||
setPref($data_dir, $username, "wrap_at", $wrapat);
|
||||
setPref($data_dir, $username, "editor_size", $editorsize);
|
||||
setPref($data_dir, $username, "use_signature", $usesignature);
|
||||
|
||||
setSig($data_dir, $username, $signature_edit);
|
||||
|
||||
echo "<FONT FACE=\"Arial,Helvetica\">";
|
||||
echo "<BR><BR><BR><CENTER><B>Options Saved!</B><BR><BR>";
|
||||
|
|
Loading…
Add table
Reference in a new issue