From: Florent Bruneau Date: Mon, 5 Jan 2009 22:25:07 +0000 (+0100) Subject: Add Platal::notAllowed(). X-Git-Tag: core/1.0.1~34 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=179658ec4de09ec088235d91977013f64eed49db;p=platal.git Add Platal::notAllowed(). Signed-off-by: Florent Bruneau --- diff --git a/classes/platal.php b/classes/platal.php index 16b1955..7285d27 100644 --- a/classes/platal.php +++ b/classes/platal.php @@ -267,9 +267,7 @@ abstract class Platal } } if ($hook['auth'] != AUTH_PUBLIC && !$this->check_perms($hook['perms'])) { - if (S::admin()) { - $page->trigWarning('Tu accèdes à cette page car tu es administrateur du site.'); - } else { + if (self::notAllowed()) { return PL_FORBIDDEN; } } @@ -330,6 +328,16 @@ abstract class Platal $page->run(); } + public static function notAllowed() + { + if (S::admin()) { + self::page()->trigWarning('Tu accèdes à cette page car tu es administrateur du site.'); + return false; + } else { + return true; + } + } + public static function load($modname, $include = null) { global $platal;