remove more code.
[platal.git] / htdocs / wiki.php
CommitLineData
bf98922c 1<?php
2/***************************************************************************
50a40a33 3 * Copyright (C) 2003-2006 Polytechnique.org *
bf98922c 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
801fcad8 22require_once 'xorg.inc.php';
2907d401 23
06a5e65b 24new_skinned_page('');
25if (!S::identified()) {
26 XorgSession::doAuth();
d575b75c 27}
bf98922c 28
06a5e65b 29require_once 'wiki.inc.php';
06a5e65b 30
6bc327ec 31if ($n = wiki_pagename()) {
32 $wiki_template = wiki_work_dir().'/cache_'.$n.'.tpl';
33 $tmpfile_exists = file_exists($wiki_template);
34
35 if (Env::get('action') || !$tmpfile_exists) {
36 if ($tmpfile_exists) {
37 @unlink($wiki_template);
38 $page->clear_compiled_tpl($wiki_template);
39 }
40
41 // we leave pmwiki do whatever it wants and store everything
42 ob_start();
43 require_once($globals->spoolroot.'/wiki/pmwiki.php');
44
45 $wikiAll = ob_get_clean();
46 // the pmwiki skin we are using (almost empty) has these keywords:
47 $i = strpos($wikiAll, "<!--/HeaderText-->");
48 $j = strpos($wikiAll, "<!--/PageLeftFmt-->", $i);
49 }
50
51 if (Env::get('action')) {
52 // clean old tmp files
53 wiki_clean_tmp();
54 $page->assign('xorg_extra_header', substr($wikiAll, 0, $i));
6bc327ec 55
56 // create new tmp files with editing page from wiki engine
57 $wiki_template = wiki_create_tmp(substr($wikiAll, $j));
58 } else {
59 if (!$tmpfile_exists) {
60 $f = fopen($wiki_template, 'w');
61 fputs($f, substr($wikiAll, $j));
62 fclose($f);
63 }
64 }
33ec1a8f 65}
6bc327ec 66$page->changeTpl($wiki_template);
33ec1a8f 67
0df3edb9 68wiki_assign_auth();
52165f0e 69$page->addCssLink('css/wiki.css');
bf98922c 70
71$page->run();
72?>