<?php
/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
+ * Copyright (C) 2003-2007 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
'emails/broken' => $this->make_hook('broken', AUTH_COOKIE),
'emails/redirect' => $this->make_hook('redirect', AUTH_MDP),
'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')
);
$page->assign('demande', AliasReq::get_request($uid));
- if ($action == 'suppr' && $value) {
+ if ($action == 'delete' && $value) {
//Suppression d'un alias
XDB::execute(
'DELETE virtual, virtual_redirect
function handler_antispam(&$page, $statut_filtre = null)
{
require_once 'emails.inc.php';
+ require_once('wiki.inc.php');
+ wiki_require_page('Xorg.Antispam');
$page->changeTpl('emails/antispam.tpl');
$page->assign('filtre',$bogo->level());
}
+ function handler_submit(&$page)
+ {
+ $page->changeTpl('emails/submit_spam.tpl');
+
+ if (Post::has('send_email')) {
+ $upload = $_FILES['mail']['tmp_name'];
+ if (!is_uploaded_file($upload)) {
+ $page->trig('Une erreur a été rencontrée lors du transfert du fichier');
+ return;
+ }
+ $mime = mime_content_type($upload);
+ if ($mime != 'text/x-mail' && $mime != 'message/rfc822') {
+ $page->trig('Le fichier ne contient pas un mail complet');
+ return;
+ }
+ global $globals;
+ $box = Post::v('type') . '@' . $globals->mail->domain;
+ $mailer = new PlMailer();
+ $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->send();
+ $page->trig('Le message a été transmis à ' . $box);
+ }
+ }
+
function handler_send(&$page)
{
global $globals;
if (!empty($bcc)) { $mymail->addBcc($bcc); }
if (!empty($to2)) { $mymail->addTo($to2); }
if (!empty($cc2)) { $mymail->addCc($cc2); }
- if (isset($_FILES['uploaded'])) {
+ if (is_uploaded_file($_FILES['uploaded']['tmp_name'])) {
$mymail->addAttachment($_FILES['uploaded']['tmp_name'],
$_FILES['uploaded']['type'],
$_FILES['uploaded']['name']);