Some fixup.
This commit is contained in:
parent
7808719aee
commit
bc6ece97aa
3 changed files with 12 additions and 8 deletions
|
@ -17,6 +17,8 @@
|
|||
/* Set values for constants used by Squirrelmail preferences. */
|
||||
/**************************************************************/
|
||||
|
||||
require_once( '../functions/plugin.php' ); // Required for the hook
|
||||
|
||||
/* Define basic, general purpose preference constants. */
|
||||
define('SMPREF_NO', 0);
|
||||
define('SMPREF_OFF', 0);
|
||||
|
|
|
@ -89,26 +89,26 @@
|
|||
|
||||
function removePref($data_dir, $username, $string) {
|
||||
global $prefs_cache;
|
||||
|
||||
|
||||
cachePrefValues($data_dir, $username);
|
||||
|
||||
|
||||
if (isset($prefs_cache[$string])) {
|
||||
unset($prefs_cache[$string]);
|
||||
}
|
||||
|
||||
|
||||
savePrefValues($data_dir, $username);
|
||||
}
|
||||
|
||||
|
||||
/** sets the pref, $string, to $set_to **/
|
||||
function setPref($data_dir, $username, $string, $set_to) {
|
||||
global $prefs_cache;
|
||||
|
||||
|
||||
cachePrefValues($data_dir, $username);
|
||||
if (isset($prefs_cache[$string]) && $prefs_cache[$string] == $set_to)
|
||||
return;
|
||||
if ($set_to === '') {
|
||||
removePref($data_dir, $username, $string);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
$prefs_cache[$string] = $set_to;
|
||||
savePrefValues($data_dir, $username);
|
||||
|
@ -119,7 +119,7 @@
|
|||
create it. **/
|
||||
function checkForPrefs($data_dir, $username) {
|
||||
$filename = $data_dir . $username . '.pref';
|
||||
if (!file_exists($filename)) {
|
||||
if (!file_exists($filename) ) {
|
||||
if (!copy($data_dir . 'default_pref', $filename)) {
|
||||
echo _("Error opening ") . $filename;
|
||||
exit;
|
||||
|
@ -150,4 +150,5 @@
|
|||
}
|
||||
return $sig;
|
||||
}
|
||||
?>
|
||||
|
||||
?>
|
|
@ -104,6 +104,7 @@
|
|||
session_register ('username');
|
||||
setcookie('key', $key, 0, $base_uri);
|
||||
do_hook ('login_verified');
|
||||
|
||||
setPref( $data_dir, $username, 'counter',
|
||||
getPref( $data_dir, $username, 'counter', 0 ) + 1 );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue