From 13627befde705c99059edd34d0f913476736f6a5 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Wed, 21 Mar 2007 18:28:47 +0000 Subject: [PATCH] Migrate Xnet mailer to use PlUpload for attachments git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1596 839d8a87-29fc-0310-9880-83ba4fa771e5 --- modules/email.php | 4 ++-- modules/xnetgrp.php | 6 +++++- modules/xnetgrp/mail.inc.php | 8 +++----- templates/search/quick.tpl | 7 +++++-- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/modules/email.php b/modules/email.php index 17c3692..5f0428b 100644 --- a/modules/email.php +++ b/modules/email.php @@ -332,8 +332,8 @@ class EmailModule extends PLModule $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) && empty($bcc) && empty($cc2)) { $page->trig("Indique au moins un destinataire."); diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 42c70c0..e44b1ba 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -301,7 +301,11 @@ class XnetGrpModule extends PLModule require_once dirname(__FILE__) . '/xnetgrp/mail.inc.php'; $tos = get_all_redirects($mbr, $mls, $mmlist); - send_xnet_mails($from, $sujet, $body, $tos, Post::v('replyto'), $_FILES['uploaded']); + $upload = PlUpload::get($_FILES['uploaded'], S::v('forlife'), 'xnet.emails', true); + send_xnet_mails($from, $sujet, $body, $tos, Post::v('replyto'), $upload, @$_FILES['uploaded']['name']); + if ($upload) { + $upload->rm(); + } $page->kill("Mail envoyé !"); $page->assign('sent', true); } diff --git a/modules/xnetgrp/mail.inc.php b/modules/xnetgrp/mail.inc.php index 6c6e866..b6574c5 100644 --- a/modules/xnetgrp/mail.inc.php +++ b/modules/xnetgrp/mail.inc.php @@ -99,7 +99,7 @@ function _send_xnet_mail($user, $body, $mailer, $replyto = null) // }}} // {{{ send_xnet_mails -function send_xnet_mails($from, $sujet, $body, $tos, $replyto = null, $attach = null) +function send_xnet_mails($from, $sujet, $body, $tos, $replyto = null, $upload = null, $name = null) { global $globals; $sent = array(); @@ -107,10 +107,8 @@ function send_xnet_mails($from, $sujet, $body, $tos, $replyto = null, $attach = $mailer = new PlMailer(); $mailer->setSubject($sujet); $mailer->setFrom($from); - if (is_uploaded_file($attach['tmp_name'])) { - $mailer->addAttachment($attach['tmp_name'], - $attach['type'], - $attach['name']); + if ($upload && $upload->exists()) { + $mailer->addUploadAttachment($upload, $name); } foreach ($tos as $user) { diff --git a/templates/search/quick.tpl b/templates/search/quick.tpl index 7abdf64..28342e8 100644 --- a/templates/search/quick.tpl +++ b/templates/search/quick.tpl @@ -22,12 +22,13 @@ {include file=search/quick.form.tpl show_js=1} +{if $smarty.session.perms->hasFlag('user')}

Voir le trombi d'une promotion


- +
Promotion : @@ -51,6 +52,8 @@
+{/if} +

Comment faire une recherche ?

Nom, Prenom, Promo ...

-- 2.1.4