| 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 | |
| 23 | require_once("xorg.inc.php"); |
| 24 | new_admin_page('admin/synchro_ax.tpl'); |
| 25 | $page->assign('xorg_title','Polytechnique.org - Administration - Synchro AX'); |
| 26 | |
| 27 | require_once('synchro_ax.inc.php'); |
| 28 | |
| 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 | |
| 36 | if (Env::has('user')) { |
| 37 | $login = get_user_forlife(Env::get('user')); |
| 38 | if ($login === false) { |
| 39 | $page->kill(""); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | if (Env::has('mat')) { |
| 44 | $res = $globals->xdb->query( |
| 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) { |
| 53 | |
| 54 | if (Env::has('importe')) { |
| 55 | ax_synchronize($login, Session::getInt('uid')); |
| 56 | } |
| 57 | // get details from user, but looking only info that can be seen by ax |
| 58 | $user = get_user_details($login, Session::getInt('uid'), 'ax'); |
| 59 | $userax= get_user_ax($user['matricule_ax']); |
| 60 | require_once 'profil.func.inc.php'; |
| 61 | $diff = diff_user_details($userax, $user, 'ax'); |
| 62 | |
| 63 | $page->assign('x', $user); |
| 64 | $page->assign('diff', $diff); |
| 65 | } |
| 66 | $page->run(); |
| 67 | |
| 68 | // vim:set et sts=4 sws=4 sw=4: |
| 69 | ?> |