From: x2003bruneau Date: Wed, 31 Jan 2007 14:00:08 +0000 (+0000) Subject: Lighter and faster way to check mxs X-Git-Tag: xorg/0.9.14~313 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=c754cf5bebc96728fba6b56e6066199d383741f7;p=platal.git Lighter and faster way to check mxs git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1449 839d8a87-29fc-0310-9880-83ba4fa771e5 --- 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; }