+ /* Load global addressbook from SQL if configured */
+ if (isset($addrbook_global_dsn) && !empty($addrbook_global_dsn)) {
+ /* Database configured */
+ if (!isset($addrbook_global_table) || empty($addrbook_global_table)) {
+ $addrbook_global_table = 'global_abook';
+ }
+ $r = $abook->add_backend('database',
+ Array('dsn' => $addrbook_global_dsn,
+ 'owner' => 'global',
+ 'name' => _("Global address book"),
+ 'writeable' => $addrbook_global_writeable,
+ 'listing' => $addrbook_global_listing,
+ 'table' => $addrbook_global_table));
+ /* global abook init error is not fatal. add error message and continue */
+ if (!$r && $showerr) {
+ if ($abook_init_error!='') $abook_init_error.="\n";
+ $abook_init_error.=_("Error initializing global address book.") . "\n" . $abook->error;
+ }
+ }
+
+ /*
+ * hook allows to include different address book backends.
+ * plugins should extract $abook and $r from arguments
+ * and use same add_backend commands as above functions.
+ * Since 1.5.2 hook sends third ($onlylocal) argument to address book
+ * plugins in order to allow detection of local address book init.
+ * @since 1.5.1 and 1.4.5
+ * Since 1.5.2, the plugin arguments are passed inside an array
+ * and by reference, so plugins hooking in here need to accept arguments
+ * in an array and change those values as needed instead of returning
+ * the changed values.
+ */
+ do_hook('abook_init', $temp=array(&$abook, &$r, &$onlylocal));
+ if (!$r && $showerr) {
+ if ($abook_init_error!='') $abook_init_error.="\n";
+ $abook_init_error.=_("Error initializing other address books.") . "\n" . $abook->error;