'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');
}
foreach ($_FILES as &$file) {
- if (!PlUpload::get($file, S::v('forlife'), 'emails.send', false)) {
+ if ($file['name'] && !PlUpload::get($file, S::v('forlife'), 'emails.send', false)) {
$page->trig("Impossible de télécharger '" . pl_entities($file['name']) . "'");
}
}
$to = Env::v('to');
$subj = Env::v('sujet');
$from = Env::v('from');
- $cc = Env::v('cc');
- $bcc = Env::v('bcc');
+ $cc = trim(Env::v('cc'));
+ $bcc = trim(Env::v('bcc'));
- if (empty($to) && empty($cc) && empty($to2)) {
+ if (empty($to) && empty($cc) && empty($to2) && empty($bcc) && empty($cc2)) {
$page->trig("Indique au moins un destinataire.");
$page->assign('uploaded_f', PlUpload::listFilenames(S::v('forlife'), 'emails.send'));
} else {
foreach ($files as $name=>&$upload) {
$mymail->addUploadAttachment($upload, $name);
}
- $mymail->setTxtBody(wordwrap($txt, 78, "\n"));
+ if (Env::v('nowiki')) {
+ $mymail->setTxtBody(wordwrap($txt, 78, "\n"));
+ } else {
+ $mymail->setWikiBody($txt);
+ }
if ($mymail->send()) {
$page->trig("Ton mail a bien été envoyé.");
$_REQUEST = array('bcc' => S::v('bestalias').'@'.$globals->mail->domain);
WHERE c.uid = {?}
ORDER BY u.nom, u.prenom", S::v('uid'));
$page->assign('contacts', $res->fetchAllAssoc());
+ $page->assign('maxsize', ini_get('post_max_size') . 'o');
}
function handler_broken(&$page, $warn = null, $email = null)
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: