ab25fbc71f5518a52fdaae0105a1661add2810f4
2 /***************************************************************************
3 * Copyright (C) 2003-2006 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
22 require_once 'xorg.inc.php';
23 require_once 'wiki.inc.php';
25 require_once dirname(__FILE__
).'/../classes/Platal.php';
26 require_once dirname(__FILE__
).'/../classes/PLModule.php';
33 new_skinned_page('wiki.tpl');
34 $perms = get_perms($n);
36 switch (Env
::get('action')) {
38 wiki_apply_perms($perms[0]);
42 wiki_apply_perms($perms[1]);
46 wiki_apply_perms('admin');
50 $wiki_cache = wiki_work_dir().'/cache_'.$n.'.tpl';
51 $cache_exists = file_exists($wiki_cache);
53 if (Env
::get('action') ||
!$cache_exists) {
56 // we leave pmwiki do whatever it wants and store everything
58 require_once($globals->spoolroot
.'/wiki/pmwiki.php');
60 $wikiAll = ob_get_clean();
61 // the pmwiki skin we are using (almost empty) has these keywords:
62 $i = strpos($wikiAll, "<!--/HeaderText-->");
63 $j = strpos($wikiAll, "<!--/PageLeftFmt-->", $i);
66 if (Env
::get('action')) {
67 $page->assign('xorg_extra_header', substr($wikiAll, 0, $i));
68 $wikiAll = substr($wikiAll, $j);
71 $f = fopen($wiki_cache, 'w');
72 $wikiAll = substr($wikiAll, $j);
76 $wikiAll = file_get_contents($wiki_cache);
80 $page->assign('perms', $perms);
81 $page->assign('perms_opts',
82 array('public' => 'Public', 'logged' => 'Connecté',
83 'mdp' => 'Authentifié', 'admin' => 'Admin'));
85 $page->assign('canedit', wiki_may_have_perms($perms[1]));
86 $page->assign('has_perms', wiki_may_have_perms('admin'));
88 $page->assign('wikipage', str_replace('.', '/', $n));
89 $page->assign('pmwiki', $wikiAll);
91 $page->addCssLink('css/wiki.css');