X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fplatal.php;h=6d3237440e6ed37af0fd711991e772fb9d7f5de1;hb=a95dcb6e223baf24a6dcb8de87216ecb758ac7fc;hp=a8b5459667c5d06ac0b3ac3c0d5c9de95ac6d784;hpb=5640f0939025e7741d40ec18577a9aae8c2f80a5;p=platal.git diff --git a/classes/platal.php b/classes/platal.php index a8b5459..6d32374 100644 --- a/classes/platal.php +++ b/classes/platal.php @@ -1,6 +1,6 @@ startAvailableAuth()) { - Platal::page()->trigError('Données d\'authentification invalide.'); + Platal::page()->trigError("Données d'authentification invalides."); } $modules = func_get_args(); @@ -62,7 +62,7 @@ abstract class Platal foreach ($modules as $module) { $module = strtolower($module); $this->__mods[$module] = $m = PLModule::factory($module); - $this->__hooks += $m->handlers(); + $this->__hooks = $m->handlers() + $this->__hooks; } if ($globals->mode == '') { @@ -267,7 +267,9 @@ abstract class Platal } } if ($hook['auth'] != AUTH_PUBLIC && !$this->check_perms($hook['perms'])) { - return PL_FORBIDDEN; + if (self::notAllowed()) { + return PL_FORBIDDEN; + } } $val = call_user_func_array($hook['hook'], $args); @@ -326,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; @@ -344,6 +356,20 @@ abstract class Platal } } + public static function assert($cond, $error, $userfriendly) + { + global $globals; + if ($cond === false) { + header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error'); + $file = fopen($globals->spoolroot . '/spool/tmp/assert_erros', 'a'); + fwrite($file, '
' . pl_entities($error) . '
\n'); + fclose($file); + + Platal::page()->kill($userfriendly); + } + } + + static public function &page() { global $platal;