X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fplatal.php;h=ac3f9824ead4e48cd856e50b7fdb94254c9e1a7b;hb=6544d0e1de719d31db03a7c7fddfe4c0301d9d6d;hp=e64e4c8d7de6b854b2aa27b3a85b9865a055b229;hpb=8b1f8e12d444062ef63a0db3a8fa94582a9778c3;p=platal.git diff --git a/classes/platal.php b/classes/platal.php index e64e4c8..ac3f982 100644 --- a/classes/platal.php +++ b/classes/platal.php @@ -1,6 +1,6 @@ 24 && $has_end) { return "#final#"; @@ -161,7 +166,10 @@ class Platal return null; } } - return $link; + if ($link != $this->path) { + return $link; + } + return null; } function call_hook(&$page) @@ -174,10 +182,6 @@ class Platal $args = $this->argv; $args[0] = &$page; - if (!empty($hook['perms']) && $hook['perms'] != S::v('perms')) { - return PL_FORBIDDEN; - } - if ($hook['auth'] > S::v('auth', AUTH_PUBLIC)) { if ($hook['type'] == DO_AUTH) { global $globals; @@ -190,7 +194,20 @@ class Platal } } - return call_user_func_array($hook['hook'], $args); + if (!empty($hook['perms']) && $hook['perms'] != S::v('perms')) { + return PL_FORBIDDEN; + } + + $val = call_user_func_array($hook['hook'], $args); + if ($val == PL_DO_AUTH) { + global $globals; + // The handler need a better auth with the current args + if (!call_user_func(array($globals->session, 'doAuth'))) { + $this->force_login($page); + } + $val = call_user_func_array($hook['hook'], $args); + } + return $val; } function force_login(&$page) @@ -201,7 +218,8 @@ class Platal } else { $page->changeTpl('core/password_prompt.tpl'); $page->addJsLink('do_challenge_response.js'); - } + } + $page->assign('platal', $this); $page->run(); } @@ -241,4 +259,5 @@ class Platal } } +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>