Revert "Don't show warning mx on the front page if the user has another valid"
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 16 Oct 2007 19:30:51 +0000 (21:30 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 16 Oct 2007 19:30:51 +0000 (21:30 +0200)
This reverts commit 8f11b29f7600dfcc825065ce9e89e3c7866de5c6.

include/emails.inc.php
include/xorg.misc.inc.php
templates/events/index.tpl

index a8eef27..2597086 100644 (file)
@@ -372,7 +372,7 @@ class Redirect
 
     public function get_broken_mx()
     {
-        $res = XDB::query("SELECT  host, text, state
+        $res = XDB::query("SELECT  host, text
                              FROM  mx_watch
                             WHERE  state != 'ok'");
         if (!$res->numRows()) {
@@ -388,17 +388,15 @@ class Redirect
                     $lcl_mxs = array($domain);
                 }
                 $broken = false;
-                $state  = false;
                 foreach ($mxs as &$mx) {
                     foreach ($lcl_mxs as $lcl) {
                         if (fnmatch($mx['host'], $lcl)) {
                             $broken = $mx['text'];
-                            $state  = $mx['state'];
                             break;
                         }
                     }
                     if ($broken) {
-                        $mails[] = array('mail' => $mail->email, 'text' => $broken, 'state' => $state);
+                        $mails[] = array('mail' => $mail->email, 'text' => $broken);
                         break;
                     }
                 }
index 2ecaab8..96db292 100644 (file)
@@ -287,20 +287,6 @@ function check_redirect($red = null)
     }
     $_SESSION['no_redirect'] = !$red->other_active('');
     $_SESSION['mx_failures'] = $red->get_broken_mx();
-    $warning = 0;
-    foreach ($red->emails as &$mail) {
-        if ($mail->active) {
-            $warning++;
-        }
-    }
-    foreach ($_SESSION['mx_failures'] as &$fail) {
-        if ($fail['state'] == 'broken') {
-            $warning -= 99999;
-        } else if ($fail['state'] == 'warning') {
-            $warning--;
-        }
-    }
-    $_SESSION['email_is_warning'] = ($warning <= 0 ? true : false);
 }
 
 function send_warning_mail($title)
index 37d844e..72424d3 100644 (file)
@@ -49,7 +49,7 @@ Bienvenue {$smarty.session.prenom}{if $birthday}
 </p>
 {/if}
 
-{if $smarty.session.email_is_warning}
+{if $smarty.session.mx_failures|@count}
 <fieldset>
   <legend>{icon name=error} Des problèmes sont actuellement recontrĂ©s sur tes redirections suivantes</legend>
   {foreach from=$smarty.session.mx_failures item=mail}