From f804972b86f78be119ce31041fb316c36ace0d24 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Sat, 8 Jan 2000 13:53:05 +0000 Subject: [PATCH] Adds signature support git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@141 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/prefs.php | 31 +++++++++++++++++++++++++++++++ src/compose.php | 5 ++++- src/load_prefs.php | 11 +++++++++++ src/options.php | 17 ++++++++++++++++- src/options_submit.php | 3 +++ 5 files changed, 65 insertions(+), 2 deletions(-) diff --git a/functions/prefs.php b/functions/prefs.php index f66f8637..0a685e65 100644 --- a/functions/prefs.php +++ b/functions/prefs.php @@ -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; + } ?> \ No newline at end of file diff --git a/src/compose.php b/src/compose.php index d0a6cc31..cf00da67 100644 --- a/src/compose.php +++ b/src/compose.php @@ -147,7 +147,10 @@ echo " \n"; echo " \n"; echo " \n"; - echo "   
"; + if ($use_signature == true) + echo "   
"; + else + echo "   
"; echo " "; echo " \n"; echo "\n"; diff --git a/src/load_prefs.php b/src/load_prefs.php index e36482ad..c714429a 100644 --- a/src/load_prefs.php +++ b/src/load_prefs.php @@ -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 = ""; + } ?> diff --git a/src/options.php b/src/options.php index af6cd873..e0a42c61 100644 --- a/src/options.php +++ b/src/options.php @@ -128,7 +128,7 @@ echo " "; echo " "; echo " "; - if (isset($editor_size)) + if ($editor_size >= 5) echo "
"; else echo "
"; @@ -137,6 +137,21 @@ echo " "; echo ""; + // SIGNATURE + echo "
"; + if ($use_signature == true) + echo "  Use a signature?
"; + else + echo "  Use a signature?
"; + + if ($editor_size < 5) + $sig_size = 76; + else + $sig_size = $editor_size; + + echo "
Signature:

"; + echo "
"; + // SUBMIT BUTTON echo "
\n"; diff --git a/src/options_submit.php b/src/options_submit.php index cbddf1f5..ff32aff6 100644 --- a/src/options_submit.php +++ b/src/options_submit.php @@ -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 ""; echo "


Options Saved!

"; -- 2.25.1