* Register:
- #277: Improve ergonomy. -FRU
+ * Stats:
+ - #603: Add informations on mail delivery -FRU
+
* Xnet:
- #570: Fix geoloc skin. -FRU
- #589: Can attach a file when sending an email -FRU
unset($this->emails[$i]);
}
}
+ check_redirect($this);
return SUCCESS;
}
// security stuff
check_email($email, "Ajout d'une adresse surveillée aux redirections de " . $this->uid);
+ check_redirect($this);
return SUCCESS;
}
}
$this->emails[$i]->rewrite($emails_rewrite[$mail->email], $this->uid);
}
+ check_redirect($this);
}
- function modify_one_email($email, $activate) {
+ function modify_one_email($email, $activate)
+ {
$allinactive = true;
$thisone = false;
foreach ($this->emails as $i=>$mail) {
if ($thisone === false) {
return ERROR_INVALID_EMAIL;
}
- if ($allinactive || $activate)
+ if ($allinactive || $activate) {
$this->emails[$thisone]->activate($this->uid);
- else
+ } else {
$this->emails[$thisone]->deactivate($this->uid);
+ }
+ check_redirect($this);
if ($allinactive && !$activate) {
return ERROR_INACTIVE_REDIRECTION;
} else {
foreach ($this->emails as $i=>$mail) {
if ($mail->email == $email) {
$this->emails[$i]->rewrite($redirect, $this->uid);
- return;
+ check_redirect($this);
+ return;
}
}
}
// }}}
+ // {{{ function get_broken_mx()
+
+ function get_broken_mx()
+ {
+ $res = XDB::iterRow("SELECT host, text
+ FROM mx_watch
+ WHERE state != 'ok'");
+ 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);
+ }
+ $mails = array();
+ foreach ($this->emails as &$mail) {
+ if ($mail->active) {
+ list(,$domain) = explode('@', $mail->email);
+ getmxrr($domain, $lcl_mxs);
+ if (empty($lcl_mxs)) {
+ $lcl_mxs = array($domain);
+ }
+ $broken = false;
+ foreach ($mxs as &$mx) {
+ foreach ($lcl_mxs as $lcl) {
+ if (preg_match($mx['host'], $lcl)) {
+ $broken = $mx['text'];
+ break;
+ }
+ }
+ if ($broken) {
+ $mails[] = array('mail' => $mail->email, 'text' => $broken);
+ }
+ }
+ }
+ }
+ return $mails;
+ }
+
+ // }}}
}
// }}}
return false;
}
+function check_redirect($red = null)
+{
+ require_once 'emails.inc.php';
+ if (is_null($red)) {
+ $red = new Redirect(S::v('uid'));
+ }
+ $_SESSION['no_redirect'] = !$red->other_active('');
+ $_SESSION['mx_failures'] = $red->get_broken_mx();
+
+}
+
function send_warning_mail($title)
{
$mailer = new PlMailer();
}
}
set_skin();
+ check_redirect();
return true;
}
'admin/postfix/delayed' => $this->make_hook('postfix_delayed', AUTH_MDP, 'admin'),
'admin/postfix/regexp_bounces' => $this->make_hook('postfix_regexpsbounces', AUTH_MDP, 'admin'),
'admin/postfix/whitelist' => $this->make_hook('postfix_whitelist', AUTH_MDP, 'admin'),
+ 'admin/mx/broken' => $this->make_hook('mx_broken', AUTH_MDP, 'admin'),
'admin/skins' => $this->make_hook('skins', AUTH_MDP, 'admin'),
'admin/synchro_ax' => $this->make_hook('synchro_ax', AUTH_MDP, 'admin'),
'admin/user' => $this->make_hook('user', AUTH_MDP, 'admin'),
$table_editor->describe('email','email',true);
$table_editor->apply($page, $action, $id);
}
+ function handler_mx_broken(&$page, $action = 'list', $id = null) {
+ $page->assign('xorg_title', 'Polytechnique.org - Administration - MX Défaillants');
+ $page->assign('title', 'MX Défaillant');
+ $table_editor = new PLTableEditor('admin/mx/broken', 'mx_watch', 'host', true);
+ $table_editor->describe('host', 'Masque', true);
+ $table_editor->describe('state', 'Niveau', true);
+ $table_editor->describe('text', 'Description du problème', false);
+ $table_editor->apply($page, $action, $id);
+ }
function handler_logger_actions(&$page, $action = 'list', $id = null) {
$page->assign('xorg_title','Polytechnique.org - Administration - Actions');
$page->assign('title', 'Gestion des actions de logger');
$cp = $res->fetchOneAssoc();
}
- if($cp) {
+ if(@$cp) {
$cp['lg_services'] = serv_to_str($cp['services']);
$page->assign_by_ref('cp',$cp);
} else {
$sql = "SELECT id, debut, resume, services
FROM coupures where debut > '$beginning_date' order by debut desc";
$page->assign('coupures', XDB::iterator($sql));
+ $res = XDB::iterator("SELECT host, text
+ FROM mx_watch
+ WHERE state != 'ok'");
+ $page->assign('mxs', $res);
}
}
}
<strong>Infos dynamiques :</strong>
<a href="admin/downtime">Coupures</a>
|
+ <a href="admin/mx/broken">MX défaillants</a>
+ |
<a href="admin/tips">Astuces</a>
</td>
</tr>
{/if}
</h1>
+{if $smarty.session.host}
<div class="smaller">
Ta connexion précédente date du
<strong>{$smarty.session.lastlogin|date_format:"%x, %X"}</strong>
depuis la machine <strong>{$smarty.session.host}</strong>
</div>
+{/if}
+
+{if $smarty.session.no_redirect}
+<p class="erreur">
+ Tu n'as plus de redirection valide ce qui rend ton adresse Polytechnique.org
+ inutilisable. Rend-toi au plus vite sur <a href="emails/redirect">la page de
+ gestion des emails</a> pour corriger ce problème.
+</p>
+{/if}
+
+{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}
+ <div>
+ <span class="erreur">{$mail.mail}</span>
+ <div class="explication">{$mail.text}</div>
+ </div>
+{/foreach}
+</fieldset>
+{/if}
+
{if $fiche_incitation}
<p>La dernière mise à jour de ta
{* *}
{**************************************************************************}
+<h1>Coupures de Polytechnique.org</h1>
+
{if $cp}
<table class="bicol" summary="Ruptures de service">
<tr>
<th>services affectés</th>
</tr>
{iterate item=cp from=$coupures}
- <tr class="{cycle values="pair,impair"}">
+ <tr class="{cycle values="impair,pair"}">
<td>
<span class="smaller">
{$cp.debut|date_format}
</tr>
{/iterate}
</table>
+
+<h1>Problèmes avec les autres fournisseurs de services</h1>
+
+<p>
+ La liste ci-dessous indique quels sont les fournisseurs de mails vers lesquels nous avons
+ actuellement des problèmes de tranmission.
+</p>
+
+<table class="bicol">
+ <tr><th>Liste des disfonctionnements</th></tr>
+ {iterate from=$mxs item=mx}
+ <tr class="{cycle values="impair,pair"}">
+ <td><strong>{$mx.host}</strong><div class="explication">{$mx.text}</div></td>
+ </tr>
+ {/iterate}
+</table>
+
{/if}
{* vim:set et sw=2 sts=2 sws=2: *}
--- /dev/null
+CREATE TABLE `mx_watch` (
+ `host` VARCHAR(64) NOT NULL,
+ `state` ENUM('ok', 'warning', 'broken') DEFAULT 'ok',
+ `text` MEDIUMTEXT NOT NULL,
+ PRIMARY KEY(`host`)
+);
+
+# vim:set syntax=mysql: