From b279d7f4cbe4bf7272ce74f531eab693189e0423 Mon Sep 17 00:00:00 2001 From: simond Date: Thu, 7 Feb 2002 13:51:28 +0000 Subject: [PATCH] I should really have checked if the database is opened before using it... git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2379 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/db_prefs.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/functions/db_prefs.php b/functions/db_prefs.php index 029c9354..b1e9f520 100644 --- a/functions/db_prefs.php +++ b/functions/db_prefs.php @@ -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, -- 2.25.1