X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fwiki.inc.php;h=cd506e63d2f74ad0bbccc6291354c5f2533c8a22;hb=4e2929c6e6e7e5e175719a007a79598952bd9023;hp=cb05c88f27d6bfdeb410c721f763e03f30f5b326;hpb=6f97366a8f1291ed602228e93ed963602d7e67f2;p=platal.git diff --git a/include/wiki.inc.php b/include/wiki.inc.php index cb05c88..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,25 +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']) && !XorgSession::doAuthCookie()) { + if (!call_user_func(array($globals->session, 'doAuthCookie'))) { $platal = new Platal(); $platal->force_login($page); } - if ($GLOBALS['IS_XNET_SITE'] && !$_SESSION['session']->doAuth()) { - $platal = new Xnet(); - $platal->force_login($page); - } return; default: - if (!$_SESSION['session']->doAuth()) { + if (!call_user_func(array($globals->session, 'doAuth'))) { $platal = empty($GLOBALS['IS_XNET_SITE']) ? new Platal() : new Xnet(); $platal->force_login($page); } @@ -133,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'); +} + ?>