X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=htdocs%2Fwiki.php;h=6969be1575618e7f4bbdae09e0038f2ac9927db7;hb=b62f88580b5d5a12e804094ddc46033b62a8dbff;hp=7c5ee5bd14bfd0215f101e736ccc79e0e3944603;hpb=2907d4014c8e6c437e0d9252b6a65dbaedf53212;p=platal.git
diff --git a/htdocs/wiki.php b/htdocs/wiki.php
index 7c5ee5b..6969be1 100644
--- a/htdocs/wiki.php
+++ b/htdocs/wiki.php
@@ -1,6 +1,6 @@
assign('logged', logged());
- $page->assign('identified', identified());
- $page->assign('has_perms', has_perms());
- $page->assign('public', true);
- $page->assign('wiki_admin', has_perms() && identified());
-}
-
if ($globals->wiki->wikidir) {
- // the wiki keword is given in the n var
- if ($n = Env::get('n', false))
- {
- // Get the correcti wiki keywords
- $n = str_replace('/', '.', $n);
- $keywords = explode('.', $n);
- $count = count($keywords);
- if ($count == 1)
- $n = $keywords[0].".".$keywords[0];
- else
- $n = $keywords[$count - 2].".".$keywords[$count - 1];
- if (($urln = str_replace('.', '/', $n)) != Env::get('n') &&
- $n != Env::get('n'))
- {
- header("Location: ".$globals->baseurl.'/'.$urln);
- die();
- }
- $_REQUEST['n'] = $n;
-
- $dir_wiki_tmp = '../spool/wiki.d/';
- $short_tpl = $dir_wiki_tmp.'cache_'.$n.'.tpl';
- $dir_tpl = $globals->spoolroot.'templates/'.$dir_wiki_tmp;
- $tpl = $globals->spoolroot.'templates/'.$short_tpl;
- $tmpfile_exists = file_exists($tpl);
-
- // don't recreate the tpl if it already exists
- if (Env::get('action') || !$tmpfile_exists)
- {
- // we leave pmwiki do whatever it wants and store everything
- ob_start();
- require_once(dirname(dirname(__FILE__)).'/'.$globals->wiki->wikidir.'/pmwiki.php');
-
- $wikiAll = ob_get_clean();
- // the pmwiki skin we are using (almost empty) has these keywords:
- $i = strpos($wikiAll, "");
- $j = strpos($wikiAll, "", $i);
-
- }
- if (Env::get('action'))
- {
- // clean old tmp files (more than one hour)
- $dh = opendir($dir_wiki_tmp);
- $time = time();
- while (($file = readdir($dh)) !== false)
- {
- if (strpos($file, 'temp_') === 0)
- {
- $created = filectime($dir_wiki_tmp.$file);
- if ($time-$created > 60 * 60)
- unlink($dir_wiki_tmp.$file);
- }
- }
-
- $page->assign('xorg_extra_header', substr($wikiAll, 0, $i));
- $tmp_tpl = tempnam($dir_tpl, "temp_");
- $f = fopen($tmp_tpl, 'w');
- fputs($f, substr($wikiAll, $j));
- fclose($f);
- new_skinned_page($tmp_tpl, AUTH_PUBLIC);
- if ($tmpfile_exists)
- unlink($tpl);
- } else {
- if (!$tmpfile_exists)
- {
- $f = fopen($tpl, 'w');
- fputs($f, substr($wikiAll, $j));
- fclose($f);
- }
- new_skinned_page($short_tpl, AUTH_PUBLIC);
- }
- }
+ $wikisite = 'xorg';
+ require_once("wiki.inc.php");
+ $page->changeTpl($wiki_template);
}
-$page->assign('xorg_extra_header', "\n");
-assign_auth();
+if (!Env::get('action'))
+ $page->assign('xorg_extra_header', "\n");
+
+wiki_assign_auth();
$page->addCssLink('css/wiki.css');
$page->run();