From: pallo Date: Mon, 5 Feb 2001 09:34:58 +0000 (+0000) Subject: Added example code to help people enable the database addressbook backend. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;ds=sidebyside;h=8f583e40b20348141785d705b295e69464cde9fb;p=squirrelmail.git Added example code to help people enable the database addressbook backend. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1055 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/addressbook.php b/functions/addressbook.php index 2e2ccfda..4d043555 100644 --- a/functions/addressbook.php +++ b/functions/addressbook.php @@ -14,6 +14,9 @@ include('../functions/abook_local_file.php'); include('../functions/abook_ldap_server.php'); + // Un-comment if you're using database backend + // include('../functions/abook_database.php'); + // Create and initialize an addressbook object. // Returns the created object @@ -24,13 +27,30 @@ $abook = new AddressBook; // Always add a local backend + + // Use *either* file-based *or* database addressbook. Remove + // and insert comments to enable the one you want. + + // ------ BEGIN Initialize file-based personal addressbook ------ $filename = sprintf('%s%s.abook', $data_dir, $username); $r = $abook->add_backend('local_file', Array('filename' => $filename, 'create' => true)); + if(!$r && $showerr) { printf(_("Error opening file %s"), $filename); exit; } + // ------ END Initialize file-based personal addressbook ------ + + // ------ BEGIN Initialize database-based personal addressbook ------ + // $r = $abook->add_backend('database', Array('dsn' => 'mysql://dbuser@host/dbname', + // 'owner' => $username, + // 'table' => 'address')); + // if(!$r && $showerr) { + // printf(_("Error initializing addressbook: %s"), $filename); + // exit; + // } + // ------ END Initialize database-based personal addressbook ------ if($onlylocal) return $abook; @@ -260,7 +280,7 @@ $userdata['nickname'] = $userdata['email']; } - if(eregi('[\\: \\|\\#\"\\!]', $userdata['nickname'])) { + if(eregi('[ \:\|\#\"\!]', $userdata['nickname'])) { $this->error = _("Nickname contain illegal characters"); return false; }