Convert source code to UTF-8
[platal.git] / include / profil / get_general.inc.php
1 <?php
2 /***************************************************************************
3 * Copyright (C) 2003-2007 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 q.profile_from_ax, u.matricule_ax,
26 a1.aid, a1.type, a2.aid, a2.type
27 FROM auth_user_md5 AS u
28 INNER JOIN auth_user_quick AS q USING(user_id)
29 LEFT JOIN applis_ins AS a1 ON(a1.uid = u.user_id and a1.ordre = 0)
30 LEFT JOIN applis_ins AS a2 ON(a2.uid = u.user_id and a2.ordre = 1)
31 WHERE u.user_id = {?}";
32
33 $result = XDB::query($sql, S::v('uid', -1));
34 list($nom, $prenom, $nom_ini, $prenom_ini, $promo, $promo_sortie, $nom_usage, $nationalite,
35 $mobile, $mobile_pub, $web, $web_pub, $freetext, $freetext_pub, $nickname,
36 $synchro_ax, $matricule_ax,
37 $appli_id1,$appli_type1, $appli_id2,$appli_type2) = $result->fetchOneRow();
38
39 $result = XDB::query("SELECT pub FROM photo WHERE uid = {?}", S::v('uid', -1));
40 $photo_pub = $result->fetchOneCell();
41
42 $nom_anc = $nom;
43 $prenom_anc = $prenom;
44 $nationalite_anc = $nationalite;
45 $nickname_anc = $nickname;
46
47 replace_ifset($nom,'nom');
48 replace_ifset($prenom,'prenom');
49 replace_ifset($nationalite,'nationalite');
50 replace_ifset($mobile,'mobile');
51 replace_ifset($web,"web");
52 replace_ifset($freetext,"freetext");
53 replace_ifset($appli_id1,"appli_id1");
54 replace_ifset($appli_id2,"appli_id2");
55 replace_ifset($appli_type1,"appli_type1");
56 replace_ifset($appli_type2,"appli_type2");
57 replace_ifset($nickname,"nickname");
58
59 if(Env::has('modifier') || Env::has('suivant') && $opened_tab == 'general') {
60 $mobile_pub = Env::v('mobile_pub');
61 $web_pub = Env::has('web_pub')?'public':'private';
62 $freetext_pub = Env::has('freetext_pub')?'public':'private';
63 $photo_pub = Env::has('photo_pub')?'public':'private';
64 $synchro_ax = Env::has("synchro_ax")?1:0;
65 }
66
67 require_once("xorg.misc.inc.php");
68 $nom = strtoupper($nom);
69 $nom_comp = replace_accent($nom);
70 $nom_anc_comp = replace_accent($nom_anc);
71
72 $prenom = make_firstname_case($prenom);
73 $prenom_comp = replace_accent($prenom);
74 $prenom_anc_comp = replace_accent($prenom_anc);
75
76 // Y a-t-il une photo en attente de confirmation ?
77 $sql = XDB::query("SELECT COUNT(*) FROM requests WHERE type='photo' AND user_id = {?}", S::v('uid', -1));
78 $nouvellephoto=$sql->fetchOneCell();
79
80 // vim:set et sws=4 sw=4 sts=4 enc=utf-8:
81 ?>