From: Jan Schneider Date: Thu, 23 Sep 2010 16:35:14 +0000 (+0200) Subject: Turns out that this other extension is even broken. Check for function names instead... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=141a4f61b5b20aa246ef3b7da2edc9123ddf5b1a;p=horde.git Turns out that this other extension is even broken. Check for function names instead, and only support the official extension. --- diff --git a/framework/Mime/lib/Horde/Mime/Address.php b/framework/Mime/lib/Horde/Mime/Address.php index 4ac5e7e04..02fd9a125 100644 --- a/framework/Mime/lib/Horde/Mime/Address.php +++ b/framework/Mime/lib/Horde/Mime/Address.php @@ -52,13 +52,8 @@ class Horde_Mime_Address $host = ltrim($host, '@'); if ((!isset($opts['idn']) || !$opts['idn']) && (stripos($host, 'xn--') === 0) && - Horde_Util::extensionExists('idn')) { - if (function_exists('idn_to_utf8')) { - $host = idn_to_utf8($host); - } elseif (function_exists('idn_punycode_decode')) { - $host = idn_punycode_decode($host); - } - $host = Horde_String::convertCharset($host, 'UTF-8'); + function_exists('idn_to_utf8')) { + $host = Horde_String::convertCharset(idn_to_utf8($host), 'UTF-8'); } $address .= self::encode($mailbox, 'address') . '@' . $host; diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index fb9a624bf..f6602b060 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -1005,14 +1005,9 @@ class IMP_Compose } // Convert IDN hosts to ASCII. - if (Horde_Util::extensionExists('idn')) { + if (function_exists('idn_to_ascii')) { $old_error = error_reporting(0); - $host = Horde_String::convertCharset($host, $GLOBALS['registry']->getCharset(), 'UTF-8'); - if (function_exists('idn_to_ascii')) { - $host = idn_to_ascii($host); - } elseif (function_exists('idn_punycode_encode')) { - $host = idn_punycode_encode($host); - } + $host = idn_to_ascii(Horde_String::convertCharset($host, $GLOBALS['registry']->getCharset(), 'UTF-8')); error_reporting($old_error); } elseif (Horde_Mime::is8bit($ob['mailbox'], $GLOBALS['registry']->getCharset())) { throw new IMP_Compose_Exception(sprintf(_("Invalid character in e-mail address: %s."), $email)); diff --git a/kronolith/lib/Event.php b/kronolith/lib/Event.php index 94741ad37..2349d7b33 100644 --- a/kronolith/lib/Event.php +++ b/kronolith/lib/Event.php @@ -2021,14 +2021,9 @@ abstract class Kronolith_Event } if (isset($url['host'])) { // Convert IDN hosts to ASCII. - if (Horde_Util::extensionExists('idn')) { + if (function_exists('idn_to_ascii')) { $old_error = error_reporting(0); - $url['host'] = Horde_String::convertCharset($url['host'], $GLOBALS['registry']->getCharset(), 'UTF-8'); - if (function_exists('idn_to_ascii')) { - $url['host'] = idn_to_ascii($url['host']); - } elseif (function_exists('idn_punycode_encode')) { - $url['host'] = idn_punycode_encode($url['host']); - } + $url['host'] = idn_to_ascii(Horde_String::convertCharset($url['host'], $GLOBALS['registry']->getCharset(), 'UTF-8')); error_reporting($old_error); } elseif (Horde_Mime::is8bit($url['host'])) { //throw new Kronolith_Exception(_("Invalid character in URL."));