phpdoc should ignore these three functions
[squirrelmail.git] / functions / abook_database.php
index cb82f6ffae58ebd8f4e2297c10cf23989b0bf069..5fdd0d60ffe8bc649fe55f37f8c7c36a12f8edb8 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * abook_database.php
  *
- * Copyright (c) 1999-2002 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,
  *  NOTE. This class should not be used directly. Use the
  *        "AddressBook" class instead.
  *
- * $Id$
+ * @version $Id$
+ * @package squirrelmail
+ * @subpackage addressbook
  */
-   
+
+/** Needs the DB functions */   
 require_once('DB.php');
-   
+
+/**
+ * Undocumented class - stores the addressbook in a sql database
+ * @package squirrelmail
+ */
 class abook_database extends addressbook_backend {
     var $btype = 'local';
     var $bname = 'database';
@@ -68,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 {
@@ -115,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;
@@ -163,7 +174,7 @@ class abook_database extends addressbook_backend {
         }
          
         $query = sprintf("SELECT * FROM %s WHERE owner='%s' AND nickname='%s'",
-                         $this->table, $this->owner, $alias);
+                         $this->table, $this->owner, $this->dbh->quoteString($alias));
 
         $res = $this->dbh->query($query);
 
@@ -191,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);