2453df2452c601caa60ca6abc8c96286a6ec3f9e
2 /***************************************************************************
3 * Copyright (C) 2003-2006 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
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. *
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. *
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 *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
23 require_once("xorg.inc.php");
25 // manage the public fiche or ax fiche
27 if (!logged() || Env
::get('view') == 'public') $view = 'public';
28 if (logged() && Env
::get('view') == 'ax') $view = 'ax';
30 new_simple_page('fiche.tpl', ($view == 'public')?AUTH_PUBLIC
:AUTH_COOKIE
);
31 require_once('user.func.inc.php');
33 if (!Env
::has('user') && !Env
::has('mat')) {
34 $page->kill("cette page n'existe pas");
37 if (Env
::has('user')) {
38 $login = get_user_forlife(Env
::get('user'));
39 if ($login === false
) {
44 if (Env
::has('mat')) {
45 $res = $globals->xdb
->query(
48 INNER JOIN auth_user_md5 AS u ON (a.id=u.user_id AND a.type='a_vie')
49 WHERE matricule={?}", Env
::getInt('mat'));
50 $login = $res->fetchOneCell();
52 $page->kill("cette page n'existe pas");
56 $new = Env
::get('modif') == 'new';
57 $user = get_user_details($login, Session
::getInt('uid'), $view);
58 $title = $user['prenom'] . ' ' . empty($user['nom_usage']) ?
$user['nom'] : $user['nom_usage'];
59 $page->assign('xorg_title', $title);
63 $photo = 'photo/'.$user['forlife'].($new ?
'/req' : '');
65 if(!isset($user['y']) and !isset($user['x'])) {
66 list($user['x'], $user['y']) = getimagesize("images/none.png");
68 if(!isset($user['y']) or $user['y'] < 1) $user['y']=1;
69 if(!isset($user['x']) or $user['x'] < 1) $user['x']=1;
71 $user['y'] = (integer)($user['y']*240/$user['x']);
75 $user['x'] = (integer)($user['x']*300/$user['y']);
79 $user['y'] = (integer)($user['y']*160/$user['x']);
83 $page->assign('logged', has_user_right('private', $view));
84 if (!has_user_right($user['photo_pub'], $view)) {
88 $page->assign_by_ref('x', $user);
89 $page->assign('photo_url', $photo);
91 $res = $globals->xdb
->query(
94 INNER JOIN virtual_redirect USING(vid)
95 INNER JOIN auth_user_quick ON ( user_id = {?} AND emails_alias_pub = 'public' )
96 WHERE ( redirect={?} OR redirect={?} )
97 AND alias LIKE '%@{$globals->mail->alias_dom}'",
98 Session
::getInt('uid'), $user['forlife'].'@'.$globals->mail
->domain
, $user['forlife'].'@'.$globals->mail
->domain2
);
99 $page->assign('virtualalias', $res->fetchOneCell());
101 $page->addJsLink('javascript/close_on_esc.js');
104 // vim:set et sws=4 sw=4 sts=4: