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 // $GLOBALS['IS_XNET_SITE'] = true;
24 require_once dirname(__FILE__
).'/../classes/XDB.php';
25 require_once dirname(__FILE__
).'/../classes/Platal.php';
26 require_once dirname(__FILE__
).'/../classes/PLModule.php';
27 require_once dirname(__FILE__
).'/../classes/CoreLogger.php';
29 require_once dirname(__FILE__
).'/../include/xorg.inc.php';
31 if (!($path = Env
::v('n')) ||
($path{0} < 'A' ||
$path{0} > 'Z')) {
33 $platal = new Platal('auth', 'banana', 'carnet', 'email', 'events',
34 'geoloc', 'lists', 'marketing', 'payment', 'platal',
35 'profile', 'register', 'search', 'stats', 'admin');
43 require_once 'wiki.inc.php';
50 new_skinned_page('wiki.tpl');
51 $perms = wiki_get_perms($n);
53 if (Env
::v('display') == 'light') {
54 $page->assign('simple', true
);
57 switch (Env
::v('action')) {
59 wiki_apply_perms($perms[0]);
63 wiki_apply_perms($perms[1]);
67 wiki_apply_perms('admin');
71 if ($p = Post
::v('setrperms')) {
72 wiki_apply_perms('admin');
73 if (wiki_set_perms($n, $p, $perms[1])) {
74 $perms = wiki_get_perms($n);
75 $page->trig('Permissions mises à jour');
79 if ($p = Post
::v('setwperms')) {
80 wiki_apply_perms('admin');
81 if (wiki_set_perms($n, $perms[0], $p)) {
82 $perms = wiki_get_perms($n);
83 $page->trig('Permissions mises à jour');
87 $wiki_cache = wiki_work_dir().'/cache_'.$n.'.tpl';
88 $cache_exists = file_exists($wiki_cache);
90 if (Env
::v('action') ||
!$cache_exists) {
93 // we leave pmwiki do whatever it wants and store everything
95 require_once($globals->spoolroot
.'/wiki/pmwiki.php');
97 $wikiAll = ob_get_clean();
98 // the pmwiki skin we are using (almost empty) has these keywords:
99 $i = strpos($wikiAll, "<!--/HeaderText-->");
100 $j = strpos($wikiAll, "<!--/PageLeftFmt-->", $i);
103 if (Env
::v('action')) {
104 $page->assign('xorg_extra_header', substr($wikiAll, 0, $i));
105 $wikiAll = substr($wikiAll, $j);
107 if (!$cache_exists) {
108 $wikiAll = substr($wikiAll, $j);
109 wiki_putfile($wiki_cache, $wikiAll);
111 $wikiAll = file_get_contents($wiki_cache);
115 $page->assign('perms', $perms);
116 $page->assign('perms_opts', wiki_perms_options());
118 $page->assign('canedit', wiki_may_have_perms($perms[1]));
119 $page->assign('has_perms', wiki_may_have_perms('admin'));
121 $page->assign('wikipage', str_replace('.', '/', $n));
122 $page->assign('pmwiki', $wikiAll);
124 $page->addCssLink('wiki.css');
125 $page->addJsLink('wiki.js');