first reimport from platal
[platal.git] / include / profil / get_general.inc.php
1 <?php
2 /***************************************************************************
3 * Copyright (C) 2003-2004 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
5 * *
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. *
10 * *
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. *
15 * *
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 *
18 * Foundation, Inc., *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
21
22 // on ramène les données du profil connecté (uid paramètre de session)
23 $sql = "SELECT u.nom, u.prenom, u.nom_ini, u.prenom_ini, u.promo, u.promo_sortie, u.nom_usage, u.nationalite,
24 q.profile_mobile, q.profile_mobile_pub, q.profile_web, q.profile_web_pub, q.profile_freetext, q.profile_freetext_pub, q.profile_nick,
25 a1.aid, a1.type, a2.aid, a2.type
26 FROM auth_user_md5 AS u
27 INNER JOIN auth_user_quick AS q USING(user_id)
28 LEFT JOIN applis_ins AS a1 ON(a1.uid = u.user_id and a1.ordre = 0)
29 LEFT JOIN applis_ins AS a2 ON(a2.uid = u.user_id and a2.ordre = 1)
30 WHERE u.user_id = {?}";
31
32 $result = $globals->xdb->query($sql, Session::getInt('uid', -1));
33 list($nom, $prenom, $nom_ini, $prenom_ini, $promo, $promo_sortie, $nom_usage, $nationalite,
34 $mobile, $mobile_pub, $web, $web_pub, $freetext, $freetext_pub, $nickname,
35 $appli_id1,$appli_type1, $appli_id2,$appli_type2) = $result->fetchOneRow();
36
37 $result = $globals->xdb->query("SELECT pub FROM photo WHERE uid = {?}", Session::getInt('uid', -1));
38 $photo_pub = $result->fetchOneCell();
39
40 $nom_anc = $nom;
41 $prenom_anc = $prenom;
42 $nationalite_anc = $nationalite;
43 $nickname_anc = $nickname;
44
45 replace_ifset($nom,'nom');
46 replace_ifset($prenom,'prenom');
47 replace_ifset($nationalite,'nationalite');
48 replace_ifset($mobile,'mobile');
49 replace_ifset($web,"web");
50 replace_ifset($freetext,"freetext");
51 replace_ifset($appli_id1,"appli_id1");
52 replace_ifset($appli_id2,"appli_id2");
53 replace_ifset($appli_type1,"appli_type1");
54 replace_ifset($appli_type2,"appli_type2");
55 replace_ifset($nickname,"nickname");
56
57 if(Env::has('modifier') || Env::has('suivant')) {
58 $mobile_pub = Env::get('mobile_pub');
59 $web_pub = Env::has('web_pub')?'public':'private';
60 $freetext_pub = Env::has('freetext_pub')?'public':'private';
61 $photo_pub = Env::has('photo_pub')?'public':'private';
62 }
63
64 require_once("xorg.misc.inc.php");
65 $nom = strtoupper($nom);
66 $nom_comp = replace_accent($nom);
67 $nom_anc_comp = replace_accent($nom_anc);
68
69 $prenom = make_firstname_case($prenom);
70 $prenom_comp = replace_accent($prenom);
71 $prenom_anc_comp = replace_accent($prenom_anc);
72
73 // Y a-t-il une photo en attente de confirmation ?
74 $sql = $globals->xdb->query("SELECT COUNT(*) FROM requests WHERE type='photo' AND user_id = {?}", Session::getInt('uid', -1));
75 $nouvellephoto=$sql->fetchOneCell();
76
77 // vim:set et sws=4 sw=4 sts=4:
78 ?>