X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Faddressbook.php;h=a6f916b4b799f02b186618d806d69c932d1a3608;hb=dcc5c9134b5578c657f9f5c45e64c79eb46684c7;hp=a991c35d2ce8fe74cff4dc4d2ed69825b69c56e5;hpb=2e5429900aa5db11d33d092792b195912cb4d295;p=squirrelmail.git diff --git a/functions/addressbook.php b/functions/addressbook.php index a991c35d..a6f916b4 100644 --- a/functions/addressbook.php +++ b/functions/addressbook.php @@ -3,7 +3,7 @@ /** * addressbook.php * - * Copyright (c) 1999-2002 The SquirrelMail Project Team + * Copyright (c) 1999-2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * Functions and classes for the addressbook system. @@ -24,27 +24,13 @@ The global addressbook is unmodifiable by anyone. You must actually use a shell script or whatnot to modify the contents. - global $data_dir; + global $data_dir, $address_book_global_filename; $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'); - global $addrbook_dsn; -/* 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 */ -if(isset($addrbook_dsn) && !empty($addrbook_dsn)) { - include_once('../functions/abook_database.php'); -} - /* Create and initialize an addressbook object. Returns the created object @@ -208,10 +194,12 @@ class AddressBook { */ function full_address($row) { - global $addrsrch_fullname; + global $addrsrch_fullname, $data_dir, $username; - if ((isset($addrsrch_fullname)) && ($addrsrch_fullname)) { - $name = ($addrsrch_fullname === 'nickname') ? $row['nickname'] + if (($prefix = getPref($data_dir, $username, 'addrsrch_fullname') or + isset($addrsrch_fullname) and $prefix = $addrsrch_fullname) + and $prefix !== 'noprefix') { + $name = ($prefix === 'nickname') ? $row['nickname'] : $row['name']; return $name . ' <' . trim($row['email']) . '>'; } else { @@ -543,4 +531,24 @@ function alistcmp($a,$b) { return (strtolower($a['name']) > strtolower($b['name'])) ? 1 : -1; } + +/* + PHP 5 requires that the class be made first, which seems rather + logical, and should have been the way it was generated the first time. +*/ + +require_once(SM_PATH . 'functions/abook_local_file.php'); +require_once(SM_PATH . 'functions/abook_ldap_server.php'); + +/* Use this if you wanna have a global address book */ +if (isset($address_book_global_filename)) { + include_once(SM_PATH . 'functions/abook_global_file.php'); +} + +/* Only load database backend if database is configured */ +if(isset($addrbook_dsn) && !empty($addrbook_dsn)) { + include_once(SM_PATH . 'functions/abook_database.php'); +} + + ?>