From: Pierre Habouzit (MadCoder Date: Tue, 11 Jan 2005 12:22:13 +0000 (+0000) Subject: 50% done for #256 X-Git-Tag: xorg/old~473 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=3e2ad6fb86e34ff5e1a1e856e2a40492f760d482;p=platal.git 50% done for #256 git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-282 --- diff --git a/htdocs/marketing/public.php b/htdocs/marketing/public.php index 068df30..cb82dc2 100644 --- a/htdocs/marketing/public.php +++ b/htdocs/marketing/public.php @@ -49,6 +49,9 @@ if (list($nom, $prenom, $promo) = $res->fetchOneRow()) { "INSERT INTO register_marketing (uid,sender,email,date,last,nb,type,hash) VALUES ({?}, {?}, {?}, NOW(), 0, 0, {?}, '')", $uid, Session::getInt('uid'), $email, Env::get('origine')); + require_once('validations.inc.php'); + $req = new MarkReq(Session::getInt('uid'), $uid, $email, Env::get('origine')=='user'); + $req->submit(); } } } diff --git a/include/validations/marketing.inc.php b/include/validations/marketing.inc.php new file mode 100644 index 0000000..3c1cfb2 --- /dev/null +++ b/include/validations/marketing.inc.php @@ -0,0 +1,97 @@ +Validate($sender, false, 'marketing'); + $this->m_id = $mark_id; + $this->m_email = $email; + $this->perso = $perso; + + $res = $globals->xdb->query('SELECT nom, prenom, promo FROM auth_user_md5 WHERE user_id = {?}', $mark_id); + list ($this->m_nom, $this->m_prenom, $this->m_promo) = $res->fetchOneRow(); + } + + // }}} + // {{{ function formu() + + function formu() + { return 'include/form.valid.mark.tpl'; } + + // }}} + // {{{ function _mail_subj + + function _mail_subj() + { + return "[Polytechnique.org] Marketing de {$this->m_prenom} {$this->m_nom} ({$this->m_promo})"; + } + + // }}} + // {{{ function _mail_body + + function _mail_body($isok) + { + if ($isok) { + return " Un mail de marketing vient d'être envoyé " + .($this->perso ? 'en ton nom' : 'en notre nom') + ." à {$this->m_prenom} {$this->m_nom} ({$this->m_promo}) pour l'encourrager à s'inscrire !\n\n" + ."Merci de ta participation !\n"; + } else { + return " Nous n'avons pas jugé bon d'envoyer de mail de marketing à {$this->m_prenom} {$this->m_nom} ({$this->m_promo})."; + } + } + + // }}} + // {{{ function commit() + + function commit() + { + global $globals; + $hash = rand_url_id(12); + $globals->xdb->execute('UPDATE register_marketing SET nb=1,hash={?} WHERE uid={?} AND email={?}', $hash, $this->m_id, $this->m_email); + // TODO HERE SEND A MARKETING MAIL + return true; + } + + // }}} +} + +// }}} + +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker: +?> diff --git a/templates/include/form.valid.mark.tpl b/templates/include/form.valid.mark.tpl new file mode 100644 index 0000000..d7c766d --- /dev/null +++ b/templates/include/form.valid.mark.tpl @@ -0,0 +1,35 @@ +{*************************************************************************** + * Copyright (C) 2003-2004 Polytechnique.org * + * http://opensource.polytechnique.org/ * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + ***************************************************************************} + + + + Marketing sur + {$valid->m_prenom} {$valid->m_nom} ({$valid->m_promo}) + + + Mail deviné + {$valid->m_email} + + + Envoi de mail ... + {if $valid->perso}perso{else}par poly.org{/if} + + +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/upgrade/0.9.4/40_requests.sql b/upgrade/0.9.4/40_requests.sql new file mode 100644 index 0000000..2e60686 --- /dev/null +++ b/upgrade/0.9.4/40_requests.sql @@ -0,0 +1,2 @@ +alter table requests change column type type char(16); +