From: Florent Bruneau Date: Sun, 17 Aug 2008 21:25:04 +0000 (+0200) Subject: Add Platal::error404() and Platal::error403() to run corresponding handlers. X-Git-Tag: core/1.0.0~34 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=b0a04fb238a94f6ca3cdc874bbc1093915cd0fe2;p=platal.git Add Platal::error404() and Platal::error403() to run corresponding handlers. This functions are for internal use only (mostly for the wiki engine). when developping an handler, you MUST return PL_FORBIDDEN or PL_NOT_FOUND to generate the corresponding error. Signed-off-by: Florent Bruneau --- diff --git a/classes/platal.php b/classes/platal.php index 96cba8c..858ab98 100644 --- a/classes/platal.php +++ b/classes/platal.php @@ -308,6 +308,24 @@ abstract class Platal $page->run(); } + public function error403() + { + $page =& self::page(); + + $this->__mods['core']->handler_403($page); + $page->assign('platal', $this); + $page->run(); + } + + public function error404() + { + $page =& self::page(); + + $this->__mods['core']->handler_404($page); + $page->assign('platal', $this); + $page->run(); + } + public function on_subscribe($forlife, $uid, $promo, $pass) { $args = func_get_args(); diff --git a/classes/plfeed.php b/classes/plfeed.php index cd2d469..78af758 100644 --- a/classes/plfeed.php +++ b/classes/plfeed.php @@ -100,7 +100,7 @@ abstract class PlFeed implements PlIterator $user = Platal::session()->tokenAuth($login, $token); if (empty($user)) { if ($require_auth) { - $page->kill("Authentication required"); + return PL_FORBIDDEN; } else { $user = null; } diff --git a/include/wiki.engine.inc.php b/include/wiki.engine.inc.php index b65abe0..d8cb60a 100644 --- a/include/wiki.engine.inc.php +++ b/include/wiki.engine.inc.php @@ -99,7 +99,8 @@ if ($feed) { $wikiAll = "

La page de wiki $n n'existe pas. " . "Il te suffit de l'éditer

"; } else { - $page->coreTpl('404.tpl'); + global $platal; + $platal->error404(); } }