From e99991996dbb9e7b0b0ff6cfa94dc0fb2522eb66 Mon Sep 17 00:00:00 2001 From: alecpl Date: Wed, 29 Sep 2010 12:36:28 +0000 Subject: - Add Internationalized Domain Name (IDNA) support (#1483894) --- installer/check.php | 26 ++++++++++++++------------ installer/test.php | 20 +++++++++++++------- 2 files changed, 27 insertions(+), 19 deletions(-) (limited to 'installer') diff --git a/installer/check.php b/installer/check.php index 408f477b5..7fa4d95d3 100644 --- a/installer/check.php +++ b/installer/check.php @@ -15,6 +15,7 @@ $optional_php_exts = array( 'Multibyte' => 'mbstring', 'OpenSSL' => 'openssl', 'Mcrypt' => 'mcrypt', + 'Intl' => 'intl', ); $required_libs = array( @@ -44,19 +45,20 @@ $optional_checks = array( ); $source_urls = array( - 'Sockets' => 'http://www.php.net/manual/en/book.sockets.php', - 'Session' => 'http://www.php.net/manual/en/book.session.php', - 'PCRE' => 'http://www.php.net/manual/en/book.pcre.php', - 'FileInfo' => 'http://www.php.net/manual/en/book.fileinfo.php', - 'Libiconv' => 'http://www.php.net/manual/en/book.iconv.php', + 'Sockets' => 'http://www.php.net/manual/en/book.sockets.php', + 'Session' => 'http://www.php.net/manual/en/book.session.php', + 'PCRE' => 'http://www.php.net/manual/en/book.pcre.php', + 'FileInfo' => 'http://www.php.net/manual/en/book.fileinfo.php', + 'Libiconv' => 'http://www.php.net/manual/en/book.iconv.php', 'Multibyte' => 'http://www.php.net/manual/en/book.mbstring.php', - 'Mcrypt' => 'http://www.php.net/manual/en/book.mcrypt.php', - 'OpenSSL' => 'http://www.php.net/manual/en/book.openssl.php', - 'JSON' => 'http://www.php.net/manual/en/book.json.php', - 'DOM' => 'http://www.php.net/manual/en/book.dom.php', - 'PEAR' => 'http://pear.php.net', - 'MDB2' => 'http://pear.php.net/package/MDB2', - 'Net_SMTP' => 'http://pear.php.net/package/Net_SMTP', + 'Mcrypt' => 'http://www.php.net/manual/en/book.mcrypt.php', + 'OpenSSL' => 'http://www.php.net/manual/en/book.openssl.php', + 'JSON' => 'http://www.php.net/manual/en/book.json.php', + 'DOM' => 'http://www.php.net/manual/en/book.dom.php', + 'Intl' => 'http://www.php.net/manual/en/book.intl.php', + 'PEAR' => 'http://pear.php.net', + 'MDB2' => 'http://pear.php.net/package/MDB2', + 'Net_SMTP' => 'http://pear.php.net/package/Net_SMTP', 'Mail_mime' => 'http://pear.php.net/package/Mail_mime', ); diff --git a/installer/test.php b/installer/test.php index 45de5e842..713edfbb6 100644 --- a/installer/test.php +++ b/installer/test.php @@ -249,18 +249,21 @@ if (isset($_POST['sendmail'])) { echo '

Trying to send email...
'; - if (preg_match('/^' . $RCI->email_pattern . '$/i', trim($_POST['_from'])) && - preg_match('/^' . $RCI->email_pattern . '$/i', trim($_POST['_to']))) { + $from = idn_to_ascii(trim($_POST['_from'])); + $to = idn_to_ascii(trim($_POST['_to'])); + if (preg_match('/^' . $RCI->email_pattern . '$/i', $from) && + preg_match('/^' . $RCI->email_pattern . '$/i', $to) + ) { $headers = array( - 'From' => trim($_POST['_from']), - 'To' => trim($_POST['_to']), + 'From' => $from, + 'To' => $to, 'Subject' => 'Test message from Roundcube', ); $body = 'This is a test to confirm that Roundcube can send email.'; $smtp_response = array(); - + // send mail using configured SMTP server if ($RCI->getprop('smtp_server')) { $CONFIG = $RCI->config; @@ -383,9 +386,12 @@ if (isset($_POST['imaptest']) && !empty($_POST['_host']) && !empty($_POST['_user $imap_host = trim($_POST['_host']); $imap_port = $RCI->getprop('default_port'); } - + + $imap_host = idn_to_ascii($imap_host); + $imap_user = idn_to_ascii($_POST['_user']); + $imap = new rcube_imap(null); - if ($imap->connect($imap_host, $_POST['_user'], $_POST['_pass'], $imap_port, $imap_ssl)) { + if ($imap->connect($imap_host, $imap_user, $_POST['_pass'], $imap_port, $imap_ssl)) { $RCI->pass('IMAP connect', 'SORT capability: ' . ($imap->get_capability('SORT') ? 'yes' : 'no')); $imap->close(); } -- cgit v1.2.3