pending commit, finished during MQ/S download ...
[platal.git] / htdocs / admin / synchro_ax.php
CommitLineData
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
23require_once("xorg.inc.php");
24new_admin_page('admin/synchro_ax.tpl');
d9a33f98 25$page->assign('xorg_title','Polytechnique.org - Administration - Synchro AX');
0337d704 26
0337d704 27require_once('synchro_ax.inc.php');
28
33ae80b5 29if (is_ax_key_missing()) {
30 $page->assign('no_private_key', true);
31 $page->run();
32}
33
34require_once('user.func.inc.php');
35
0337d704 36if (Env::has('user')) {
37 $login = get_user_forlife(Env::get('user'));
38 if ($login === false) {
39 $page->kill("");
40 }
41}
42
43if (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
52if ($login) {
0337d704 53
dd502514 54 if (Env::has('importe')) {
cab08090 55 ax_synchronize($login, S::v('uid'));
0337d704 56 }
dd502514 57 // get details from user, but looking only info that can be seen by ax
cab08090 58 $user = get_user_details($login, S::v('uid'), 'ax');
dd502514 59 $userax= get_user_ax($user['matricule_ax']);
60 require_once 'profil.func.inc.php';
61 $diff = diff_user_details($userax, $user, 'ax');
0337d704 62
63 $page->assign('x', $user);
dd502514 64 $page->assign('diff', $diff);
0337d704 65}
66$page->run();
67
68// vim:set et sts=4 sws=4 sw=4:
69?>