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 029c9354b158d4201e392694de400c6a239e7a0f..b1e9f520e28665484c9bce0fdc723d7e69b0451e 100644 (file)
@@ -128,7 +128,9 @@ class dbPrefs {
     function deleteKey($user, $key) {
         global $prefs_cache;
 
     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),
         $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) {
     }
 
     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,
         $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;
 
     function fillPrefsCache($user) {
         global $prefs_cache;
 
-        $this->open();
+        if (!$this->open()) {
+            return;
+        }
 
         $prefs_cache = array();
         $query = sprintf("SELECT prefkey, prefval FROM %s ".
 
         $prefs_cache = array();
         $query = sprintf("SELECT prefkey, prefval FROM %s ".
@@ -191,7 +197,9 @@ class dbPrefs {
      * but it is not, so....
      */
     function renumberHighlightList($user) {
      * 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,
         $query = sprintf("SELECT * FROM %s WHERE user='%s' ".
                          "AND prefkey LIKE 'highlight%%' ORDER BY prefkey",
                          $this->table,