Added example code to help people enable the database addressbook backend.
authorpallo <pallo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 5 Feb 2001 09:34:58 +0000 (09:34 +0000)
committerpallo <pallo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 5 Feb 2001 09:34:58 +0000 (09:34 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1055 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/addressbook.php

index 2e2ccfd..4d04355 100644 (file)
@@ -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
       $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;
            $userdata['nickname'] = $userdata['email'];
         }
 
-        if(eregi('[\\: \\|\\#\"\\!]', $userdata['nickname'])) {
+        if(eregi('[ \:\|\#\"\!]', $userdata['nickname'])) {
            $this->error = _("Nickname contain illegal characters");
            return false;
         }