- Added the %s variable in 'default_host' and 'smtp_server' option (%s variable is the domain name after the '@' from e-mail address provided at login screen). The %s just returns a value if the provided e-mail is valid to avoid unnecessary lookups and reduce the possibility of connections to undesirable hosts.

- Small fix to the code comment of rcube_parse_host()
release-0.6
vbenincasa 14 years ago
parent 60a277f1ce
commit b04c51fafb

@ -64,6 +64,7 @@ $rcmail_config['smtp_debug'] = false;
// Supported replacement variables: // Supported replacement variables:
// %n - http hostname ($_SERVER['SERVER_NAME']) // %n - http hostname ($_SERVER['SERVER_NAME'])
// %d - domain (http hostname without the first part) // %d - domain (http hostname without the first part)
// %s - domain name after the '@' from e-mail address provided at login screen
// For example %n = mail.domain.tld, %d = domain.tld // For example %n = mail.domain.tld, %d = domain.tld
$rcmail_config['default_host'] = ''; $rcmail_config['default_host'] = '';
@ -119,6 +120,7 @@ $rcmail_config['imap_auth_pw'] = null;
// %h - user's IMAP hostname // %h - user's IMAP hostname
// %n - http hostname ($_SERVER['SERVER_NAME']) // %n - http hostname ($_SERVER['SERVER_NAME'])
// %d - domain (http hostname without the first part) // %d - domain (http hostname without the first part)
// %s - domain name after the '@' from e-mail address provided at login screen
// %z - IMAP domain (IMAP hostname without the first part) // %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %d = domain.tld // For example %n = mail.domain.tld, %d = domain.tld
$rcmail_config['smtp_server'] = ''; $rcmail_config['smtp_server'] = '';

@ -1673,14 +1673,17 @@ function rcube_parse_host($name, $host='')
{ {
// %n - host // %n - host
$n = preg_replace('/:\d+$/', '', $_SERVER['SERVER_NAME']); $n = preg_replace('/:\d+$/', '', $_SERVER['SERVER_NAME']);
// %d - domain name without first part, e.g. %d=mail.domain.tld, %m=domain.tld // %d - domain name without first part, e.g. %n=mail.domain.tld, %d=domain.tld
$d = preg_replace('/^[^\.]+\./', '', $n); $d = preg_replace('/^[^\.]+\./', '', $n);
// %h - IMAP host // %h - IMAP host
$h = $_SESSION['imap_host'] ? $_SESSION['imap_host'] : $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 - IMAP domain without first part, e.g. %h=imap.domain.tld, %z=domain.tld
$z = preg_replace('/^[^\.]+\./', '', $h); $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);
$name = str_replace(array('%n', '%d', '%h', '%z'), array($n, $d, $h, $z), $name); $name = str_replace(array('%n', '%d', '%h', '%z', '%s'), array($n, $d, $h, $z, $s[0]), $name);
return $name; return $name;
} }

Loading…
Cancel
Save