Changeset 4484 in subversion


Ignore:
Timestamp:
Feb 3, 2011 8:58:07 AM (2 years ago)
Author:
alec
Message:
  • Fix IDNA support when IDN/INTL modules are in use (#1487742)
Location:
trunk/roundcubemail
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r4483 r4484  
    22=========================== 
    33 
     4- Fix IDNA support when IDN/INTL modules are in use (#1487742) 
    45- Fix handling of invalid HTML comments in messages (#1487759) 
    56- Fix parsing FETCH response for very long headers (#1487753) 
  • trunk/roundcubemail/program/include/main.inc

    r4461 r4484  
    18921892} 
    18931893 
     1894/* 
     1895 * Idn_to_ascii wrapper. 
     1896 * Intl/Idn modules version of this function doesn't work with e-mail address 
     1897 */ 
     1898function rcube_idn_to_ascii($str) 
     1899{ 
     1900  return rcube_idn_convert($str, true); 
     1901} 
     1902 
     1903/* 
     1904 * Idn_to_ascii wrapper. 
     1905 * Intl/Idn modules version of this function doesn't work with e-mail address 
     1906 */ 
     1907function rcube_idn_to_utf8($str) 
     1908{ 
     1909  return rcube_idn_convert($str, false); 
     1910} 
     1911 
     1912function rcube_idn_convert($input, $is_utf=false) 
     1913{ 
     1914  if ($at = strpos($input, '@')) { 
     1915    $user   = substr($input, 0, $at); 
     1916    $domain = substr($input, $at+1); 
     1917  } 
     1918  else { 
     1919    $domain = $input; 
     1920  } 
     1921 
     1922  $domain = $is_utf ? idn_to_ascii($domain) : idn_to_utf8($domain); 
     1923 
     1924  return $at ? $user . '@' . $domain : $domain; 
     1925} 
     1926 
    18941927 
    18951928/** 
  • trunk/roundcubemail/program/include/rcmail.php

    r4480 r4484  
    700700    // Here we need IDNA ASCII 
    701701    // Only rcube_contacts class is using domain names in Unicode 
    702     $host = idn_to_ascii($host); 
     702    $host = rcube_idn_to_ascii($host); 
    703703    if (strpos($username, '@')) { 
    704704      // lowercase domain name 
    705705      list($local, $domain) = explode('@', $username); 
    706706      $username = $local . '@' . mb_strtolower($domain); 
    707       $username = idn_to_ascii($username); 
     707      $username = rcube_idn_to_ascii($username); 
    708708    } 
    709709 
  • trunk/roundcubemail/program/include/rcube_config.php

    r4410 r4484  
    288288 
    289289        if ($encode) 
    290             $domain = idn_to_ascii($domain); 
     290            $domain = rcube_idn_to_ascii($domain); 
    291291 
    292292        return $domain; 
  • trunk/roundcubemail/program/include/rcube_ldap.php

    r4467 r4484  
    139139    foreach ($this->prop['hosts'] as $host) 
    140140    { 
    141       $host = idn_to_ascii(rcube_parse_host($host)); 
     141      $host = rcube_idn_to_ascii(rcube_parse_host($host)); 
    142142      $this->_debug("C: Connect [$host".($this->prop['port'] ? ':'.$this->prop['port'] : '')."]"); 
    143143 
  • trunk/roundcubemail/program/include/rcube_shared.inc

    r4424 r4484  
    720720        } 
    721721 
    722         if ($idn && $domain && preg_match('/(^|@|\.)xn--/i', $domain)) { 
     722        if ($idn && $domain && preg_match('/(^|\.)xn--/i', $domain)) { 
    723723            try { 
    724724                $domain = $idn->decode($domain); 
  • trunk/roundcubemail/program/include/rcube_smtp.php

    r4410 r4484  
    102102 
    103103    // IDNA Support 
    104     $smtp_host = idn_to_ascii($smtp_host); 
     104    $smtp_host = rcube_idn_to_ascii($smtp_host); 
    105105 
    106106    $this->conn = new Net_SMTP($smtp_host, $smtp_port, $helo_host); 
     
    133133    { 
    134134      // IDNA Support 
    135       if (strpos($smtp_user, '@')) 
    136         $smtp_user = idn_to_ascii($smtp_user); 
     135      if (strpos($smtp_user, '@')) { 
     136        $smtp_user = rcube_idn_to_ascii($smtp_user); 
     137      } 
    137138 
    138139      $result = $this->conn->auth($smtp_user, $smtp_pass, $smtp_auth_type, $use_tls, $smtp_authz); 
  • trunk/roundcubemail/program/include/rcube_template.php

    r4424 r4484  
    10351035        } 
    10361036 
    1037         return idn_to_utf8($username); 
     1037        return rcube_idn_to_utf8($username); 
    10381038    } 
    10391039 
  • trunk/roundcubemail/program/steps/addressbook/import.inc

    r4424 r4484  
    137137 
    138138      // We're using UTF8 internally 
    139       $email = idn_to_utf8($email); 
     139      $email = rcube_idn_to_utf8($email); 
    140140       
    141141      if (!$replace) { 
  • trunk/roundcubemail/program/steps/addressbook/save.inc

    r4467 r4484  
    143143foreach ($CONTACTS->get_col_values('email', $a_record, true) as $email) { 
    144144  if (strlen($email)) { 
    145     $_email = idn_to_ascii($email); 
     145    $_email = rcube_idn_to_ascii($email); 
    146146    if (!check_email($_email, false)) { 
    147147      $OUTPUT->show_message('emailformaterror', 'warning', array('email' => $email)); 
  • trunk/roundcubemail/program/steps/mail/addcontact.inc

    r4410 r4484  
    4747    } 
    4848 
    49     $contact['email'] = idn_to_utf8($contact['email']); 
     49    $contact['email'] = rcube_idn_to_utf8($contact['email']); 
    5050 
    5151    // use email address part for name 
  • trunk/roundcubemail/program/steps/mail/compose.inc

    r4481 r4484  
    322322          continue; 
    323323 
    324         $mailto = idn_to_utf8($addr_part['mailto']); 
     324        $mailto = rcube_idn_to_utf8($addr_part['mailto']); 
    325325 
    326326        if (!in_array($mailto, $sa_recipients) 
     
    361361        continue; 
    362362 
    363       $mailto = idn_to_utf8($addr_part['mailto']); 
     363      $mailto = rcube_idn_to_utf8($addr_part['mailto']); 
    364364 
    365365      if ($addr_part['name'] && $addr_part['mailto'] != $addr_part['name']) 
     
    438438    foreach ($user_identities as $sql_arr) 
    439439    { 
    440       $email = mb_strtolower(idn_to_utf8($sql_arr['email'])); 
     440      $email = mb_strtolower(rcube_idn_to_utf8($sql_arr['email'])); 
    441441      $identity_id = $sql_arr['identity_id']; 
    442442      $select_from->add(format_email_recipient($email, $sql_arr['name']), $identity_id); 
     
    735735  $from = array_pop($RCMAIL->imap->decode_address_list($MESSAGE->get_header('from'), 1, false)); 
    736736  $prefix = sprintf("On %s, %s wrote:", 
    737     $MESSAGE->headers->date, $from['name'] ? $from['name'] : idn_to_utf8($from['mailto'])); 
     737    $MESSAGE->headers->date, $from['name'] ? $from['name'] : rcube_idn_to_utf8($from['mailto'])); 
    738738 
    739739  if (!$bodyIsHtml) { 
  • trunk/roundcubemail/program/steps/mail/func.inc

    r4475 r4484  
    12511251    // IDNA ASCII to Unicode 
    12521252    if ($name == $mailto) 
    1253       $name = idn_to_utf8($name); 
     1253      $name = rcube_idn_to_utf8($name); 
    12541254    if ($string == $mailto) 
    1255       $string = idn_to_utf8($string); 
    1256     $mailto = idn_to_utf8($mailto); 
     1255      $string = rcube_idn_to_utf8($string); 
     1256    $mailto = rcube_idn_to_utf8($mailto); 
    12571257 
    12581258    if ($PRINT_MODE) { 
  • trunk/roundcubemail/program/steps/mail/sendmail.inc

    r4410 r4484  
    154154    // address in brackets without name (do nothing) 
    155155    if (preg_match('/^<\S+@\S+>$/', $item)) { 
    156       $item = idn_to_ascii($item); 
     156      $item = rcube_idn_to_ascii($item); 
    157157      $result[] = $item; 
    158158    // address without brackets and without name (add brackets) 
    159159    } else if (preg_match('/^\S+@\S+$/', $item)) { 
    160       $item = idn_to_ascii($item); 
     160      $item = rcube_idn_to_ascii($item); 
    161161      $result[] = '<'.$item.'>'; 
    162162    // address with name (handle name) 
     
    169169            $name = '"'.addcslashes($name, '"').'"'; 
    170170      } 
    171       $address = idn_to_ascii($address); 
     171      $address = rcube_idn_to_ascii($address); 
    172172      if (!preg_match('/^<\S+@\S+>$/', $address)) 
    173173        $address = '<'.$address.'>'; 
  • trunk/roundcubemail/program/steps/settings/edit_identity.inc

    r4410 r4484  
    9595  } 
    9696 
    97   $IDENTITY_RECORD['email']    = idn_to_utf8($IDENTITY_RECORD['email']); 
    98   $IDENTITY_RECORD['reply-to'] = idn_to_utf8($IDENTITY_RECORD['reply-to']); 
    99   $IDENTITY_RECORD['bcc']      = idn_to_utf8($IDENTITY_RECORD['bcc']); 
     97  $IDENTITY_RECORD['email']    = rcube_idn_to_utf8($IDENTITY_RECORD['email']); 
     98  $IDENTITY_RECORD['reply-to'] = rcube_idn_to_utf8($IDENTITY_RECORD['reply-to']); 
     99  $IDENTITY_RECORD['bcc']      = rcube_idn_to_utf8($IDENTITY_RECORD['bcc']); 
    100100 
    101101  // Allow plugins to modify identity form content 
  • trunk/roundcubemail/program/steps/settings/func.inc

    r4429 r4484  
    7373  $list = $USER->list_identities(); 
    7474  foreach ($list as $idx => $row) 
    75     $list[$idx]['mail'] = trim($row['name'] . ' <' . idn_to_utf8($row['email']) .'>'); 
     75    $list[$idx]['mail'] = trim($row['name'] . ' <' . rcube_idn_to_utf8($row['email']) .'>'); 
    7676 
    7777  // get all identites from DB and define list of cols to be displayed 
  • trunk/roundcubemail/program/steps/settings/save_identity.inc

    r4410 r4484  
    6060foreach (array('email', 'reply-to', 'bcc') as $item) { 
    6161  if ($email = $save_data[$item]) { 
    62     $ascii_email = idn_to_ascii($email); 
     62    $ascii_email = rcube_idn_to_ascii($email); 
    6363    if (!check_email($ascii_email, false)) { 
    6464      // show error message 
     
    7878 
    7979  if ($save_data['email']) 
    80     $save_data['email'] = idn_to_ascii($save_data['email']); 
     80    $save_data['email'] = rcube_idn_to_ascii($save_data['email']); 
    8181  if ($save_data['bcc']) 
    82     $save_data['bcc'] = idn_to_ascii($save_data['bcc']); 
     82    $save_data['bcc'] = rcube_idn_to_ascii($save_data['bcc']); 
    8383  if ($save_data['reply-to']) 
    84     $save_data['reply-to'] = idn_to_ascii($save_data['reply-to']); 
     84    $save_data['reply-to'] = rcube_idn_to_ascii($save_data['reply-to']); 
    8585 
    8686  if (!$plugin['abort']) 
     
    117117  $save_data = $plugin['record']; 
    118118 
    119   $save_data['email']    = idn_to_ascii($save_data['email']); 
    120   $save_data['bcc']      = idn_to_ascii($save_data['bcc']); 
    121   $save_data['reply-to'] = idn_to_ascii($save_data['reply-to']); 
     119  $save_data['email']    = rcube_idn_to_ascii($save_data['email']); 
     120  $save_data['bcc']      = rcube_idn_to_ascii($save_data['bcc']); 
     121  $save_data['reply-to'] = rcube_idn_to_ascii($save_data['reply-to']); 
    122122 
    123123  if (!$plugin['abort']) 
Note: See TracChangeset for help on using the changeset viewer.