X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile.php;h=c72a9c0ef4ee278646dd457773df1c01c4625413;hb=6dae45b393a59fd04713b9c651ff0970aeec84d7;hp=fc6bd7d27998cc94dfe8069cae3a5012801f9d1e;hpb=5f30b30e8b2657ade5c727e98de286386ee002d8;p=platal.git diff --git a/modules/profile.php b/modules/profile.php index fc6bd7d..c72a9c0 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -105,11 +105,16 @@ class ProfileModule extends PLModule function handler_medal(&$page, $mid) { + $thumb = ($mid == 'thumb'); + $mid = $thumb ? @func_get_arg(2) : $mid; + $res = XDB::query("SELECT img FROM profile_medals WHERE id = {?}", $mid); - $img = dirname(__FILE__).'/../htdocs/images/medals/' . $res->fetchOneCell(); + $img = $thumb ? + dirname(__FILE__).'/../htdocs/images/medals/thumb/' . $res->fetchOneCell() : + dirname(__FILE__).'/../htdocs/images/medals/' . $res->fetchOneCell(); $type = mime_content_type($img); header("Content-Type: $type"); echo file_get_contents($img); @@ -190,27 +195,29 @@ class ProfileModule extends PLModule WHERE matricule={?}", $x); $login = $res->fetchOneCell(); } else { - $login = get_user_forlife($x); + $login = get_user_forlife($x, S::logged() ? '_default_user_callback' + : '_silent_user_callback'); } if (empty($login)) { - if (preg_match('/([-a-z]+)\.([-a-z]+)\.([0-9]{4})/i', $x, $matches)) { - $matches = str_replace('-', '_', $matches); - $res = XDB::query("SELECT user_id - FROM auth_user_md5 - WHERE prenom LIKE {?} AND nom LIKE {?} AND promo = {?} - AND perms = 'pending'", - $matches[1], $matches[2], $matches[3]); - if ($res->numRows() == 1) { - $uid = $res->fetchOneCell(); - pl_redirect('marketing/public/' . $uid); - } + $user = get_not_registered_user($x, true); + if ($user->total() != 1) { + return PL_NOT_FOUND; } - return PL_NOT_FOUND; + $user = $user->next(); + if (S::logged()) { + pl_redirect('marketing/public/' . $user['user_id']); + } + $user['forlife'] = $x; + } else { + $new = Env::v('modif') == 'new'; + $user = get_user_details($login, S::v('uid'), $view); + } + + if (S::logged()) { + $_SESSION['log']->log('view_profile', $login); } - $new = Env::v('modif') == 'new'; - $user = get_user_details($login, S::v('uid'), $view); $title = $user['prenom'] . ' ' . ( empty($user['nom_usage']) ? $user['nom'] : $user['nom_usage'] ); $page->assign('xorg_title', $title); @@ -255,6 +262,7 @@ class ProfileModule extends PLModule $user['forlife'].'@'.$globals->mail->domain, $user['forlife'].'@'.$globals->mail->domain2); $page->assign('virtualalias', $res->fetchOneCell()); + $page->assign('view', $view); $page->addJsLink('close_on_esc.js'); header('Last-Modified: ' . date('r', strtotime($user['date'])));