<?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 *
system('rm -f '.wiki_work_dir().'/cache_*');
}
+function wiki_perms_options() {
+ return array('public' => '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);
}
}
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') {
}
}
+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');
+}
+
?>