Add Platal::notAllowed().
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 5 Jan 2009 22:25:07 +0000 (23:25 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 5 Jan 2009 22:25:07 +0000 (23:25 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/platal.php

index 16b1955..7285d27 100644 (file)
@@ -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;