X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile.php;h=c72a9c0ef4ee278646dd457773df1c01c4625413;hb=6dae45b393a59fd04713b9c651ff0970aeec84d7;hp=a8d2c572e12d5ea4835ea95008c4402114e73418;hpb=5350d75199c4f10940ce8954c1bb302f8a49ead9;p=platal.git diff --git a/modules/profile.php b/modules/profile.php index a8d2c57..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); @@ -195,29 +200,24 @@ class ProfileModule extends PLModule } if (empty($login)) { - if (!S::logged()) { - $page->kill("Ce camarade n'a pas de fiche publique."); - return; - } else 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); @@ -262,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'])));