2 /***************************************************************************
3 * Copyright (C) 2003-2004 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
22 require_once('xorg.inc.php');
23 new_admin_page('marketing/private.tpl');
25 $uid = Env
::get('uid');
26 $res = $globals->xdb
->query("SELECT nom, prenom, promo, matricule FROM auth_user_md5 WHERE user_id={?} AND perms='pending'", $uid);
28 if (list($nom, $prenom, $promo, $matricule) = $res->fetchOneRow()) {
29 require_once('register.inc.php');
30 $matricule_X = get_X_mat($matricule);
31 $page->gassign('nom');
32 $page->gassign('prenom');
33 $page->gassign('promo');
34 $page->gassign('matricule');
35 $page->assign('matricule_X',$matricule_X);
37 $page->kill('uid invalide');
40 if (Env
::has('del')) {
41 $globals->xdb
->execute('DELETE FROM register_marketing WHERE uid={?} AND email={?}', $uid, Env
::get('del'));
44 if (Env
::has('rel') && !Env
::has('valider')) {
45 require_once('marketing.inc.php');
46 list($to, $title, $text) = mark_text_mail($uid, Env
::get('rel'));
47 $from = mark_from_mail($uid, Env
::get('rel'));
48 $page->assign('rel_from_user', $from);
49 $page->assign('rel_from_staff', "\"Equipe Polytechnique.org\" <register@polytechnique.org>");
50 $page->assign('rel_to', $to);
51 $page->assign('rel_title', $title);
52 $page->assign('rel_text', $text);
55 if (Env
::get('valider') == 'Envoyer') {
56 require_once('marketing.inc.php');
57 mark_send_mail($uid, Env
::get('rel'), Env
::get('from'), Env
::get('to'), Env
::get('title'), Env
::get('message'));
58 $page->trig("Mail envoyé");
61 if (Env
::has('relance')) {
62 require_once('marketing.inc.php');
64 $page->trig('relance faite');
68 if (Env
::get('action') == 'ajouter') {
69 $globals->xdb
->execute(
70 "INSERT INTO register_marketing
71 SET uid = {?}, sender = {?}, email = {?},
72 date = NOW(), type = {?}",
73 $uid, Session
::get('uid'), Env
::get('email'), Env
::get('type'));
76 $res = $globals->xdb
->iterator(
78 FROM register_marketing AS r
79 INNER JOIN aliases AS a ON (r.sender=a.id AND a.type = 'a_vie')
81 ORDER BY date", $uid);
82 $page->assign('addr', $res);
84 $res = $globals->xdb
->query("SELECT date, relance FROM register_pending WHERE uid = {?}", $uid);
85 if (list($pending, $relance) = $res->fetchOneCell()) {
86 $page->gassign('pending');
87 $page->gassign('relance');
93 // vim:set et sw=4 sws=4 sts=4: