b62f8858 |
1 | <?php |
2 | /*************************************************************************** |
3 | * Copyright (C) 2003-2006 Polytechnique.org * |
4 | * http://opensource.polytechnique.org/ * |
5 | * * |
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. * |
10 | * * |
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. * |
15 | * * |
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 * |
18 | * Foundation, Inc., * |
19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
20 | ***************************************************************************/ |
21 | |
bf6f6356 |
22 | // $GLOBALS['IS_XNET_SITE'] = true; |
23 | |
b62f8858 |
24 | require_once 'xorg.inc.php'; |
25 | |
26 | require_once dirname(__FILE__).'/../classes/Platal.php'; |
27 | require_once dirname(__FILE__).'/../classes/PLModule.php'; |
28 | |
6523f625 |
29 | if (($path = Env::v('n')) && ($path{0} < 'A' || $path{0} > 'Z')) { |
27472b85 |
30 | |
31 | $platal = new Platal('auth', 'banana', 'carnet', 'email', 'events', |
32 | 'geoloc', 'lists', 'marketing', 'payment', 'platal', |
33 | 'profile', 'register', 'search', 'stats', 'admin'); |
34 | $platal->run(); |
35 | |
36 | exit; |
37 | } |
38 | |
39 | /*** WIKI CODE ***/ |
40 | |
41 | require_once 'wiki.inc.php'; |
42 | |
43 | $n = wiki_pagename(); |
44 | if (!$n) { |
45 | pl_redirect(''); |
46 | } |
47 | |
48 | new_skinned_page('wiki.tpl'); |
49 | $perms = wiki_get_perms($n); |
50 | |
51 | switch (Env::v('action')) { |
52 | case '': |
53 | wiki_apply_perms($perms[0]); |
54 | break; |
55 | |
56 | case 'edit': |
57 | wiki_apply_perms($perms[1]); |
58 | break; |
59 | |
60 | default: |
61 | wiki_apply_perms('admin'); |
62 | break; |
63 | } |
64 | |
65 | if ($p = Post::v('setrperms')) { |
66 | wiki_apply_perms('admin'); |
67 | if (wiki_set_perms($n, $p, $perms[1])) { |
68 | $perms = wiki_get_perms($n); |
69 | $page->trig('Permissions mises à jour'); |
70 | } |
71 | } |
72 | |
73 | if ($p = Post::v('setwperms')) { |
74 | wiki_apply_perms('admin'); |
75 | if (wiki_set_perms($n, $perms[0], $p)) { |
76 | $perms = wiki_get_perms($n); |
77 | $page->trig('Permissions mises à jour'); |
78 | } |
79 | } |
80 | |
81 | $wiki_cache = wiki_work_dir().'/cache_'.$n.'.tpl'; |
82 | $cache_exists = file_exists($wiki_cache); |
83 | |
84 | if (Env::v('action') || !$cache_exists) { |
85 | @unlink($wiki_cache); |
86 | |
87 | // we leave pmwiki do whatever it wants and store everything |
88 | ob_start(); |
89 | require_once($globals->spoolroot.'/wiki/pmwiki.php'); |
90 | |
91 | $wikiAll = ob_get_clean(); |
92 | // the pmwiki skin we are using (almost empty) has these keywords: |
93 | $i = strpos($wikiAll, "<!--/HeaderText-->"); |
94 | $j = strpos($wikiAll, "<!--/PageLeftFmt-->", $i); |
95 | } |
96 | |
97 | if (Env::v('action')) { |
98 | $page->assign('xorg_extra_header', substr($wikiAll, 0, $i)); |
99 | $wikiAll = substr($wikiAll, $j); |
100 | } else { |
101 | if (!$cache_exists) { |
102 | $wikiAll = substr($wikiAll, $j); |
103 | wiki_putfile($wiki_cache, $wikiAll); |
104 | } else { |
105 | $wikiAll = file_get_contents($wiki_cache); |
106 | } |
107 | } |
108 | |
109 | $page->assign('perms', $perms); |
110 | $page->assign('perms_opts', wiki_perms_options()); |
111 | |
112 | $page->assign('canedit', wiki_may_have_perms($perms[1])); |
113 | $page->assign('has_perms', wiki_may_have_perms('admin')); |
114 | |
115 | $page->assign('wikipage', str_replace('.', '/', $n)); |
116 | $page->assign('pmwiki', $wikiAll); |
117 | |
118 | $page->addCssLink('css/wiki.css'); |
119 | $page->addJsLink('javascript/wiki.js'); |
120 | |
121 | $page->run(); |
b62f8858 |
122 | |
123 | ?> |