From 0a08a6d92ef906514cc759f1a6b252d014f1b1ad Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Sat, 7 Feb 2004 18:32:41 +0000 Subject: [PATCH] photos en tpl --- configs/mails.conf | 4 ++ include/valid_photos.inc.php | 72 ++++----------------------------- templates/include/form.valid.photos.tpl | 35 ++++++++++++++++ templates/mails/valid.photos.tpl | 24 +++++++++++ 4 files changed, 71 insertions(+), 64 deletions(-) create mode 100644 templates/include/form.valid.photos.tpl create mode 100644 templates/mails/valid.photos.tpl diff --git a/configs/mails.conf b/configs/mails.conf index 49f8363..01980f3 100644 --- a/configs/mails.conf +++ b/configs/mails.conf @@ -13,3 +13,7 @@ cc=Equipe Polytechnique.org [valid_ml] from=Equipe Polytechnique.org cc=Equipe Polytechnique.org + +[valid_photos] +from=Equipe Polytechnique.org +cc=Equipe Polytechnique.org diff --git a/include/valid_photos.inc.php b/include/valid_photos.inc.php index b930003..e861bd7 100644 --- a/include/valid_photos.inc.php +++ b/include/valid_photos.inc.php @@ -53,42 +53,7 @@ class PhotoReq extends Validate { return parent::get_unique_request($uid,'photo'); } - function echo_formu() { - $url_app = isset($_COOKIE[session_name()]) ? "" : "&".SID; - return <<<________EOF -
- - - - - - - - - - - - - - - -
Demandeur : - {$this->prenom} {$this->nom} - -
-  [ PHOTO ] -  [ PHOTO ] -
- -

- -
-

Raison du refus:

- -
-
-________EOF; - } + function formu() { return 'include/form.valid.photos.tpl'; } function handle_formu () { global $no_update_bd; @@ -98,37 +63,16 @@ ________EOF; || ($_REQUEST['submit']!="Accepter" && $_REQUEST['submit']!="Refuser")) return false; - $message = "Cher(e) camarade,\n\n"; - - if($_REQUEST['submit']=="Accepter") { - $sql = mysql_query("SELECT alias FROM auth_user_md5 WHERE user_id=".$this->uid); - list($old) = mysql_fetch_row($sql); - mysql_free_result($sql); - - $message .= - " La demande de changement de photo que tu as " - ."demandée vient d'être effectuée.\n\n"; + require_once("tpl.mailer.inc.php"); + $mymail = new TplMailer('valid.photos.tpl'); + $mymail->assign('username', $this->username); + if($_REQUEST['submit']=="Accepter") { + $mymail->assign('answer','yes'); $this->commit(); - } else { // c'était donc Refuser - $message .= - "La demande de changement de photo que tu avais faite a été refusée.\n"; - if ($_REQUEST["motif"] != "" ) - $message .= "\nLa raison de ce refus est : \n". - stripslashes($_REQUEST["motif"])."\n\n"; - } + } else + $mymail->assign('answer','no'); - $message .= - "Cordialement,\n". - "L'équipe X.org"; - - $message = wordwrap($message,78); - require_once("diogenes.mailer.inc.php"); - $mymail = new DiogenesMailer('Equipe Polytechnique.org ', - $this->username."@polytechnique.org", - "[Polytechnique.org/PHOTO] Changement de photo de ".$this->username, - false, "validation+trombino@m4x.org"); - $mymail->setBody($message); $mymail->send(); $this->clean(); diff --git a/templates/include/form.valid.photos.tpl b/templates/include/form.valid.photos.tpl new file mode 100644 index 0000000..d95c70a --- /dev/null +++ b/templates/include/form.valid.photos.tpl @@ -0,0 +1,35 @@ +{* $Id: form.valid.photos.tpl,v 1.1 2004-02-07 18:32:41 x2000habouzit Exp $ *} + +
+ + + + + + + + + + + + + + + +
Demandeur :username"|url}')"> + {$valid->prenom} {$valid->nom} + +
+ username"|url}" style="width:110px;" alt=" [ PHOTO ] " /> + username&req=true"|url}" style="width:110px;" alt=" [ PHOTO ] " /> +
+ +

+ +
+

Raison du refus:

+ +
+
+ +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/mails/valid.photos.tpl b/templates/mails/valid.photos.tpl new file mode 100644 index 0000000..9d87b5a --- /dev/null +++ b/templates/mails/valid.photos.tpl @@ -0,0 +1,24 @@ +{* $Id: valid.photos.tpl,v 1.1 2004-02-07 18:32:42 x2000habouzit Exp $ *} +{config_load file="mails.conf" section="valid_photos"} +{subject text="[Polytechnique.org/PHOTO] Changement de photo de $username"} +{from full=#from#} +{to addr="$username@polytechnique.org"} +{cc full=#cc#} +{if $answer eq "yes"} +Cher(e) camarade, + + La demande de changement de photo que tu as demandée vient d'être effectuée. + +Cordialement, +L'équipe X.org +{elseif $answer eq 'no'} +Cher(e) camarade, + + La demande de changement de photo que tu avais faite a été refusée. +La raison de ce refus est : +{$smarty.request.motif} + +Cordialement, +L'équipe X.org +{/if} +{* vim:set nocindent noautoindent textwidth=0: *} -- 2.1.4