);
}
- function handler_out(&$page, $hash)
+ function handler_out(&$page, $hash = null)
{
if (!$hash) {
if (!S::logged()) {
$perm = AXLetter::hasPerms();
if ($perm) {
+ $res = XDB::query("SELECT * FROM axletter_ins");
+ $page->assign('count', $res->numRows());
$page->assign('new', AXLetter::awaiting());
}
$page->assign('axs', AXLetter::subscriptionState());
SET id = {?}, shortname = {?}, subject = {?}, title = {?}, body = {?},
signature = {?}, promo_min = {?}, promo_max = {?}, echeance = {?}",
$id, $shortname, $subject, $title, $body, $signature, $promo_min, $promo_max, $echeance);
+ if (!$saved) {
+ $mailer = new PlMailer();
+ $mailer->setFrom("support@" . $globals->mail->domain);
+ $mailer->setSubject("Un nouveau projet de mail de l'AX vient d'être proposé");
+ $mailer->setTxtBody("Un nouveau mail vient d'être rédigé en prévision d'un envoi prochain. Vous pouvez "
+ . "le modifier jusqu'à ce qu'il soit verrouillé pour l'envoi\n\n"
+ . "Le sujet du mail : $subject\n"
+ . "L'échéance d'envoi est fixée à $echeance.\n"
+ . "Le mail pourra néanmoins partir avant cette échéance si un administrateur de "
+ . "Polytechnique.org le valide.\n\n"
+ . "Pour modifier, valider ou annuler le mail :\n"
+ . "https://www.polytechnique.org/ax/edit\n"
+ . "-- \n"
+ . "Association Polytechnique.org\n");
+ $res = XDB::iterRow("SELECT IF(u.nom_usage != '', u.nom_usage, u.nom) AS nom,
+ u.prenom, a.alias AS bestalias
+ 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 FIND_IN_SET('bestalias', a.flags))");
+ global $globals;
+ while (list($nom, $prenom, $alias) = $res->next()) {
+ $mailer->addTo("$nom $prenom <$alias@{$globals->mail->domain}>");
+ }
+ $mailer->send();
+ }
$saved = true;
$echeance_date = null;
$echeance_time = null;
if (!$saved) {
$select = '';
- $time = time() + 3600 * 24 * 2;
- for ($i = 0 ; $i < 15 ; $i++) {
- $time += 3600 * 24;
- $p_stamp = date('Ymd', $time);
- $year = date('Y', $time);
- $month = date('m', $time);
- $day = date('d', $time);
-
- if ($p_stamp == $echeance_date) {
- $sel = ' selected="selected"';
- } else {
- $sel = '';
- }
- $select .= "<option value=\"$p_stamp\"$sel> $day / $month / $year</option>\n";
- }
- $page->assign('echeance_date', $select);
- $select = '';
for ($i = 0 ; $i < 24 ; $i++) {
$stamp = sprintf('%02d:00:00', $i);
if ($stamp == $echeance_time) {
$importer = new CSVImporter('axletter_ins');
$importer->registerFunction('user_id', 'email vers Id X.org', array($this, 'idFromMail'));
$importer->forceValue('hash', array($this, 'createHash'));
- $importer->apply($page, "admin/axletter", array('user_id', 'email', 'prenom', 'nom', 'promo', 'hash'));
+ $importer->apply($page, "admin/axletter", array('user_id', 'email', 'prenom', 'nom', 'promo', 'flag', 'hash'));
}
function idFromMail($line, $key)