/** * Creates a new Horde_Share and creates the address book * on the IMSP server. * * @param array The params for the share. * * @return Horde_Share The share object. * @throws Turba_Exception */ public function createShare($share_id, $params) { $params['params']['name'] = $this->params['username']; if (!isset($params['default']) || $params['default'] !== true) { $params['params']['name'] .= '.' . $params['name']; } $result = Turba::createShare($share_id, $params); try { Horde_Core_Imsp_Utils::createBook($GLOBALS['cfgSources']['imsp'], $params['params']['name']); } catch (Horde_Imsp_Exception $e) { throw new Turba_Exception($e); } return $result; }
$_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];