I should really have checked if the database is opened before using it...
authorsimond <simond@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 7 Feb 2002 13:51:28 +0000 (13:51 +0000)
committersimond <simond@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 7 Feb 2002 13:51:28 +0000 (13:51 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2379 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/db_prefs.php

index 029c935..b1e9f52 100644 (file)
@@ -128,7 +128,9 @@ class dbPrefs {
     function deleteKey($user, $key) {
         global $prefs_cache;
 
-        $this->open();
+        if (!$this->open()) {
+            return false;
+        }
         $query = sprintf("DELETE FROM %s WHERE user='%s' AND prefkey='%s'",
                          $this->table,
                          $this->dbh->quoteString($user),
@@ -149,7 +151,9 @@ class dbPrefs {
     }
 
     function setKey($user, $key, $value) {
-        $this->open();
+        if (!$this->open()) {
+            return false;
+        }
         $query = sprintf("REPLACE INTO %s (user,prefkey,prefval) ".
                          "VALUES('%s','%s','%s')",
                          $this->table,
@@ -168,7 +172,9 @@ class dbPrefs {
     function fillPrefsCache($user) {
         global $prefs_cache;
 
-        $this->open();
+        if (!$this->open()) {
+            return;
+        }
 
         $prefs_cache = array();
         $query = sprintf("SELECT prefkey, prefval FROM %s ".
@@ -191,7 +197,9 @@ class dbPrefs {
      * but it is not, so....
      */
     function renumberHighlightList($user) {
-        $this->open();
+        if (!$this->open()) {
+            return;
+        }
         $query = sprintf("SELECT * FROM %s WHERE user='%s' ".
                          "AND prefkey LIKE 'highlight%%' ORDER BY prefkey",
                          $this->table,