} catch (Horde_Exception $e) { $notification->push($e); Horde::url('search.php', true)->redirect(); } /* We create the vbook and redirect before we try to search * since we are not displaying the search results on this page * anyway. */ $vname = $vars->vbook_name; if (empty($vname)) { $notification->push(_("You must provide a name for virtual address books."), 'horde.error'); Horde::url('search.php', true)->redirect(); } /* Create the vbook. */ $params = array('name' => $vname, 'params' => serialize(array('type' => 'vbook', 'source' => $source, 'criteria' => $criteria))); try { $share = Turba::createShare(strval(new Horde_Support_Randomid()), $params); $vid = $share->getName(); } catch (Horde_Share_Exception $e) { $notification->push(sprintf(_("There was a problem creating the virtual address book: %s"), $e->getMessage()), 'horde.error'); Horde::url('search.php', true)->redirect(); } $notification->push(sprintf(_("Successfully created virtual address book \"%s\""), $vname), 'horde.success'); Horde::url('browse.php', true)->add('source', $vid)->redirect(); } /* Perform a search. */ if ($search_mode == 'duplicate') { try { $duplicates = $driver->searchDuplicates(); $view = new Turba_View_Duplicates($duplicates, $driver, $vars->type, $vars->dupe); $page_output->addScriptFile('tables.js', 'horde'); } catch (Exception $e) {
/** * Create a new addressbook * * @param string $name The display name for the addressbook. * @param array $params Any addtional parameters needed. * - synchronize: (boolean) If true, add address book to the list of * address books to syncronize. * DEFAULT: false (do not add to the list). * @since 4.2.1 * * @return string The new addressbook's id (share name). * @since 4.2.0 */ public function addAddressbook($name, array $params = array()) { $share_name = strval(new Horde_Support_Randomid()); $share = Turba::createShare($share_name, array('name' => $name)); $name = $share->getName(); if (!empty($params['synchronize'])) { $sync = @unserialize($prefs->getValue('sync_books')); $sync[] = $name; $prefs->setValue('sync_books', serialize($sync)); } return $name; }
/** * 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; }
/** * Creates a new Horde_Share for this source type. * * @param string $share_name The share name * @param array $params The params for the share. * * @return Horde_Share The share object. */ public function createShare($share_name, array $params) { if (!isset($params['name'])) { $params['name'] = _('Contacts'); } if (!empty($params['params']['default'])) { $params['default'] = true; unset($params['params']['default']); } return Turba::createShare($share_name, $params); }
/** * Creates a new Horde_Share for this source type. * * @param string $share_name The share name * @param array $params The params for the share. * * @return Horde_Share The share object. */ public function createShare($share_name, array $params) { // If the raw address book name is not set, use the share name if (empty($params['params']['name'])) { $params['params']['name'] = $share_name; } return Turba::createShare($share_name, $params); }