Centralized init
[squirrelmail.git] / functions / abook_database.php
index bae187bce3d7ec43c25a46487d959b45f4cd37b9..db7e1a008a1cb823f83d40e388f2b587c91b44fb 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * abook_database.php
  *
- * @copyright © 1999-2005 The SquirrelMail Project Team
+ * @copyright © 1999-2006 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -13,7 +13,6 @@
 /** Needs the DB functions */
 if (!include_once('DB.php')) {
     // same error also in db_prefs.php
-    require_once(SM_PATH . 'functions/display_messages.php');
     $error  = _("Could not include PEAR database functions required for the database backend.") . "<br />\n";
     $error .= sprintf(_("Is PEAR installed, and is the include path set correctly to find %s?"),
                         '<tt>DB.php</tt>') . "<br />\n";
@@ -327,9 +326,9 @@ class abook_database extends addressbook_backend {
                          $this->table, $this->owner,
                          $this->dbh->quoteString($userdata['nickname']),
                          $this->dbh->quoteString($userdata['firstname']),
-                         $this->dbh->quoteString($userdata['lastname']),
+                         $this->dbh->quoteString((!empty($userdata['lastname'])?$userdata['lastname']:'')),
                          $this->dbh->quoteString($userdata['email']),
-                         $this->dbh->quoteString($userdata['label']) );
+                         $this->dbh->quoteString((!empty($userdata['label'])?$userdata['label']:'')) );
 
          /* Do the insert */
          $r = $this->dbh->simpleQuery($query);
@@ -407,9 +406,9 @@ class abook_database extends addressbook_backend {
                          $this->table,
                          $this->dbh->quoteString($userdata['nickname']),
                          $this->dbh->quoteString($userdata['firstname']),
-                         $this->dbh->quoteString($userdata['lastname']),
+                         $this->dbh->quoteString((!empty($userdata['lastname'])?$userdata['lastname']:'')),
                          $this->dbh->quoteString($userdata['email']),
-                         $this->dbh->quoteString($userdata['label']),
+                         $this->dbh->quoteString((!empty($userdata['label'])?$userdata['label']:'')),
                          $this->owner,
                          $this->dbh->quoteString($alias) );
 
@@ -426,4 +425,4 @@ class abook_database extends addressbook_backend {
 } /* End of class abook_database */
 
 // vim: et ts=4
-?>
\ No newline at end of file
+?>