X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fprefs.php;h=f636ec4a836085385c34813c75a74f8cfb7b3585;hb=dc54c9f264caae5b24a3d182fae560762f56fb5b;hp=1f6891bd663ef2c85d22e1027f1cbad39651491b;hpb=65b14f90f66fb256ca4cfe5d4096a251f5a1eaf0;p=squirrelmail.git diff --git a/functions/prefs.php b/functions/prefs.php index 1f6891bd..f636ec4a 100644 --- a/functions/prefs.php +++ b/functions/prefs.php @@ -1,13 +1,20 @@ -"; + echo _("Preference file, ") . "\"$filename\"" . _(", does not exist. Log out, and log back in to create a default preference file. ") ."
"; exit; } $file = fopen($filename, "r"); @@ -61,15 +68,46 @@ fclose($file); } - /** This checks if there is a pref file, if there isn't, it will create it. **/ - function checkForPrefs($username) { - $filename = "../data/default_pref"; + + + + /** 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"; if (!file_exists($filename)) { - if (!copy("../config/default.pref", $filename)) { - echo "Error opening $filename"; + if (!copy("$data_dir" . "default_pref", $filename)) { + echo _("Error opening ") ."$filename"; exit; } } - return; } -?> \ No newline at end of file + + + + /** 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; + } +?>