'emails/send' => $this->make_hook('send', AUTH_MDP),
'emails/antispam/submit' => $this->make_hook('submit', AUTH_COOKIE),
- 'admin/emails/duplicated' => $this->make_hook('duplicated', AUTH_MDP, 'admin')
+ 'admin/emails/duplicated' => $this->make_hook('duplicated', AUTH_MDP, 'admin'),
+ 'admin/emails/watch' => $this->make_hook('duplicated', AUTH_MDP, 'admin'),
+ 'admin/emails/lost' => $this->make_hook('lost', AUTH_MDP, 'admin'),
);
}
$redirect = new Redirect(S::v('uid'));
+ // FS#703 : $_GET is urldecoded twice, hence
+ // + (the data) => %2B (in the url) => + (first decoding) => ' ' (second decoding)
+ // Since there can be no spaces in emails, we can fix this with :
+ $email = str_replace(' ', '+', $email);
+
if ($action == 'remove' && $email) {
$retour = $redirect->delete_email($email);
$page->assign('retour', $retour);
$page->changeTpl('emails/submit_spam.tpl');
if (Post::has('send_email')) {
- $upload = $_FILES['mail']['tmp_name'];
- if (!is_uploaded_file($upload)) {
+ $upload = PlUpload::get($_FILES['mail'], S::v('forlife'), 'spam.submit', true);
+ if (!$upload) {
$page->trig('Une erreur a été rencontrée lors du transfert du fichier');
return;
}
- $mime = trim(mime_content_type($upload));
+ $mime = $upload->contentType();
if ($mime != 'text/x-mail' && $mime != 'message/rfc822') {
+ $upload->clear();
$page->trig('Le fichier ne contient pas un mail complet');
return;
}
$mailer->addTo($box);
$mailer->setFrom('"' . S::v('prenom') . ' ' . S::v('nom') . '" <web@' . $globals->mail->domain . '>');
$mailer->setTxtBody(Post::v('type') . ' soumis par ' . S::v('forlife') . ' via le web');
- $mailer->addAttachment($upload, 'message/rfc822', $_FILES['mail']['name']);
+ $mailer->addUploadAttachment($upload, Post::v('type') . '.mail');
$mailer->send();
$page->trig('Le message a été transmis à ' . $box);
+ $upload->clear();
}
}
function handler_send(&$page)
{
global $globals;
-
$page->changeTpl('emails/send.tpl');
$page->addJsLink('ajax.js');
A bientôt sur Polytechnique.org !
-L'équipe d'administration <support@polytechnique.org>";
+L'équipe d'administration <support@" . $globals->mail->domain . '>';
$mail = new PlMailer();
- $mail->setFrom('"Polytechnique.org" <support@polytechnique.org>');
- $mail->addTo("$dest@polytechnique.org");
+ $mail->setFrom('"Polytechnique.org" <support@' . $globals->mail->domain . '>');
+ $mail->addTo("$dest@" . $globals->mail->domain);
$mail->setSubject("Une de tes adresse de redirection Polytechnique.org ne marche plus !!");
$mail->setTxtBody($message);
$mail->send();
$page->assign('doublon', $props);
}
}
+ function handler_lost(&$page, $action = 'list', $email = null)
+ {
+ $page->changeTpl('emails/lost.tpl');
+
+ $page->assign('lost_emails', XDB::iterator('
+ SELECT u.user_id, a.alias
+ FROM auth_user_md5 AS u
+ INNER JOIN aliases AS a ON (a.id = u.user_id AND a.type = "a_vie")
+ LEFT JOIN emails AS e ON (u.user_id=e.uid AND FIND_IN_SET("active",e.flags))
+ WHERE e.uid IS NULL AND u.deces = 0
+ ORDER BY u.promo DESC, u.nom, u.prenom'));
+ }
}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: