X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=classes%2FPlatal.php;h=88c6fd1ff7facd18f4bae78dc71990fc07fa9e3c;hb=cab0809050d58f8484608e91f7555ebd69dcb451;hp=858c8ac4900350c5224236da6f153b51db4ee64f;hpb=e77c7ea286d56d039d280104880f3e7433fc02a2;p=platal.git diff --git a/classes/Platal.php b/classes/Platal.php index 858c8ac..88c6fd1 100644 --- a/classes/Platal.php +++ b/classes/Platal.php @@ -19,8 +19,6 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -define('PL_OK', 0); -define('PL_NEEDLOGIN', 1); define('PL_FORBIDDEN', 403); define('PL_NOT_FOUND', 404); @@ -29,6 +27,7 @@ class Platal var $__mods; var $__hooks; + var $ns; var $path; var $argv; @@ -40,9 +39,9 @@ class Platal $this->__mods = array(); $this->__hooks = array(); + array_unshift($modules, 'core'); foreach ($modules as $module) { - $m =& PLModule::factory($this, $module); - $this->__mods[$module] =& $m; + $this->__mods[$module] = $m = PLModule::factory($this, $module); $this->__hooks += $m->handlers(); } } @@ -85,7 +84,8 @@ class Platal $args = $this->argv; $args[0] = &$page; - if ($hook['auth'] > Session::get('auth', AUTH_PUBLIC)) { + if ($hook['auth'] > S::v('auth', AUTH_PUBLIC)) { + // FIXME: don't use 'session' object anymore $_SESSION['session']->doAuth($page); } @@ -99,8 +99,9 @@ class Platal new_skinned_page('index.tpl', AUTH_PUBLIC); if (empty($this->path)) { - $this->__mods['core']->handler_index($page); - } else + $this->path = 'index'; + } + switch ($this->call_hook($page)) { case PL_FORBIDDEN: $this->__mods['core']->handler_403($page);