$args[0] = &$page;
if ($hook['auth'] > S::v('auth', AUTH_PUBLIC)) {
- global $globals;
-
- if (!call_user_func(array($globals->session, 'doAuth'))) {
- $this->force_login($page);
+ if ($hook['type'] == DO_AUTH) {
+ global $globals;
+
+ if (!call_user_func(array($globals->session, 'doAuth'))) {
+ $this->force_login($page);
+ }
+ } else {
+ return PL_FORBIDDEN;
}
}
{
function handlers() { die("implement me"); }
- function make_hook($fun, $auth, $perms = '', $type = SKINNED)
+ function make_hook($fun, $auth, $perms = '', $type = DO_AUTH)
{
return array('hook' => array($this, 'handler_'.$fun),
'auth' => $auth,
function()
{
if(Ajax.xml_client.readyState == 4) {
- document.getElementById(obj).innerHTML = Ajax.xml_client.responseText;
+ if (Ajax.xml_client.status == 200) {
+ document.getElementById(obj).innerHTML = Ajax.xml_client.responseText;
+ }
}
};
Ajax.xml_client.open ('GET', src, true);
define('SIMPLE', 1);
define('NO_SKIN', 2);
+define('NO_AUTH', 0);
+define('DO_AUTH', 1);
+
function __autoload($cls)
{
@include dirname(dirname(__FILE__)).'/classes/'.strtolower($cls).'.php';
function handler_403(&$page)
{
- header('HTTP/1.0 403 Forbidden');
+ header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
$page->changeTpl('403.tpl');
}
function handler_404(&$page)
{
- header('HTTP/1.0 404 Not Found');
+ header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
$page->changeTpl('404.tpl');
}
{
return array(
'lists' => $this->make_hook('lists', AUTH_MDP),
- 'lists/ajax' => $this->make_hook('ajax', AUTH_MDP),
+ 'lists/ajax' => $this->make_hook('ajax', AUTH_MDP, '', NO_AUTH),
'lists/create' => $this->make_hook('create', AUTH_MDP),
'lists/members' => $this->make_hook('members', AUTH_COOKIE),