* IMPORTANT: DO NOT EDIT THIS FILE! DO NOT COPY prefs.php TO prefs.local.php! * Local overrides ONLY MUST be placed in prefs.local.php or prefs.d/. * If the 'vhosts' setting has been enabled in Horde's configuration, you can * use prefs-servername.php. */ $prefGroups['addressbooks'] = array('column' => _("Address Books"), 'label' => _("Address Books"), 'desc' => _("Choose which address books to use."), 'members' => array('default_dir')); $prefGroups['sync'] = array('column' => _("Address Books"), 'label' => _("Synchronization Preferences"), 'desc' => _("Choose which address books to use for synchronization with external devices."), 'members' => array('sync_books', 'activesync_no_multiplex')); $prefGroups['columns'] = array('column' => _("Display Preferences"), 'label' => _("Column Preferences"), 'desc' => _("Select which fields to display in the address lists."), 'members' => array('columnselect')); $prefGroups['display'] = array('column' => _("Display Preferences"), 'label' => _("Display"), 'desc' => _("Select view to display by default and paging preferences."), 'members' => array('initial_page', 'maxpage', 'perpage')); $prefGroups['format'] = array('column' => _("Display Preferences"), 'label' => _("Name Format"), 'desc' => _("Select which format to display names."), 'members' => array('name_format', 'name_sort')); // Address books use for synchronization $_prefs['sync_books'] = array('value' => 'a:0:{}', 'type' => 'multienum', 'enum' => array(), 'desc' => _("Select the address books that should be used for synchronization with external devices:"), 'on_init' => function ($ui) { $enum = array(); $sync_books = @unserialize($GLOBALS['prefs']->getValue('sync_books')); if (empty($sync_books)) { $GLOBALS['prefs']->setValue('sync_books', serialize(array(Turba::getDefaultAddressbook()))); } foreach (Turba::getAddressBooks() as $key => $val) { if (!empty($val['map']['__uid']) && !empty($val['browse'])) { $enum[$key] = $val['title']; } } $ui->prefs['sync_books']['enum'] = $enum; }, 'on_change' => function () { if ($GLOBALS['conf']['activesync']['enabled'] && !$GLOBALS['prefs']->getValue('activesync_no_multiplex')) { try { $sm = $GLOBALS['injector']->getInstance('Horde_ActiveSyncState'); $sm->setLogger($GLOBALS['injector']->getInstance('Horde_Log_Logger')); $devices = $sm->listDevices($GLOBALS['registry']->getAuth()); foreach ($devices as $device) { $sm->removeState(array('devId' => $device['device_id'], 'id' => Horde_Core_ActiveSync_Driver::CONTACTS_FOLDER_UID, 'user' => $GLOBALS['registry']->getAuth()));
/** * Global variables defined: * $addSources - TODO * $attributes - (array) Attribute data from the config/attributes.php * file. * $browse_source_count - TODO * $cfgSources - TODO * $copymoveSources - TODO */ protected function _init() { global $injector, $registry, $session; /* For now, autoloading the Content_* classes depend on there being a * registry entry for the 'content' application that contains at least * the fileroot entry. */ $injector->getInstance('Horde_Autoloader')->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Prefix('/^Content_/', $registry->get('fileroot', 'content') . '/lib/')); if (!class_exists('Content_Tagger')) { throw new Horde_Exception(_("The Content_Tagger class could not be found. Make sure the Content application is installed.")); } // Turba source and attribute configuration. $attributes = $registry->loadConfigFile('attributes.php', 'attributes', 'turba')->config['attributes']; $cfgSources = Turba::availableSources(); /* UGLY UGLY UGLY - we should NOT be using this as a global * variable all over the place. */ $GLOBALS['cfgSources'] =& $cfgSources; // See if any of our sources are configured to use Horde_Share. foreach ($cfgSources as $key => $cfg) { if (!empty($cfg['use_shares'])) { // Create a share instance. $session->set('turba', 'has_share', true); $cfgSources = Turba::getConfigFromShares($cfgSources); break; } } $GLOBALS['attributes'] = $attributes; $cfgSources = Turba::permissionsFilter($cfgSources); // Build the directory sources select widget. if (empty(Turba::$source)) { if (!(Turba::$source = $session->get('turba', 'source'))) { Turba::$source = Turba::getDefaultAddressbook(); } Turba::$source = Horde_Util::getFormData('source', Turba::$source); } $GLOBALS['browse_source_count'] = 0; foreach (Turba::getAddressBooks() as $key => $curSource) { if (!empty($curSource['browse'])) { $GLOBALS['browse_source_count']++; if (empty(Turba::$source)) { Turba::$source = $key; } } } if (empty($cfgSources[Turba::$source]['browse'])) { Turba::$source = Turba::getDefaultAddressbook(); } $session->set('turba', 'source', Turba::$source); $GLOBALS['addSources'] = Turba::getAddressBooks(Horde_Perms::EDIT, array('require_add' => true)); $GLOBALS['copymoveSources'] = $GLOBALS['addSources']; unset($GLOBALS['copymoveSources'][Turba::$source]); }
/** */ protected function _getSource($source) { global $cfgSources, $injector, $prefs; /* Get default address book from user preferences. */ if (empty($source) && !($source = $prefs->getValue('default_dir'))) { // On new installations default_dir is not set. Try default // addressbook if it's editable. Otherwise use first editable // addressbook. $edit_sources = Turba::getAddressBooks(Horde_Perms::EDIT); $default_source = Turba::getDefaultAddressbook(); if (isset($edit_sources[$default_source])) { // use default addressbook $source = $default_source; } else { // Use first writable source $source = reset($edit_sources); } } // Check existence of and permissions on the specified source. if (!isset($cfgSources[$source])) { throw new Turba_Exception(sprintf(_("Invalid address book: %s"), $source)); } return $source; }
/** * @throws Turba_Exception */ private function _getSources($sources) { /* Get default address book from user preferences. */ if (empty($sources)) { $sources = @unserialize($GLOBALS['prefs']->getValue('sync_books')); } elseif (!is_array($sources)) { $sources = array($sources); } if (empty($sources)) { $sources = array(Turba::getDefaultAddressbook()); if (empty($sources)) { throw new Turba_Exception(_("No address book specified")); } } foreach ($sources as $val) { if (!strlen($val) || !isset($GLOBALS['cfgSources'][$val])) { throw new Turba_Exception(sprintf(_("Invalid address book: %s"), $val)); } } return $sources; }