From d117be3aa485c244845b71c8330d2dbabee08571 Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Mon, 10 Jan 2005 16:20:37 +0000 Subject: [PATCH] marketing, needs to code private.php now git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-265 --- htdocs/marketing/public.php | 29 ++++++++++++++++++++++------- htdocs/marketing/volontaire.php | 2 +- templates/include/minifiche.tpl | 2 +- templates/marketing/promo.tpl | 6 ++---- templates/marketing/public.tpl | 21 +++++++++++++++------ templates/marketing/volontaire.tpl | 2 +- 6 files changed, 42 insertions(+), 20 deletions(-) diff --git a/htdocs/marketing/public.php b/htdocs/marketing/public.php index 9a66d24..068df30 100644 --- a/htdocs/marketing/public.php +++ b/htdocs/marketing/public.php @@ -19,23 +19,38 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -require_once("xorg.inc.php"); +require_once('xorg.inc.php'); new_skinned_page('marketing/public.tpl', AUTH_MDP); if (! Env::has('num')) { exit; } -$mat = Env::get('num'); +$uid = Env::get('num'); + +$res = $globals->xdb->query("SELECT nom, prenom, promo FROM auth_user_md5 WHERE user_id={?} AND perms='pending'", $uid); -$res = $globals->xdb->query("SELECT nom,prenom,promo FROM auth_user_md5 WHERE matricule={?} AND perms='pending'", $mat); if (list($nom, $prenom, $promo) = $res->fetchOneRow()) { $page->assign('prenom', $prenom); $page->assign('nom', $nom); $page->assign('promo', $promo); -} -if (isset($_REQUEST["valide"])) { - $globals->xdb->execute("INSERT INTO marketing SET expe={?}, dest={?}, email={?}, flags={?}", - Session::getInt('uid'), $mat, Env::get('mail'), (Env::get('origine') == 'perso' ? 'mail_perso', '')); + if (Env::has('valide')) { + require_once('xorg.misc.inc.php'); + + $email = trim(Env::get('mail')); + $res = $globals->xdb->query('SELECT COUNT(*) FROM register_marketing WHERE uid={?} AND email={?}', $uid, $email); + + if (!isvalid_email_redirection($email)) { + $page->trig("Email invalide !"); + } elseif ($res->fetchOneCell()) { + $page->assign('already', true); + } else { + $page->assign('ok', true); + $globals->xdb->execute( + "INSERT INTO register_marketing (uid,sender,email,date,last,nb,type,hash) + VALUES ({?}, {?}, {?}, NOW(), 0, 0, {?}, '')", + $uid, Session::getInt('uid'), $email, Env::get('origine')); + } + } } $page->run(); diff --git a/htdocs/marketing/volontaire.php b/htdocs/marketing/volontaire.php index bcc9c7b..b9797c6 100644 --- a/htdocs/marketing/volontaire.php +++ b/htdocs/marketing/volontaire.php @@ -32,7 +32,7 @@ $page->assign('promos', $res->fetchColumn()); if (Env::has('promo')) { - $sql = "SELECT a.nom, a.prenom, + $sql = "SELECT a.nom, a.prenom, a.user_id, m.email, sa.alias AS forlife FROM register_marketing AS m INNER JOIN auth_user_md5 AS a ON a.user_id = m.uid AND a.promo = {?} diff --git a/templates/include/minifiche.tpl b/templates/include/minifiche.tpl index 20b365d..069c98b 100644 --- a/templates/include/minifiche.tpl +++ b/templates/include/minifiche.tpl @@ -44,7 +44,7 @@ {if $c.dcd}décédé{if $c.sexe}e{/if} le {$c.deces|date_format}{/if} {min_auth level="cookie"} {if !$c.dcd && !$c.wasinscrit} - clique ici si tu connais son adresse email ! + clique ici si tu connais son adresse email ! {/if} {/min_auth} diff --git a/templates/marketing/promo.tpl b/templates/marketing/promo.tpl index cc9c2a0..25b6a43 100644 --- a/templates/marketing/promo.tpl +++ b/templates/marketing/promo.tpl @@ -79,7 +79,6 @@ Nom Dernière adresse connue Statut - AX   {iterate from=$nonins item=it} @@ -96,12 +95,11 @@ {/if} + {* + *}Marketing {* *}AX - - Marketing - {/iterate} diff --git a/templates/marketing/public.tpl b/templates/marketing/public.tpl index 3ac9066..99683d9 100644 --- a/templates/marketing/public.tpl +++ b/templates/marketing/public.tpl @@ -19,9 +19,20 @@ ***************************************************************************} -{if $smarty.request.num} +{if $already} -{if $smarty.request.valide} +

+Merci de nous avoir communiqué cette information ! +

+

+Nous avions déjà connaissance de cette adresse, nous espérons donc comme toi que {$prenom} va s'inscrire au plus vite. +

+

+Si tu le connais personnellement, un petit mail pour lui expliquer les atouts de Polytechnique.org +peut sans aucun doute l'aider à se décider ! +

+ +{elseif $ok}

Merci de nous avoir communiqué cette information ! Un administrateur de Polytechnique.org va @@ -74,8 +85,8 @@ Nous lui écrirons : - en ton nom
- au nom de l'équipe Polytechnique.org + en ton nom
+ au nom de l'équipe Polytechnique.org @@ -89,7 +100,5 @@ {/if} -{/if} - {* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/marketing/volontaire.tpl b/templates/marketing/volontaire.tpl index 09a2be5..d59c169 100644 --- a/templates/marketing/volontaire.tpl +++ b/templates/marketing/volontaire.tpl @@ -44,7 +44,7 @@ Choix de la promo : {iterate from=$addr item=it} - {$it.nom} {$it.prenom} + {$it.nom} {$it.prenom} {$it.email} {$it.forlife} -- 2.1.4