Add an API to handle caching.
[platal.git] / classes / platal.php
index b911828..4560f6e 100644 (file)
@@ -72,7 +72,7 @@ abstract class PlHook
             }
         }
         if (!$this->checkPerms()) {
-            if (!Platal::notAllowed()) {
+            if (Platal::notAllowed()) {
                 return PL_FORBIDDEN;
             }
         }
@@ -219,7 +219,6 @@ class PlHookTree
     }
 }
 
-
 abstract class Platal
 {
     private $mods;
@@ -267,7 +266,7 @@ abstract class Platal
             $this->mods[$module] = $m = PLModule::factory($module);
             $hooks = $m->handlers();
             foreach ($hooks as $path=>$hook) {
-                $this->hooks->addChild(split('/', $path), $hook);
+                $this->hooks->addChild(explode('/', $path), $hook);
             }
         }
 
@@ -302,7 +301,7 @@ abstract class Platal
 
     protected function find_hook()
     {
-        $p = split('/', $this->path);
+        $p = explode('/', $this->path);
         list($hook, $matched, $remain, $aliased) = $this->hooks->findChild($p);
         if (empty($hook)) {
             return null;
@@ -318,7 +317,7 @@ abstract class Platal
 
     public function near_hook()
     {
-        $p = split('/', $this->path);
+        $p = explode('/', $this->path);
         list($hook, $matched, $remain, $aliased) = $this->hooks->findNearestChild($p);
         if (empty($hook)) {
             return null;
@@ -376,13 +375,7 @@ abstract class Platal
             }
         } catch (Exception $e) {
             header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error');
-
-            $file = fopen(self::globals()->spoolroot . '/spool/tmp/site_errors', 'a');
-            fwrite($file, '<pre>' . date('Y-m-d G:i:s') . '</pre>'
-                        . '<pre>' . pl_entities("" . $e) . '</pre>'
-                        . '------------------------------------------------------------------' . "\n");
-            fclose($file);
-
+            PlErrorReport::report($e);
             if (self::globals()->debug) {
                 $page->kill(pl_entities($e->getMessage())
                             . '<pre>' . pl_entities("" . $e) . '</pre>');