Phpdocumentor update - sed is your friend for these kinds of things ;)
[squirrelmail.git] / functions / abook_database.php
index 0a2b09b6af97c119f26192bc5191e701c40f9693..94a9180e7dcffe25d4f05e2624b93317c0981a00 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * abook_database.php
  *
- * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * Backend for personal addressbook stored in a database,
@@ -27,8 +27,9 @@
  *  NOTE. This class should not be used directly. Use the
  *        "AddressBook" class instead.
  *
- * $Id$
+ * @version $Id$
  * @package squirrelmail
+ * @subpackage addressbook
  */
 
 /** Needs the DB functions */   
@@ -74,6 +75,10 @@ class abook_database extends addressbook_backend {
                $this->writeable = $param['writeable'];
             }
 
+            if (isset($param['listing'])) {
+               $this->listing = $param['listing'];
+            }
+
             $this->open(true);
         }
         else {
@@ -121,7 +126,7 @@ class abook_database extends addressbook_backend {
         if(!$this->open()) {
             return false;
         }
-         
+
         /* To be replaced by advanded search expression parsing */
         if (is_array($expr)) {
             return;
@@ -168,8 +173,8 @@ class abook_database extends addressbook_backend {
             return false;
         }
          
-        $query = sprintf("SELECT * FROM %s WHERE owner='%s' AND nickname='%s'",
-                         $this->table, $this->owner, $alias);
+        $query = sprintf("SELECT * FROM %s WHERE owner='%s' AND LOWER(nickname)='%s'",
+                         $this->table, $this->owner, $this->dbh->quoteString($alias));
 
         $res = $this->dbh->query($query);
 
@@ -197,6 +202,11 @@ class abook_database extends addressbook_backend {
         if (!$this->open()) {
             return false;
         }
+       
+       if(isset($this->listing) && !$this->listing) {
+           return array();
+       }
+
 
         $query = sprintf("SELECT * FROM %s WHERE owner='%s'",
                          $this->table, $this->owner);