summaryrefslogtreecommitdiff
path: root/program/include/main.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-01-17 12:21:08 +0000
committeralecpl <alec@alec.pl>2011-01-17 12:21:08 +0000
commita76cbddfc92adbf4e8cb18dda5f668ec4de8a114 (patch)
tree846662bbafbf29010d488b8112547330160df255 /program/include/main.inc
parent68d2d541002017dae51127aa05af58d19916655b (diff)
- Fix %h/%z variables in username_domain option (#1487701)
Diffstat (limited to 'program/include/main.inc')
-rw-r--r--program/include/main.inc5
1 files changed, 3 insertions, 2 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index 7466207e1..1ddb5f9c4 100644
--- a/program/include/main.inc
+++ b/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);