From 26bd38971ac8ea65405e7265654bef31b7594bc1 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Wed, 2 Jul 2008 03:30:03 +0000 Subject: [PATCH] Add error handling to abook db lookups git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13204 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/abook_database.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/functions/abook_database.php b/functions/abook_database.php index ceeba5e9..1e69af3a 100644 --- a/functions/abook_database.php +++ b/functions/abook_database.php @@ -316,8 +316,13 @@ class abook_database extends addressbook_backend { return false; } + $db_field = $this->get_field_name($field); + if ($db_field == 'ERROR') { + return $this->set_error(sprintf(_("Unknown field name: %s"), $field)); + } + $query = sprintf("SELECT * FROM %s WHERE owner = '%s' AND LOWER(%s) = '%s'", - $this->table, $this->owner, $this->get_field_name($field), + $this->table, $this->owner, $db_field, $this->dbh->quoteString($value)); $res = $this->dbh->query($query); -- 2.25.1