diff options
| author | netbit <netbit@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-05-01 19:27:15 +0000 |
|---|---|---|
| committer | netbit <netbit@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-05-01 19:27:15 +0000 |
| commit | 09d8d417fa143d5733336abfd9bcc4c25a04662e (patch) | |
| tree | 02e1f5d31374abf1616fc85a37f3b89dfd728927 /roundcubemail/program | |
| parent | b7354a69aee4038bef7dcd7939b0f89c15a9911c (diff) | |
- Now the %s variable (used in default_host) works with IDN and with Master users from dovecot too (like user@domain.com*master)
- rcube_parse_host() now returns false if %s is used and an invalid email is provided (to work better when a prefix is used in default_host like 'mail.%s')
git-svn-id: https://svn.roundcube.net/trunk@4714 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
| -rw-r--r-- | roundcubemail/program/include/main.inc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/roundcubemail/program/include/main.inc b/roundcubemail/program/include/main.inc index 0c83af26b..1947e3573 100644 --- a/roundcubemail/program/include/main.inc +++ b/roundcubemail/program/include/main.inc @@ -1679,11 +1679,14 @@ function rcube_parse_host($name, $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); - // %s - domain name after the '@' from e-mail address provided at login screen - if ( filter_var(get_input_value('_user', RCUBE_INPUT_POST), FILTER_VALIDATE_EMAIL) !== FALSE ) - preg_match('/[^@]+$/', get_input_value('_user', RCUBE_INPUT_POST), $s); + // %s - domain name after the '@' from e-mail address provided at login screen. Returns FALSE if an invalid email is provided + if ( strpos($name, '%s') !== false ){ + $user_email = rcube_idn_convert(get_input_value('_user', RCUBE_INPUT_POST), true); + if ( preg_match('/(.*)@([a-z0-9\.\-\[\]\:]+)/i', $user_email, $s) < 1 || filter_var($s[1]."@".$s[2], FILTER_VALIDATE_EMAIL) === false ) + return false; + } - $name = str_replace(array('%n', '%d', '%h', '%z', '%s'), array($n, $d, $h, $z, $s[0]), $name); + $name = str_replace(array('%n', '%d', '%h', '%z', '%s'), array($n, $d, $h, $z, $s[2]), $name); return $name; } |
