Required for the new advanced search. (Beginning with src/search.php v. 1.94)
[squirrelmail.git] / functions / db_prefs.php
index 3708441dac832583a3940c7b3b4e595e663ece04..a973f363987285afc38a3eeaa37294f870664ddf 100644 (file)
@@ -3,7 +3,7 @@
 /*
  * db_prefs.php
  *
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This contains functions for manipulating user preferences
@@ -284,12 +284,19 @@ function getPref($data_dir, $username, $string, $default = '') {
 
 /* Remove the pref $string */
 function removePref($data_dir, $username, $string) {
+    global $prefs_cache;
     $db = new dbPrefs;
     if(isset($db->error)) {
         $db->failQuery();
     }
 
     $db->deleteKey($username, $string);
+
+    if (isset($prefs_cache[$string])) {
+        unset($prefs_cache[$string]);
+    }
+
+    sqsession_register($prefs_cache , 'prefs_cache');
     return;
 }
 
@@ -301,7 +308,7 @@ function setPref($data_dir, $username, $string, $set_to) {
         return;
     }
 
-    if ($set_to == '') {
+    if ($set_to === '') {
         removePref($data_dir, $username, $string);
         return;
     }
@@ -316,7 +323,7 @@ function setPref($data_dir, $username, $string, $set_to) {
     assert_options(ASSERT_ACTIVE, 1);
     assert_options(ASSERT_BAIL, 1);
     assert ('$set_to == $prefs_cache[$string]');
-
+    sqsession_register($prefs_cache , 'prefs_cache');
     return;
 }