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