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