summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-01-17 12:21:08 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-01-17 12:21:08 +0000
commitf63d7675d829fedbaa12691f6ac498c525fd24b4 (patch)
treed072dab8e7f204d9c0e93315efb4fc47e4b10ec2
parent99f1c0ac10b020078f1ea512fefae8042a63c339 (diff)
- Fix %h/%z variables in username_domain option (#1487701)
git-svn-id: https://svn.roundcube.net/trunk@4420 208e9e7b-5314-0410-a742-e7e81cd9613c
-rw-r--r--roundcubemail/CHANGELOG1
-rw-r--r--roundcubemail/program/include/main.inc5
-rw-r--r--roundcubemail/program/include/rcmail.php4
3 files changed, 6 insertions, 4 deletions
diff --git a/roundcubemail/CHANGELOG b/roundcubemail/CHANGELOG
index b7de8145a..28f6914fb 100644
--- a/roundcubemail/CHANGELOG
+++ b/roundcubemail/CHANGELOG
@@ -3,6 +3,7 @@ CHANGELOG Roundcube Webmail
- Fix login redirect issues (#1487686)
- Require PHP 5.2.1 or greater
+- Fix %h/%z variables in username_domain option (#1487701)
RELEASE 0.5
-----------
diff --git a/roundcubemail/program/include/main.inc b/roundcubemail/program/include/main.inc
index 7466207e1..1ddb5f9c4 100644
--- a/roundcubemail/program/include/main.inc
+++ b/roundcubemail/program/include/main.inc
@@ -1771,16 +1771,17 @@ function rcube_sess_unset($var_name=null)
* Replaces hostname variables
*
* @param string $name Hostname
+ * @param string $host Optional IMAP hostname
* @return string
*/
-function rcube_parse_host($name)
+function rcube_parse_host($name, $host='')
{
// %n - host
$n = preg_replace('/:\d+$/', '', $_SERVER['SERVER_NAME']);
// %d - domain name without first part, e.g. %d=mail.domain.tld, %m=domain.tld
$d = preg_replace('/^[^\.]+\./', '', $n);
// %h - IMAP host
- $h = $_SESSION['imap_host'];
+ $h = $_SESSION['imap_host'] ? $_SESSION['imap_host'] : $host;
// %z - IMAP domain without first part, e.g. %h=imap.domain.tld, %z=domain.tld
$z = preg_replace('/^[^\.]+\./', '', $h);
diff --git a/roundcubemail/program/include/rcmail.php b/roundcubemail/program/include/rcmail.php
index 7c8d4fc33..cdf959f2e 100644
--- a/roundcubemail/program/include/rcmail.php
+++ b/roundcubemail/program/include/rcmail.php
@@ -674,9 +674,9 @@ class rcmail
// Check if we need to add domain
if (!empty($config['username_domain']) && strpos($username, '@') === false) {
if (is_array($config['username_domain']) && isset($config['username_domain'][$host]))
- $username .= '@'.rcube_parse_host($config['username_domain'][$host]);
+ $username .= '@'.rcube_parse_host($config['username_domain'][$host], $host);
else if (is_string($config['username_domain']))
- $username .= '@'.rcube_parse_host($config['username_domain']);
+ $username .= '@'.rcube_parse_host($config['username_domain'], $host);
}
// Convert username to lowercase. If IMAP backend