0337d704 |
1 | <?php |
2 | /*************************************************************************** |
dd502514 |
3 | * Copyright (C) 2003-2006 Polytechnique.org * |
0337d704 |
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 | |
23 | require_once("xorg.inc.php"); |
24 | new_admin_page('admin/synchro_ax.tpl'); |
d9a33f98 |
25 | $page->assign('xorg_title','Polytechnique.org - Administration - Synchro AX'); |
0337d704 |
26 | |
0337d704 |
27 | require_once('synchro_ax.inc.php'); |
28 | |
33ae80b5 |
29 | if (is_ax_key_missing()) { |
30 | $page->assign('no_private_key', true); |
31 | $page->run(); |
32 | } |
33 | |
34 | require_once('user.func.inc.php'); |
35 | |
0337d704 |
36 | if (Env::has('user')) { |
37 | $login = get_user_forlife(Env::get('user')); |
38 | if ($login === false) { |
0fcbe8d0 |
39 | exit; |
0337d704 |
40 | } |
41 | } |
42 | |
43 | if (Env::has('mat')) { |
08cce2ff |
44 | $res = XDB::query( |
0337d704 |
45 | "SELECT alias |
46 | FROM aliases AS a |
47 | INNER JOIN auth_user_md5 AS u ON (a.id=u.user_id AND a.type='a_vie') |
48 | WHERE matricule={?}", Env::getInt('mat')); |
49 | $login = $res->fetchOneCell(); |
50 | } |
51 | |
52 | if ($login) { |
dd502514 |
53 | if (Env::has('importe')) { |
cab08090 |
54 | ax_synchronize($login, S::v('uid')); |
0337d704 |
55 | } |
dd502514 |
56 | // get details from user, but looking only info that can be seen by ax |
cab08090 |
57 | $user = get_user_details($login, S::v('uid'), 'ax'); |
dd502514 |
58 | $userax= get_user_ax($user['matricule_ax']); |
59 | require_once 'profil.func.inc.php'; |
60 | $diff = diff_user_details($userax, $user, 'ax'); |
0337d704 |
61 | |
62 | $page->assign('x', $user); |
dd502514 |
63 | $page->assign('diff', $diff); |
0337d704 |
64 | } |
65 | $page->run(); |
66 | |
67 | // vim:set et sts=4 sws=4 sw=4: |
68 | ?> |