- Fix error with SpamCop reporting plugin not being able to send report as
[squirrelmail.git] / functions / abook_database.php
index ceeba5e9e4b14c86760e7f5bf5f89f53e041a1a5..f1591d6faba760da88c8c026e062507ec7f7389e 100644 (file)
@@ -14,7 +14,7 @@
  *  PRIMARY KEY (owner,nickname)
  * </pre>
  *
- * @copyright &copy; 1999-2007 The SquirrelMail Project Team
+ * @copyright 1999-2010 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -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);