Lighter and faster way to check mxs
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 31 Jan 2007 14:00:08 +0000 (14:00 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 31 Jan 2007 14:00:08 +0000 (14:00 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1449 839d8a87-29fc-0310-9880-83ba4fa771e5

include/emails.inc.php

index f954b23..7e80614 100644 (file)
@@ -330,13 +330,7 @@ class Redirect
         if (!$res->total()) {
             return array();
         }
-        $mxs = array();
-        while (list($host, $text) = $res->next()) {
-            $host = preg_quote($host, '/');
-            $host = str_replace('\*', '.*', $host);
-            $host = str_replace('\?', '.', $host);
-            $mxs[] = array('host' => "/^$host\\.?$/", 'text' => $text);
-        }
+        $mxs = $res->fetchAllAssoc();
         $mails = array();
         foreach ($this->emails as &$mail) {
             if ($mail->active) {
@@ -348,7 +342,7 @@ class Redirect
                 $broken = false;
                 foreach ($mxs as &$mx) {
                     foreach ($lcl_mxs as $lcl) {
-                        if (preg_match($mx['host'], $lcl)) {
+                        if (fnmatch($mx['host'], $lcl)) {
                             $broken = $mx['text'];
                             break;
                         }