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