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('banana/profile.tpl', AUTH_MDP
);
25 if (!(Post
::has('action') && Post
::has('banananame') && Post
::has('bananasig') && Post
::has('bananadisplay')
26 && Post
::has('bananamail') && Post
::has('bananaupdate') && Post
::get('action')=="OK" ))
28 $req = $globals->xdb
->query("
29 SELECT nom,mail,sig,if(FIND_IN_SET('threads',flags),'1','0'),
30 IF(FIND_IN_SET('automaj',flags),'1','0')
32 WHERE uid = {?}", Session
::getInt('uid'));
33 if (!(list($nom,$mail,$sig,$disp,$maj) = $req->fetchOneRow())) {
34 $nom = Session
::get('prenom').' '.Session
::get('nom');
35 $mail = Session
::get('forlife').'@'.$globals->mail
->domain
;
36 $sig = $nom.' ('.Session
::getInt('promo').')';
40 $page->assign('nom' , $nom);
41 $page->assign('mail', $mail);
42 $page->assign('sig' , $sig);
43 $page->assign('disp', $disp);
44 $page->assign('maj' , $maj);
46 $globals->xdb
->execute(
47 'REPLACE INTO forums.profils (uid,sig,mail,nom,flags)
48 VALUES ({?},{?},{?},{?},{?})',
49 Session
::getInt('uid'), Post
::get('bananasig'), Post
::get('bananamail'), Post
::get('banananame'),
50 (Post
::getBool('bananadisplay') ?
'threads,' : '') . (Post
::getBool('bananaupdate') ?
'automaj' : '')