<?php
/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
+ * Copyright (C) 2003-2007 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
+define('PL_DO_AUTH', 300);
define('PL_FORBIDDEN', 403);
define('PL_NOT_FOUND', 404);
return $key;
}
+ if (($pos = strpos($key, '.php')) !== false) {
+ $key = substr($key, 0, $pos);
+ }
+
$has_end = in_array("#final#", $keys);
if (strlen($key) > 24 && $has_end) {
return "#final#";
return null;
}
}
- return $link;
+ if ($link != $this->path) {
+ return $link;
+ }
+ return null;
}
function call_hook(&$page)
$args = $this->argv;
$args[0] = &$page;
- if (!empty($hook['perms']) && $hook['perms'] != S::v('perms')) {
- return PL_FORBIDDEN;
- }
-
if ($hook['auth'] > S::v('auth', AUTH_PUBLIC)) {
if ($hook['type'] == DO_AUTH) {
global $globals;
}
}
- return call_user_func_array($hook['hook'], $args);
+ if (!empty($hook['perms']) && $hook['perms'] != S::v('perms')) {
+ return PL_FORBIDDEN;
+ }
+
+ $val = call_user_func_array($hook['hook'], $args);
+ if ($val == PL_DO_AUTH) {
+ global $globals;
+ // The handler need a better auth with the current args
+ if (!call_user_func(array($globals->session, 'doAuth'))) {
+ $this->force_login($page);
+ }
+ $val = call_user_func_array($hook['hook'], $args);
+ }
+ return $val;
}
function force_login(&$page)
} else {
$page->changeTpl('core/password_prompt.tpl');
$page->addJsLink('do_challenge_response.js');
- }
+ }
+ $page->assign('platal', $this);
$page->run();
}
}
}
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>