From e7e79470e425c75495a846435b43350f0b793bb7 Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Mon, 19 Sep 2011 08:34:01 -0400 Subject: [PATCH] - Allow setting connection options in imap_connect hook --- program/include/rcmail.php | 43 +++++++++++++++++++++++++++++++++++-------- 1 files changed, 35 insertions(+), 8 deletions(-) diff --git a/program/include/rcmail.php b/program/include/rcmail.php index f126a91..ca62fa2 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -615,7 +615,7 @@ // Setting root and delimiter before establishing the connection // can save time detecting them using NAMESPACE and LIST $options = array( - 'auth_method' => $this->config->get('imap_auth_type', 'check'), + 'auth_type' => $this->config->get('imap_auth_type', 'check'), 'auth_cid' => $this->config->get('imap_auth_cid'), 'auth_pw' => $this->config->get('imap_auth_pw'), 'debug' => (bool) $this->config->get('imap_debug', 0), @@ -856,6 +856,10 @@ else if ($config['auto_create_user']) { if ($created = rcube_user::create($username, $host)) { $user = $created; + + // fix default settings according to namespace prefix + $this->fix_namespace_settings($user); + // create default folders on first login if ($config['create_default_folders']) $this->imap->create_default_folders(); @@ -970,7 +974,9 @@ /** * Get localized text in the desired language * - * @param mixed Named parameters array or label name + * @param mixed $attrib Named parameters array or label name + * @param string $domain Label domain (plugin) name + * * @return string Localized text */ public function gettext($attrib, $domain=null) @@ -985,7 +991,7 @@ $nr = is_numeric($attrib['nr']) ? $attrib['nr'] : 1; $name = $attrib['name'] ? $attrib['name'] : ''; - + // attrib contain text values: use them from now if (($setval = $attrib[strtolower($_SESSION['language'])]) || ($setval = $attrib['en_us'])) $this->texts[$name] = $setval; @@ -1041,19 +1047,40 @@ /** - * Check if the given text lable exists + * Check if the given text label exists * - * @param string Label name + * @param string $name Label name + * @param string $domain Label domain (plugin) name or '*' for all domains + * @param string $ref_domain Sets domain name if label is found + * * @return boolean True if text exists (either in the current language or in en_US) */ - public function text_exists($name, $domain=null) + public function text_exists($name, $domain = null, &$ref_domain = null) { // load localization files if not done yet if (empty($this->texts)) $this->load_language(); - // check for text with domain first - return ($domain && isset($this->texts[$domain.'.'.$name])) || isset($this->texts[$name]); + if (isset($this->texts[$name])) { + $ref_domain = ''; + return true; + } + + // any of loaded domains (plugins) + if ($domain == '*') { + foreach ($this->plugins->loaded_plugins() as $domain) + if (isset($this->texts[$domain.'.'.$name])) { + $ref_domain = $domain; + return true; + } + } + // specified domain + else if ($domain) { + $ref_domain = $domain; + return isset($this->texts[$domain.'.'.$name]); + } + + return false; } /** -- Gitblit v1.9.1