X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fwiki.inc.php;h=cd506e63d2f74ad0bbccc6291354c5f2533c8a22;hb=ae0508cbd08c4974520a6d3e80df42842ef34c10;hp=d34e578655eed560ed72d0326828e84829658cb5;hpb=679529006d1a7a20fd3c23ad0730474c4fcd9f0d;p=platal.git diff --git a/include/wiki.inc.php b/include/wiki.inc.php index d34e578..cd506e6 100644 --- a/include/wiki.inc.php +++ b/include/wiki.inc.php @@ -56,7 +56,7 @@ function wiki_get_perms($n) $file = wiki_work_dir().'/'.str_replace('/', '.', $n); $lines = explode("\n", @file_get_contents($file)); foreach ($lines as $line) { - list($k, $v) = explode('=', $line, 2); + @list($k, $v) = explode('=', $line, 2); if ($k == 'platal_perms') { return explode(':', $v); } @@ -104,24 +104,21 @@ function wiki_may_have_perms($perm) { } function wiki_apply_perms($perm) { - global $page, $platal; + global $page, $platal, $globals; switch ($perm) { case 'public': return; case 'logged': - if (empty($GLOBALS['IS_XNET_SITE'])) { - if (!XorgSession::doAuthCookie()) { - $platal = new Platal(); - $platal->force_login($page); - } - return; + if (!call_user_func(array($globals->session, 'doAuthCookie'))) { + $platal = new Platal(); + $platal->force_login($page); } - /* fallthrough */ + return; default: - if (call_user_func(array($globals->session, 'doAuth'))) { + if (!call_user_func(array($globals->session, 'doAuth'))) { $platal = empty($GLOBALS['IS_XNET_SITE']) ? new Platal() : new Xnet(); $platal->force_login($page); } @@ -132,4 +129,13 @@ function wiki_apply_perms($perm) { } } +function wiki_require_page($pagename) +{ + global $globals; + $pagename_slashes = str_replace('.','/',$pagename); + $pagename_dots = str_replace('/','.',$pagename); + if (is_file(wiki_work_dir().'/cache_'.$pagename_dots.'.tpl')) return; + system('wget '.$globals->baseurl.'/'.$pagename_slashes.' -O /dev/null'); +} + ?>