/**
* addressbook.php
*
- * Copyright (c) 1999-2001 The Squirrelmail Development Team
+ * Copyright (c) 1999-2002 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* Functions and classes for the addressbook system.
}
/* Only load database backend if database is configured */
-if(isset($addrbook_dsn)) {
+if(isset($addrbook_dsn) && !empty($addrbook_dsn)) {
include_once('../functions/abook_database.php');
}
*/
function addressbook_init($showerr = true, $onlylocal = false) {
global $data_dir, $username, $ldap_server, $address_book_global_filename;
- global $addrbook_dsn;
+ global $addrbook_dsn, $addrbook_table;
/* Create a new addressbook object */
$abook = new AddressBook;
*/
if (isset($addrbook_dsn) && !empty($addrbook_dsn)) {
/* Database */
+ if (!isset($addrbook_table) || empty($addrbook_table)) {
+ $addrbook_table = 'address';
+ }
$r = $abook->add_backend('database', Array('dsn' => $addrbook_dsn,
'owner' => $username,
- 'table' => 'address'));
+ 'table' => $addrbook_table));
if (!$r && $showerr) {
echo _("Error initializing addressbook database.");
exit;
return $ret;
}
-
/*
* Create a new address from $userdata, in backend $bnum.
* Return the backend number that the/ address was added
}
-?>
\ No newline at end of file
+/* Sort array by the key "name" */
+function alistcmp($a,$b) {
+ if ($a['backend'] > $b['backend']) {
+ return 1;
+ } else {
+ if ($a['backend'] < $b['backend']) {
+ return -1;
+ }
+ }
+ return (strtolower($a['name']) > strtolower($b['name'])) ? 1 : -1;
+}
+
+?>