Synchronize fiche from AX
[platal.git] / include / profil / update_general.inc.php
1 <?php
2 /***************************************************************************
3 * Copyright (C) 2003-2006 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 if ($appli_id1>0)
23 $globals->xdb->execute("REPLACE INTO applis_ins SET uid= {?}, aid = {?}, type = {?}, ordre = 0", Session::getInt('uid', -1), $appli_id1, $appli_type1);
24 else
25 $globals->xdb->execute("DELETE FROM applis_ins WHERE uid= {?} AND ordre=0", Session::getInt('uid', -1));
26
27 if ($appli_id2>0)
28 $globals->xdb->execute("REPLACE INTO applis_ins SET uid= {?}, aid = {?}, type = {?}, ordre = 1", Session::getInt('uid', -1), $appli_id2, $appli_type2);
29 else
30 $globals->xdb->execute("DELETE FROM applis_ins WHERE uid= {?} AND ordre=1", Session::getInt('uid', -1));
31
32 if ($nationalite != $nationalite_anc || $nom != $nom_anc || $prenom != $prenom_anc) {
33 $sql = "UPDATE auth_user_md5
34 SET nationalite= {?},
35 nom = {?},
36 prenom = {?} WHERE user_id= {?}";
37 $globals->xdb->execute($sql, $nationalite, $nom, $prenom, Session::getInt('uid', -1));
38 }
39 $globals->xdb->execute(
40 "UPDATE auth_user_quick SET
41 profile_nick={?},
42 profile_mobile={?}, profile_mobile_pub={?},
43 profile_web={?}, profile_web_pub={?},
44 profile_freetext={?}, profile_freetext_pub={?},
45 profile_from_ax = {?}
46 WHERE user_id = {?}",
47 $nickname,
48 $mobile, $mobile_pub,
49 $web, $web_pub,
50 $freetext, $freetext_pub,
51 $synchro_ax,
52 Session::getInt('uid', -1));
53
54 if ($nickname != $nickname_anc) {
55 require_once('user.func.inc.php');
56 user_reindex(Session::getInt('uid', -1));
57 }
58 $globals->xdb->execute("UPDATE photo SET pub = {?} WHERE uid = {?}", $photo_pub, Session::getInt('uid', -1));
59 // vim:set et sws=4 sts=4 sw=4:
60 ?>