diff options
author | thomascube <thomas@roundcube.net> | 2012-01-25 08:18:30 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2012-01-25 08:18:30 +0000 |
commit | 48f04d368e67fe61796c18aaf72df17465a74004 (patch) | |
tree | 96fa85c6d463daf09b92bd342e30b2459c40439d /program | |
parent | 567be64c28f0a83c3d0a8aaa839a2d708cf95963 (diff) |
Fix autoselect_host() for login (#1488297)
Diffstat (limited to 'program')
-rw-r--r-- | program/include/rcmail.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 65877378f..5965099c9 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -1020,16 +1020,21 @@ class rcmail list($user, $domain) = explode('@', get_input_value('_user', RCUBE_INPUT_POST)); if (!empty($domain)) { foreach ($default_host as $storage_host => $mail_domains) { - if (is_array($mail_domains) && in_array($domain, $mail_domains)) { + if (is_array($mail_domains) && in_array_nocase($domain, $mail_domains)) { $host = $storage_host; break; } + else if (stripos($storage_host, $domain) !== false || stripos(strval($mail_domains), $domain) !== false) { + $host = is_numeric($storage_host) ? $mail_domains : $storage_host; + break; + } } } - // take the first entry if $host is still an array + // take the first entry if $host is still not set if (empty($host)) { - $host = array_shift($default_host); + list($key, $val) = each($default_host); + $host = is_numeric($key) ? $val : $key; } } else if (empty($default_host)) { |