phpdoc updates
[squirrelmail.git] / functions / db_prefs.php
index bb7cb71261018086e464e045fb75dfef3545481b..5b204e59567ef44a9d0981759ddc96405a35723f 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
-/*
+/**
  * db_prefs.php
  *
- * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This contains functions for manipulating user preferences
  * by using conf.pl or the administrator plugin
  *
  * $Id$
+ * @package squirrelmail
  */
 
+/** Unknown database */
 define('SMDB_UNKNOWN', 0);
+/** MySQL */
 define('SMDB_MYSQL', 1);
+/** PostgreSQL */
 define('SMDB_PGSQL', 2);
 
 require_once('DB.php');
@@ -67,6 +71,10 @@ function cachePrefValues($username) {
     sqsession_register($prefs_are_cached, 'prefs_are_cached');
 }
 
+/**
+ * Completely undocumented class - someone document it!
+ * @package squirrelmail
+ */
 class dbPrefs {
     var $table = 'userprefs';
     var $user_field = 'user';
@@ -284,12 +292,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;
 }
 
@@ -298,7 +313,7 @@ function setPref($data_dir, $username, $string, $set_to) {
     global $prefs_cache;
 
     if (isset($prefs_cache[$string]) && ($prefs_cache[$string] == $set_to)) {
-       return;
+        return;
     }
 
     if ($set_to === '') {
@@ -316,7 +331,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;
 }