diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-06-03 08:02:12 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-06-03 08:02:12 +0000 |
| commit | d40dd8eed2e09c83c92be8428b3d3db7901f1979 (patch) | |
| tree | 4f4783a9621917d9e15ad5e2fb60ffafbbf69147 /roundcubemail/program/include/main.inc | |
| parent | d6d8a0feaca6c856d4ae549c9f0770aa5de9edcb (diff) | |
- Support dynamic hostname (%d/%n) variables in configuration options (#1485438)
git-svn-id: https://svn.roundcube.net/trunk@3701 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/main.inc')
| -rw-r--r-- | roundcubemail/program/include/main.inc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/roundcubemail/program/include/main.inc b/roundcubemail/program/include/main.inc index 6a8179127..e8e92161d 100644 --- a/roundcubemail/program/include/main.inc +++ b/roundcubemail/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 */ |
