unsetting an array element didn't re-index the array which caused a failure
[squirrelmail.git] / functions / db_prefs.php
index 960a8bbe2776ea81345ed3bd83fb8c79d8d11449..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,6 +292,7 @@ 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();
@@ -304,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 === '') {