Turns out that this other extension is even broken. Check for function names instead...
authorJan Schneider <jan@horde.org>
Thu, 23 Sep 2010 16:35:14 +0000 (18:35 +0200)
committerJan Schneider <jan@horde.org>
Thu, 23 Sep 2010 16:35:31 +0000 (18:35 +0200)
framework/Mime/lib/Horde/Mime/Address.php
imp/lib/Compose.php
kronolith/lib/Event.php

index 4ac5e7e..02fd9a1 100644 (file)
@@ -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;
index fb9a624..f6602b0 100644 (file)
@@ -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));
index 94741ad..2349d7b 100644 (file)
@@ -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."));