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_skinned_page('carnet/notifs.tpl', AUTH_COOKIE
);
24 require_once('notifs.inc.php');
26 $watch = new Watch(Session
::getInt('uid'));
28 $res = $globals->xdb
->query("SELECT promo_sortie FROM auth_user_md5 WHERE user_id = {?}", Session
::getInt('uid', -1));
29 $promo_sortie = $res->fetchOneCell();
30 $page->assign('promo_sortie', $promo_sortie);
32 if(Env
::has('promo')) {
33 if(preg_match('!^ *(\d{4}) *$!', Env
::get('promo'), $matches)) {
34 $p = intval($matches[1]);
35 if($p<1900 ||
$p>2100) {
36 $page->trig("la promo entrée est invalide");
38 if (Env
::has('add_promo')) $watch->_promos
->add($p);
39 if (Env
::has('del_promo')) $watch->_promos
->del($p);
41 } elseif (preg_match('!^ *(\d{4}) *- *(\d{4}) *$!', Env
::get('promo'), $matches)) {
42 $p1 = intval($matches[1]);
43 $p2 = intval($matches[2]);
44 if($p1<1900 ||
$p1>2100) {
45 $page->trig('la première promo de la plage entrée est invalide');
46 } elseif($p2<1900 ||
$p2>2100) {
47 $page->trig('la seconde promo de la plage entrée est invalide');
49 if (Env
::has('add_promo')) $watch->_promos
->addRange($p1,$p2);
50 if (Env
::has('del_promo')) $watch->_promos
->delRange($p1,$p2);
53 $page->trig("La promo (ou la plage de promo) entrée est dans un format incorrect.");
57 if (Env
::has('del_nonins')) $watch->_nonins
->del(Env
::get('del_nonins'));
58 if (Env
::has('add_nonins')) $watch->_nonins
->add(Env
::get('add_nonins'));
59 if (Env
::has('subs')) $watch->_subs
->update('sub');
60 if (Env
::has('flags_contacts')) {
61 $watch->watch_contacts
= Env
::getBool('contacts');
64 if (Env
::has('flags_mail')) {
65 $watch->watch_mail
= Env
::getBool('mail');
69 $page->assign_by_ref('watch', $watch);
72 // vim:set et sws=4 sw=4 sts=4: