/** */ public function __get($key) { switch ($key) { case 'base_ob': return $GLOBALS['injector']->getInstance('IMP_Factory_Imap')->create(); case 'config': return $this->base_ob->config; case 'server_key': return $this->base_ob->server_key; case 'thread_algo': $thread = $this->base_ob->thread; $thread_cap = $this->queryCapability('THREAD'); return in_array($thread, is_array($thread_cap) ? $thread_cap : array()) ? $thread : 'ORDEREDSUBJECT'; } return parent::__get($key); }
/** * @see Horde_Registry_Application#perms() */ public function perms() { $perms = array('backends' => array('title' => _("Backends"))); foreach ($this->_perms as $key => $val) { if (!empty($val['global'])) { $perms[$key] = $val; } } // Run through every active backend. foreach (IMP_Imap::loadServerConfig() as $key => $val) { $bkey = 'backends:' . $key; $perms[$bkey] = array('title' => $val->name); foreach ($this->_perms as $key2 => $val2) { if (empty($val2['global']) && (empty($val2['imaponly']) || $val->protocol == 'imap')) { $perms[$bkey . ':' . $key2] = array('title' => $val2['title'], 'type' => $val2['type']); } } } return $perms; }
/** * Returns the autologin server key. * * @return string The server key, or null if none available. */ public static function getAutoLoginServer() { if (($servers = IMP_Imap::loadServerConfig()) === false) { return null; } $server_key = null; foreach ($servers as $key => $val) { if (is_null($server_key) && substr($key, 0, 1) != '_') { $server_key = $key; } /* Determines if the given mail server is the "preferred" mail * server for this web server. This decision is based on the * global 'SERVER_NAME' and 'HTTP_HOST' server variables and the * contents of the 'preferred' field in the backend's config. */ if (($preferred = $val->preferred) && (in_array($_SERVER['SERVER_NAME'], $preferred) || in_array($_SERVER['HTTP_HOST'], $preferred))) { return $key; } } return $server_key; }
/** */ public function authLoginParams() { $params = array(); if ($GLOBALS['conf']['server']['server_list'] == 'shown') { $server_list = array(); $selected = is_null($this->_oldserver) ? $GLOBALS['injector']->getInstance('Horde_Variables')->get('imp_server_key', IMP_Auth::getAutoLoginServer()) : $this->_oldserver; foreach (IMP_Imap::loadServerConfig() as $key => $val) { $server_list[$key] = array('name' => $val->name, 'selected' => $selected == $key); } $params['imp_server_key'] = array('label' => _("Server"), 'type' => 'select', 'value' => $server_list); } /* Show selection of alternate views. */ $js_code = array('HordeLogin.server_key_error' => _("Please choose a mail server.")); return array('js_code' => $js_code, 'js_files' => array(array('login.js', 'imp')), 'params' => $params); }