X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Faxletter.php;h=c852ff41299ea3a7d5ac5b8258c4b5d368a5aada;hb=c1390811bf369427ff56838c96fca813c81b714c;hp=8bd7b2d3084b4fc049c05a981f572304dc8f6a5b;hpb=dbbfabe9138005367547465c13e50b98f121bc36;p=platal.git diff --git a/modules/axletter.php b/modules/axletter.php index 8bd7b2d..c852ff4 100644 --- a/modules/axletter.php +++ b/modules/axletter.php @@ -1,6 +1,6 @@ $this->make_hook('index', AUTH_COOKIE), + 'ax' => $this->make_hook('index', AUTH_COOKIE), 'ax/out' => $this->make_hook('out', AUTH_PUBLIC), 'ax/show' => $this->make_hook('show', AUTH_COOKIE), 'ax/edit' => $this->make_hook('submit', AUTH_MDP), 'ax/edit/cancel' => $this->make_hook('cancel', AUTH_MDP), 'ax/edit/valid' => $this->make_hook('valid', AUTH_MDP), - 'admin/axletter' => $this->make_hook('admin', AUTH_MDP, 'admin'), + 'admin/axletter' => $this->make_hook('admin', AUTH_MDP, 'admin'), ); } @@ -240,7 +240,7 @@ class AXLetterModule extends PLModule return; } - $page->kill("L'envoi de l'annonce {$al->title()} est annulé"); + $page->killSuccess("L'envoi de l'annonce {$al->title()} est annulé."); } function handler_valid(&$page, $force = null) @@ -260,7 +260,7 @@ class AXLetterModule extends PLModule return; } - $page->kill("L'envoi de l'annonce aura lieu dans l'heure qui vient."); + $page->killSuccess("L'envoi de l'annonce aura lieu dans l'heure qui vient."); } function handler_show(&$page, $nid = 'last') @@ -268,16 +268,20 @@ class AXLetterModule extends PLModule $this->load('axletter.inc.php'); $page->changeTpl('axletter/show.tpl'); - $nl = new AXLetter($nid); - if (Get::has('text')) { - $nl->toText($page, S::v('prenom'), S::v('nom'), S::v('femme')); - } else { - $nl->toHtml($page, S::v('prenom'), S::v('nom'), S::v('femme')); - } - if (Post::has('send')) { - $nl->sendTo(S::user()->login(), S::user()->bestEmail(), - S::v('prenom'), S::v('nom'), - S::v('femme'), S::v('mail_fmt') != 'texte'); + try { + $nl = new AXLetter($nid); + if (Get::has('text')) { + $nl->toText($page, S::v('prenom'), S::v('nom'), S::v('femme')); + } else { + $nl->toHtml($page, S::v('prenom'), S::v('nom'), S::v('femme')); + } + if (Post::has('send')) { + $nl->sendTo(S::user()->login(), S::user()->bestEmail(), + S::v('prenom'), S::v('nom'), + S::v('femme'), S::v('mail_fmt') != 'texte'); + } + } catch (MailNotFound $e) { + return PL_NOT_FOUND; } } @@ -309,10 +313,9 @@ class AXLetterModule extends PLModule $page->changeTpl('axletter/admin.tpl'); $res = XDB::iterator("SELECT IF(u.nom_usage != '', u.nom_usage, u.nom) AS nom, - u.prenom, u.promo, a.alias AS forlife + u.prenom, u.promo, u.hruid FROM axletter_rights AS ar - INNER JOIN auth_user_md5 AS u USING(user_id) - INNER JOIN aliases AS a ON (u.user_id = a.id AND a.type = 'a_vie')"); + INNER JOIN auth_user_md5 AS u USING(user_id)"); $page->assign('admins', $res); $importer = new CSVImporter('axletter_ins'); @@ -321,7 +324,7 @@ class AXLetterModule extends PLModule $importer->apply($page, "admin/axletter", array('user_id', 'email', 'prenom', 'nom', 'promo', 'flag', 'hash')); } - function idFromMail($line, $key) + function idFromMail($line, $key, $relation = null) { static $field; global $globals; @@ -366,7 +369,7 @@ class AXLetterModule extends PLModule return $id ? $id : '0'; } - function createHash($line, $key) + function createHash($line, $key, $relation) { $hash = implode(time(), $line) . rand(); $hash = md5($hash);