getAllBooks() public static méthode

Utility function to retrieve the names of all the address books that the user has access to, along with the acl for those books. For information about the $serverInfo array see turba/config/sources.php as this is the cfgSources[] entry for the address books.
public static getAllBooks ( array $serverInfo ) : array
$serverInfo array Information about the server and the current user.
Résultat array Information about all the address books or PEAR_Error.
Exemple #1
0
 $_imsp_auth_pass = $GLOBALS['prefs']->getValue('imsp_auth_pass');
 if (!strlen($_imsp_auth_user)) {
     $_imsp_auth_user = $GLOBALS['registry']->getAuth('bare');
     $_imsp_auth_pass = $GLOBALS['registry']->getAuthCredential('password');
 }
 $cfgSources['imsp'] = array('disabled' => false, 'title' => _("IMSP"), 'type' => 'imsp', 'params' => array('server' => $GLOBALS['conf']['imsp']['server'], 'port' => $GLOBALS['conf']['imsp']['port'], 'auth_method' => $GLOBALS['conf']['imsp']['auth_method'], 'socket' => isset($GLOBALS['conf']['imsp']['socket']) ? $GLOBALS['conf']['imsp']['socket'] . $_imsp_auth_user . '.sck' : '', 'command' => isset($GLOBALS['conf']['imsp']['command']) ? $GLOBALS['conf']['imsp']['command'] : '', 'auth_mechanism' => isset($GLOBALS['conf']['imsp']['auth_mechanism']) ? $GLOBALS['conf']['imsp']['auth_mechanism'] : '', 'username' => $_imsp_auth_user, 'password' => $_imsp_auth_pass, 'name' => $_imsp_auth_user, 'group_id_field' => 'group', 'group_id_value' => 'group', 'contact_ownership' => false, 'my_rights' => ''), 'map' => array('__key' => 'name', '__type' => '__type', '__members' => '__members', '__owner' => '__owner', '__uid' => '__uid', 'name' => 'fullname', 'email' => 'email', 'alias' => 'alias', 'company' => 'company', 'notes' => 'notes', 'workPhone' => 'phone-work', 'fax' => 'fax', 'homePhone' => 'phone-home', 'cellPhone' => 'cellphone', 'freebusyUrl' => 'freebusyUrl'), 'search' => array('name', 'email', 'alias', 'company', 'homePhone'), 'strict' => array('__uid'), 'export' => true, 'browse' => true, 'use_shares' => false);
 /**
  * Get any other address books this user might be privy to.
  * The values for attributes such as 'export' and 'browse' for books
  * that are added below will be the same as the values set in the default
  * book above. Any entries defined explicitly in cfgSources[]
  * will override any entries gathered dynamically below.
  */
 if (empty($cfgSources['imsp']['use_shares']) && !empty($cfgSources['imsp']['enabled'])) {
     try {
         $result = Horde_Core_Imsp_Utils::getAllBooks($cfgSources['imsp']);
         $resultCount = count($result);
         for ($i = 0; $i < $resultCount; ++$i) {
             // Make sure we didn't define this source explicitly,
             // but set the acls from the server regardless.
             $dup = false;
             foreach ($cfgSources as $key => $thisSource) {
                 if ($thisSource['type'] == 'imsp' && $thisSource['params']['name'] == $result[$i]['params']['name']) {
                     $dup = true;
                     $acl = $result[$i]['params']['my_rights'];
                     $cfgSources[$key]['params']['my_rights'] = $acl;
                     break;
                 }
             }
             if (!$dup) {
                 $cfgSources[$result[$i]['params']['name']] = $result[$i];