Changeset 4714 in subversion


Ignore:
Timestamp:
May 1, 2011 3:27:15 PM (2 years ago)
Author:
netbit
Message:
  • Now the %s variable (used in default_host) works with IDN and with Master users from dovecot too (like user@…*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')
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/main.inc

    r4705 r4714  
    16801680  // %z - IMAP domain without first part, e.g. %h=imap.domain.tld, %z=domain.tld 
    16811681  $z = preg_replace('/^[^\.]+\./', '', $h); 
    1682   // %s - domain name after the '@' from e-mail address provided at login screen 
    1683   if ( filter_var(get_input_value('_user', RCUBE_INPUT_POST), FILTER_VALIDATE_EMAIL) !== FALSE ) 
    1684     preg_match('/[^@]+$/', get_input_value('_user', RCUBE_INPUT_POST), $s); 
    1685  
    1686   $name = str_replace(array('%n', '%d', '%h', '%z', '%s'), array($n, $d, $h, $z, $s[0]), $name); 
     1682  // %s - domain name after the '@' from e-mail address provided at login screen. Returns FALSE if an invalid email is provided 
     1683  if ( strpos($name, '%s') !== false ){ 
     1684    $user_email = rcube_idn_convert(get_input_value('_user', RCUBE_INPUT_POST), true); 
     1685    if ( preg_match('/(.*)@([a-z0-9\.\-\[\]\:]+)/i', $user_email, $s) < 1 || filter_var($s[1]."@".$s[2], FILTER_VALIDATE_EMAIL) === false ) 
     1686      return false; 
     1687  } 
     1688 
     1689  $name = str_replace(array('%n', '%d', '%h', '%z', '%s'), array($n, $d, $h, $z, $s[2]), $name); 
    16871690  return $name; 
    16881691} 
Note: See TracChangeset for help on using the changeset viewer.