X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile.php;h=bde1cf20b0f758f72e0e219699779d6d88244dc3;hb=61c98f4b3582ad22edc5b85648c7eed3a4836147;hp=fc6bd7d27998cc94dfe8069cae3a5012801f9d1e;hpb=179afa7fa79902e11498314d37fe4dbf452b3617;p=platal.git diff --git a/modules/profile.php b/modules/profile.php index fc6bd7d..bde1cf2 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -190,27 +190,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 +257,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'])));