0337d704 |
1 | <?php |
bd4be95d |
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 | |
27472b85 |
22 | $GLOBALS['IS_XNET_SITE'] = true; |
23 | |
f1ca33de |
24 | require_once dirname(__FILE__).'/../classes/XDB.php'; |
ae7bb180 |
25 | require_once dirname(__FILE__).'/../classes/Xnet.php'; |
bd4be95d |
26 | require_once dirname(__FILE__).'/../classes/PLModule.php'; |
c4271d38 |
27 | require_once dirname(__FILE__).'/../classes/CoreLogger.php'; |
28 | |
e9e9306b |
29 | require_once dirname(__FILE__).'/../include/xnet.inc.php'; |
bd4be95d |
30 | |
b647fb5f |
31 | if (!($path = Env::v('n')) || substr($path, 0, 4) != 'Xnet') { |
27472b85 |
32 | $platal = new Xnet('xnet', 'xnetgrp', 'xnetlists', 'xnetevents', 'geoloc'); |
33 | $platal->run(); |
34 | |
35 | exit; |
36 | } |
37 | |
bf6f6356 |
38 | /*** WIKI CODE ***/ |
39 | |
27472b85 |
40 | require_once 'wiki.inc.php'; |
41 | |
42 | $n = wiki_pagename(); |
43 | if (!$n) { |
44 | pl_redirect(''); |
45 | } |
46 | |
47 | new_skinned_page('wiki.tpl'); |
48 | $perms = wiki_get_perms($n); |
49 | |
50 | switch (Env::v('action')) { |
51 | case '': |
52 | wiki_apply_perms($perms[0]); |
53 | break; |
54 | |
55 | case 'edit': |
56 | wiki_apply_perms($perms[1]); |
57 | break; |
58 | |
59 | default: |
60 | wiki_apply_perms('admin'); |
61 | break; |
62 | } |
63 | |
64 | if ($p = Post::v('setrperms')) { |
65 | wiki_apply_perms('admin'); |
66 | if (wiki_set_perms($n, $p, $perms[1])) { |
67 | $perms = wiki_get_perms($n); |
f517fe56 |
68 | $page->trig('Permissions mises à jour'); |
27472b85 |
69 | } |
70 | } |
71 | |
72 | if ($p = Post::v('setwperms')) { |
73 | wiki_apply_perms('admin'); |
74 | if (wiki_set_perms($n, $perms[0], $p)) { |
75 | $perms = wiki_get_perms($n); |
f517fe56 |
76 | $page->trig('Permissions mises à jour'); |
27472b85 |
77 | } |
78 | } |
79 | |
80 | $wiki_cache = wiki_work_dir().'/cache_'.$n.'.tpl'; |
81 | $cache_exists = file_exists($wiki_cache); |
82 | |
83 | if (Env::v('action') || !$cache_exists) { |
84 | @unlink($wiki_cache); |
85 | |
86 | // we leave pmwiki do whatever it wants and store everything |
87 | ob_start(); |
88 | require_once($globals->spoolroot.'/wiki/pmwiki.php'); |
89 | |
90 | $wikiAll = ob_get_clean(); |
91 | // the pmwiki skin we are using (almost empty) has these keywords: |
92 | $i = strpos($wikiAll, "<!--/HeaderText-->"); |
93 | $j = strpos($wikiAll, "<!--/PageLeftFmt-->", $i); |
94 | } |
95 | |
96 | if (Env::v('action')) { |
97 | $page->assign('xorg_extra_header', substr($wikiAll, 0, $i)); |
98 | $wikiAll = substr($wikiAll, $j); |
99 | } else { |
100 | if (!$cache_exists) { |
101 | $wikiAll = substr($wikiAll, $j); |
102 | wiki_putfile($wiki_cache, $wikiAll); |
103 | } else { |
104 | $wikiAll = file_get_contents($wiki_cache); |
105 | } |
106 | } |
107 | |
108 | $page->assign('perms', $perms); |
109 | $page->assign('perms_opts', wiki_perms_options()); |
110 | |
111 | $page->assign('canedit', wiki_may_have_perms($perms[1])); |
112 | $page->assign('has_perms', wiki_may_have_perms('admin')); |
113 | |
114 | $page->assign('wikipage', str_replace('.', '/', $n)); |
115 | $page->assign('pmwiki', $wikiAll); |
116 | |
117 | $page->addCssLink('wiki.css'); |
c99ef281 |
118 | $page->addJsLink('wiki.js'); |
27472b85 |
119 | |
120 | $page->useMenu(); |
121 | $page->run(); |
0337d704 |
122 | |
0337d704 |
123 | ?> |