X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fwiki.inc.php;h=838693ecd27ad8f9808ef36965b73c03b580d63e;hb=ed03d07f3821b8b22a0da434436d22cb7a53f2e3;hp=3b441bcec8c7b9a8d1745dc3b9f4b6eeb103c12d;hpb=89232034976e2987f136d6afe75b4038aa66f987;p=platal.git diff --git a/include/wiki.inc.php b/include/wiki.inc.php index 3b441bc..838693e 100644 --- a/include/wiki.inc.php +++ b/include/wiki.inc.php @@ -1,6 +1,6 @@ 'Public', 'logged' => 'Connecté', + 'mdp' => 'Authentifié', 'admin' => 'Admin'); +} + 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); } @@ -99,22 +104,22 @@ 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 (!XorgSession::doAuthCookie()) { + if (!call_user_func(array($globals->session, 'doAuthCookie'))) { $platal = new Platal(); $platal->force_login($page); } return; default: - if (!XorgSession::doAuth()) { - $platal = new Platal(); + if (!call_user_func(array($globals->session, 'doAuth'))) { + $platal = empty($GLOBALS['IS_XNET_SITE']) ? new Platal() : new Xnet(); $platal->force_login($page); } if ($perm == 'admin') { @@ -124,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'); +} + ?>