Proof of concept:
[platal.git] / htdocs / wiki.php
index 08fe9a9..6969be1 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  Copyright (C) 2003-2006 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
  ***************************************************************************/
 
 require_once("xorg.inc.php");
-if (Env::has('response'))
- new_skinned_page('wiki.tpl', AUTH_MDP);
-else
- new_skinned_page('wiki.tpl', AUTH_PUBLIC);
 
-require_once('pmwiki.php');
- $page->assign('xorg_extra_header', substr($wikiAll, 0, $i));
- $page->assign('menu-pmwiki', $wikiMenu);
- $page->assign('pmwiki', $wikiTxt);
+// this page is to create a smarty template page from a wiki file
+// the wiki engine used is pmwiki.
+// the templates created are stored in wiki.d/cache_wikiword.tpl
+
+// some page can be seen by everybody (public), but to validate a password
+// if we arrive here before setting new access we need to try an auth
+new_skinned_page('wiki.tpl', Env::has('response') ? AUTH_MDP : AUTH_PUBLIC);
+
+if ($globals->wiki->wikidir) {
+    $wikisite = 'xorg';
+    require_once("wiki.inc.php");
+    $page->changeTpl($wiki_template);
+}
+
+if (!Env::get('action'))
+    $page->assign('xorg_extra_header', "<script type='text/JavaScript'>\n<!--\nNix={map:null,convert:function(a){Nix.init();var s='';for(i=0;i<a.length;i++){var b=a.charAt(i);s+=((b>='A'&&b<='Z')||(b>='a'&&b<='z')?Nix.map[b]:b);}return s;},init:function(){if(Nix.map!=null)return;var map=new Array();var s='abcdefghijklmnopqrstuvwxyz';for(i=0;i<s.length;i++)map[s.charAt(i)]=s.charAt((i+13)%26);for(i=0;i<s.length;i++)map[s.charAt(i).toUpperCase()]=s.charAt((i+13)%26).toUpperCase();Nix.map=map;},decode:function(a){document.write(Nix.convert(a));}}\n//-->\n</script>\n");
+    
+wiki_assign_auth();
+$page->addCssLink('css/wiki.css');
 
 $page->run();
 ?>