Ver Fonte

Add error handling to abook db lookups

pdontthink há 17 anos atrás
pai
commit
a0adab5050
1 ficheiros alterados com 6 adições e 1 exclusões
  1. 6 1
      functions/abook_database.php

+ 6 - 1
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);