'marketing/private' => $this->make_hook('private', AUTH_MDP, 'admin'),
'marketing/public' => $this->make_hook('public', AUTH_COOKIE),
+ 'marketing/broken' => $this->make_hook('broken', AUTH_COOKIE),
);
}
require_once('marketing.inc.php');
mark_send_mail($uid, $value, Post::v('from'), Post::v('to'),
Post::v('title'), Post::v('message'));
- $page->trig("Mail envoyé");
+ $page->trig("Mail envoyé");
}
if ($action == 'insrel') {
}
}
+ function handler_broken(&$page, $uid = null)
+ {
+ $page->changeTpl('marketing/broken.tpl');
+
+ if (is_null($uid)) {
+ return;
+ }
+
+ $res = Xdb::query("SELECT u.nom, u.prenom, u.promo, a.alias AS forlife
+ FROM auth_user_md5 AS u
+ INNER JOIN aliases AS a ON a.id = u.user_id
+ WHERE u.user_id = {?}", $uid);
+ if (!$res->numRows()) {
+ return;
+ }
+ $user = $res->fetchOneAssoc();
+ $page->assign('user', $user);
+
+ $email = trim(Post::v('mail'));
+ if (Post::has('valide') && strlen($email) > 0) {
+ require_once('diogenes/diogenes.hermes.inc.php');
+ $mailer = new HermesMailer();
+ $mailer->setFrom(S::v('bestalias') . '@polytechnique.org');
+ $mailer->addTo('resetpass@polytechnique.org');
+ $mailer->setSubject("Proposition d'adresse mail pour " . $user['forlife']);
+
+ $message = S::v('nom') . ' ' . S::v('prenom') . ' (X' . S::v('promo') . ') '
+ . 'propose l\'adresse suivante pour un camarade qui n\'a plus de '
+ . 'redirections actives :' . "\n\n"
+ . '* ' . $user['forlife'] . ' => ' . $email . "\n";
+ $mailer->setTxtBody(wordwrap($message, 78));
+ $mailer->send();
+ $page->assign('sent', true);
+ }
+ }
+
function handler_promo(&$page, $promo = null)
{
$page->changeTpl('marketing/promo.tpl');
$sent = Array();
foreach (array_keys($_POST['relance']) as $uid) {
if ($tmp = relance($uid, $nbdix)) {
- $sent[] = $tmp.' a été relancé';
+ $sent[] = $tmp.' a été relancé';
}
}
$page->assign('sent', $sent);