From c754cf5bebc96728fba6b56e6066199d383741f7 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Wed, 31 Jan 2007 14:00:08 +0000 Subject: [PATCH] Lighter and faster way to check mxs git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1449 839d8a87-29fc-0310-9880-83ba4fa771e5 --- include/emails.inc.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/include/emails.inc.php b/include/emails.inc.php index f954b23..7e80614 100644 --- a/include/emails.inc.php +++ b/include/emails.inc.php @@ -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; } -- 2.1.4