X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fplatal.php;h=3591fffc3c2930a0a4994ccbd8fbab77fe8a4cac;hb=fb5a54cbdf4317488bc46c804e0df964c007eb4e;hp=a1699d5ca5624aecbac610c8d26320c75e8708c5;hpb=de14933c384281bfc5571b8b3d7d7ac94b04bc48;p=platal.git diff --git a/modules/platal.php b/modules/platal.php index a1699d5..3591fff 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -1,6 +1,6 @@ baseurl . '/openid/idp_xrds'); + + // Redirect to the suitable page if (S::logged()) { pl_redirect('events'); } else if (!@$GLOBALS['IS_XNET_SITE']) { @@ -87,7 +92,7 @@ class PlatalModule extends PLModule $page->changeTpl('platal/changeLog.tpl'); $clog = pl_entities(file_get_contents(dirname(__FILE__).'/../ChangeLog')); - $clog = preg_replace('/=+\s*/', '
', $clog); + $clog = preg_replace('/===+\s*/', '
', $clog); // url catch only (not all wiki syntax) $clog = preg_replace(array( '/((?:https?|ftp):\/\/(?:\.*,*[\w@~%$£µ&i#\-+=_\/\?;])*)/ui', @@ -137,6 +142,14 @@ class PlatalModule extends PLModule if (Post::has('rss')) { $this->__set_rss_state(Post::b('rss')); } + + # FIXME: this code is not multi-domain compatible. We should decide how + # carva will extend to users not in the main domain. + $res = XDB::query("SELECT alias + FROM aliases + WHERE id = {?} AND FIND_IN_SET('bestalias', flags)", + S::user()->id()); + $page->assign('bestalias', $res->fetchOneCell()); } function handler_webredir(&$page) @@ -169,6 +182,14 @@ class PlatalModule extends PLModule WHERE user_id = {?}', S::v('uid')); $page->assign('carva', $res->fetchOneCell()); + + # FIXME: this code is not multi-domain compatible. We should decide how + # carva will extend to users not in the main domain. + $res = XDB::query("SELECT alias + FROM aliases + WHERE id = {?} AND FIND_IN_SET('bestalias', flags)", + S::user()->id()); + $page->assign('bestalias', $res->fetchOneCell()); } function handler_prefs_rss(&$page) @@ -208,12 +229,8 @@ class PlatalModule extends PLModule } } - $log =& S::v('log'); - S::logger()->log('passwd', ''); - - if (Cookie::v('ORGaccess')) { - setcookie('ORGaccess', hash_encrypt($password), (time()+25920000), '/', '' ,0); - } + S::logger()->log('passwd'); + Platal::session()->setAccessCookie(true); $page->changeTpl('platal/motdepasse.success.tpl'); $page->run(); @@ -335,8 +352,7 @@ Adresse de secours : " . Post::v('email') : "")); $mymail->send(); // on cree un objet logger et on log l'evenement - $logger = $_SESSION['log'] = new PlLogger($uid); - S::logger()->log('recovery', $mails); + S::logger(uid)->log('recovery', $mails); } else { $page->trigError('Les informations que tu as rentrées ne permettent pas de récupérer ton mot de passe.
'. 'Si tu as un homonyme, utilise prenom.nom.promo comme login'); @@ -374,8 +390,7 @@ Adresse de secours : " . Post::v('email') : "")); } } - $logger = new PlLogger($uid); - S::logger()->log("passwd",""); + S::logger($uid)->log("passwd", ""); $page->changeTpl('platal/tmpPWD.success.tpl'); } else { $page->changeTpl('platal/motdepasse.tpl'); @@ -420,24 +435,17 @@ Adresse de secours : " . Post::v('email') : "")); } if ($level == 'forget' || $level == 'forgetall') { - setcookie('ORGaccess', '', time() - 3600, '/', '', 0); - Cookie::kill('ORGaccess'); - if (isset($_SESSION['log'])) - S::logger()->log("cookie_off"); + Platal::session()->killAccessCookie(); } if ($level == 'forgetuid' || $level == 'forgetall') { - setcookie('ORGuid', '', time() - 3600, '/', '', 0); - Cookie::kill('ORGuid'); - setcookie('ORGdomain', '', time() - 3600, '/', '', 0); - Cookie::kill('ORGdomain'); + Platal::session()->killLoginFormCookies(); } - if (isset($_SESSION['log'])) { - $ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; - S::logger()->log('deconnexion',$ref); + if (S::logged()) { + S::logger()->log('deconnexion', @$_SERVER['HTTP_REFERER']); + Platal::session()->destroy(); } - Platal::session()->destroy(); if (Get::has('redirect')) { http_redirect(rawurldecode(Get::v('redirect'))); @@ -448,6 +456,10 @@ Adresse de secours : " . Post::v('email') : "")); function handler_review(&$page, $action = null, $mode = null) { + // Include X-XRDS-Location response-header for Yadis discovery + global $globals; + header('X-XRDS-Location: ' . $globals->baseurl . '/openid/idp_xrds'); + $this->load('review.inc.php'); $dom = 'Review'; if (@$GLOBALS['IS_XNET_SITE']) {