X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=htdocs%2Fwiki.php;h=6406a25d91f0a7858466269a488a8cbc1002f15d;hb=5e35f1b7814e80d2b754899c823019e1fe81aa9d;hp=aa544519258749cdd0a8d4c0501a2d5e482bfc20;hpb=0df3edb9fd85fb750c47cee19a3a6b66f370cc97;p=platal.git diff --git a/htdocs/wiki.php b/htdocs/wiki.php index aa54451..6406a25 100644 --- a/htdocs/wiki.php +++ b/htdocs/wiki.php @@ -1,6 +1,6 @@ trig('Permissions mises à jour'); + } +} + +if ($p = Post::get('setwperms')) { + wiki_apply_perms('admin'); + if (wiki_set_perms($n, $perms[0], $p)) { + $perms = wiki_get_perms($n); + $page->trig('Permissions mises à jour'); + } +} + +$wiki_cache = wiki_work_dir().'/cache_'.$n.'.tpl'; +$cache_exists = file_exists($wiki_cache); + +if (Env::get('action') || !$cache_exists) { + @unlink($wiki_cache); -if ($globals->wiki->wikidir) { - $wikisite = 'xorg'; - require_once("wiki.inc.php"); - new_skinned_page($wiki_template, AUTH_PUBLIC); + // we leave pmwiki do whatever it wants and store everything + ob_start(); + require_once($globals->spoolroot.'/wiki/pmwiki.php'); + + $wikiAll = ob_get_clean(); + // the pmwiki skin we are using (almost empty) has these keywords: + $i = strpos($wikiAll, ""); + $j = strpos($wikiAll, "", $i); } -$page->assign('xorg_extra_header', "\n"); -wiki_assign_auth(); +if (Env::get('action')) { + $page->assign('xorg_extra_header', substr($wikiAll, 0, $i)); + $wikiAll = substr($wikiAll, $j); +} else { + if (!$cache_exists) { + $wikiAll = substr($wikiAll, $j); + wiki_putfile($wiki_cache, $wikiAll); + } else { + $wikiAll = file_get_contents($wiki_cache); + } +} + +$page->assign('perms', $perms); +$page->assign('perms_opts', + array('public' => 'Public', 'logged' => 'Connecté', + 'mdp' => 'Authentifié', 'admin' => 'Admin')); + +$page->assign('canedit', wiki_may_have_perms($perms[1])); +$page->assign('has_perms', wiki_may_have_perms('admin')); + +$page->assign('wikipage', str_replace('.', '/', $n)); +$page->assign('pmwiki', $wikiAll); + $page->addCssLink('css/wiki.css'); +$page->addJsLink('javascript/wiki.js'); $page->run(); ?>