summaryrefslogtreecommitdiff
path: root/program/include/main.inc
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-06-03 08:02:12 +0000
committeralecpl <alec@alec.pl>2010-06-03 08:02:12 +0000
commitbb8721aaeb4961f0dee8ca250749906e01a8f6a8 (patch)
tree743b5444c38d9903331079e95bf99b42c83ba3b0 /program/include/main.inc
parent05a631a43c1950fc99f817cb50e4184dc0696663 (diff)
- Support dynamic hostname (%d/%n) variables in configuration options (#1485438)
Diffstat (limited to 'program/include/main.inc')
-rw-r--r--program/include/main.inc16
1 files changed, 16 insertions, 0 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index 6a8179127..e8e92161d 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1532,6 +1532,7 @@ function rcube_https_check($port=null, $use_https=true)
return false;
}
+
// for backward compatibility
function rcube_sess_unset($var_name=null)
{
@@ -1541,6 +1542,21 @@ function rcube_sess_unset($var_name=null)
}
+// Replaces hostname variables
+function rcube_parse_host($name)
+{
+ // %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'];
+
+ $name = str_replace(array('%n', '%d', '%h'), array($n, $d, $h), $name);
+ return $name;
+}
+
+
/**
* E-mail address validation
*/