<?php
/***************************************************************************
- * Copyright (C) 2003-2008 Polytechnique.org *
+ * Copyright (C) 2003-2009 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
function handlers()
{
return array(
- 'ax' => $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'),
);
}
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)
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')
$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;
}
}
$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;
return $id ? $id : '0';
}
- function createHash($line, $key)
+ function createHash($line, $key, $relation)
{
$hash = implode(time(), $line) . rand();
$hash = md5($hash);