X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Faddressbook.php;h=457ca7daab568b60e1aea5e508ec271b37a1fa62;hb=29eb54865a68627bd3dc4934103a1a38f8db4678;hp=6a7a7dca1410d7c044d801e82cd1d608096513b7;hpb=66dbe1d4c4d37452c6e34fd9545ce5f5916112d1;p=squirrelmail.git diff --git a/functions/addressbook.php b/functions/addressbook.php index 6a7a7dca..457ca7da 100644 --- a/functions/addressbook.php +++ b/functions/addressbook.php @@ -1,31 +1,65 @@ in main directory) +// +// If you don't want a global site-wide addressbook, comment these +// two lines out. (They are disabled by default.) +// +// The global addressbook is unmodifiable by anyone. You must actually +// use a shell script or whatnot to modify the contents. +// +//global $data_dir; +//$address_book_global_filename = "$data_dir/global.abook"; + +// Include backends here. +require_once('../functions/abook_local_file.php'); +require_once('../functions/abook_ldap_server.php'); + + // Use this if you wanna have a global address book + if (isset($address_book_global_filename)) + include_once('../functions/abook_global_file.php'); // Only load database backend if database is configured global $addrbook_dsn; if(isset($addrbook_dsn)) - include('../functions/abook_database.php'); + include_once('../functions/abook_database.php'); // Create and initialize an addressbook object. // Returns the created object function addressbook_init($showerr = true, $onlylocal = false) { - global $data_dir, $username, $ldap_server; + global $data_dir, $username, $ldap_server, $address_book_global_filename; global $addrbook_dsn; // Create a new addressbook object @@ -45,13 +79,23 @@ } } else { // File - $filename = sprintf('%s%s.abook', $data_dir, $username); + $filename = getHashedFile($username, $data_dir, "$username.abook"); $r = $abook->add_backend('local_file', Array('filename' => $filename, 'create' => true)); if(!$r && $showerr) { printf(_("Error opening file %s"), $filename); exit; } + + } + + // This would be for the global addressbook + if (isset($address_book_global_filename)) { + $r = $abook->add_backend('global_file'); + if (!$r && $showerr) { + printf(_("Error initializing global addressbook.")); + exit; + } } if($onlylocal) @@ -284,7 +328,7 @@ } if(eregi('[ \\:\\|\\#\\"\\!]', $userdata['nickname'])) { - $this->error = _("Nickname contain illegal characters"); + $this->error = _("Nickname contains illegal characters"); return false; } @@ -362,7 +406,7 @@ } if(eregi('[\\: \\|\\#"\\!]', $userdata['nickname'])) { - $this->error = _("Nickname contain illegal characters"); + $this->error = _("Nickname contains illegal characters"); return false; }