wiki pour xnet
authorx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 29 Jul 2006 20:43:42 +0000 (20:43 +0000)
committerx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 29 Jul 2006 20:43:42 +0000 (20:43 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@704 839d8a87-29fc-0310-9880-83ba4fa771e5

htdocs.net/.htaccess
htdocs.net/css/wiki.css
htdocs.net/wiki [new symlink]
htdocs.net/wiki.php [new file with mode: 0644]
htdocs/css/wiki.css
include/wiki.inc.php

index c5457d6..7b98184 100644 (file)
@@ -3,6 +3,10 @@ RewriteEngine on
 
 RewriteBase /~x2001corpet
 
+# wiki
+
+RewriteRule ^Xnet/([A-Z].*) wiki.php?n=Xnet/$1 [L,QSA]
+
 # Rewrite URLs of the form 'index.php?q=x':
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
index f298536..deb061c 100644 (file)
@@ -1,35 +1,77 @@
-div.frame {
-    margin: 0px;
-    padding: 8px 2px;
-    float: right;
-    margin: 5px 0px 5px 5px;
+table.wiki {
+    margin-left: auto;
+    margin-right: auto;
+    border: 1px dotted gray;
+}
+
+table.wiki td {
+    padding: 2px 1em;
+    vertical-align: middle;
+    text-align: center;
+}
+
+table.wiki select {
+    font-size: 80%;
 }
 
-table.quickref       {
-    margin-top 1em: padding: 0px;
+div.frame br {
+    height: 0px;
+    clear: both;
+}
+
+table.quickref {
+    margin-top: 1em;
+    padding: 0px;
     border: 1px dotted #aaaaaa;
     font-size: 95%;
 }
 
-table.quickref tr    {
-    padding 0px;
+table.quickref tr {
+    padding: 0px;
     margin: 0px;
 }
 
-table.quickref td    {
+table.quickref td {
     margin: 0px;
     padding: 4px;
     border-top: 1px dotted #aaaaaa;
 }
 
-#text { width:800px; }
-.diffbox { border:1px #999999 solid; margin-top:1.33em; }
-.diffauthor { font-weight:bold; }
-.diffchangesum { font-weight:bold; }
-.difftime { font-family:verdana,sans-serif; font-size:66%; background-color:#dddddd; }
-.difftype { clear:both; font-family:verdana,sans-serif; font-size:66%; font-weight:bold; }
-.diffadd { border-left:5px #99ff99 solid; padding-left:5px; }
-.diffdel { border-left:5px #ffff99 solid; padding-left:5px; }
-.diffrestore { clear:both; font-family:verdana,sans-serif; font-size:66%; margin:1.5em 0px; }
-a.varlink { text-decoration:none; }
-    
+#text { width: 800px; }
+
+.diffbox {
+    border: 1px #999999 solid;
+    margin-top: 1.33em; 
+}
+.diffauthor {
+    font-weight: bold; 
+}
+.diffchangesum {
+    font-weight: bold; 
+}
+.difftime {
+    font-size: 66%;
+    background-color: #dddddd; 
+}
+.difftype {
+    clear: both;
+    font-size: 66%;
+    font-weight: bold; 
+}
+.diffadd {
+    border-left: 5px #99ff99 solid;
+    padding-left: 5px; 
+}
+.diffdel {
+    border-left: 5px #ffff99 solid;
+    padding-left: 5px; 
+}
+.diffrestore {
+    clear: both;
+    font-size: 66%;
+    margin: 1.5em 0px; 
+}
+a.varlink {
+    text-decoration: none; 
+}
+
diff --git a/htdocs.net/wiki b/htdocs.net/wiki
new file mode 120000 (symlink)
index 0000000..aea38f9
--- /dev/null
@@ -0,0 +1 @@
+../wiki/pub/
\ No newline at end of file
diff --git a/htdocs.net/wiki.php b/htdocs.net/wiki.php
new file mode 100644 (file)
index 0000000..749bda2
--- /dev/null
@@ -0,0 +1,110 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2006 Polytechnique.org                              *
+ *  http://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 of the License, or      *
+ *  (at your option) any later version.                                    *
+ *                                                                         *
+ *  This program is distributed in the hope that it will be useful,        *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
+ *  GNU General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************/
+
+$GLOBALS['IS_XNET_SITE'] = true;
+
+require_once 'xnet.inc.php';
+require_once 'wiki.inc.php';
+
+require_once dirname(__FILE__).'/../classes/Platal.php';
+require_once dirname(__FILE__).'/../classes/PLModule.php';
+
+$n = wiki_pagename();
+if (!$n) {
+    pl_redirect('');
+}
+
+new_skinned_page('wiki.tpl');
+$perms = wiki_get_perms($n);
+
+switch (Env::v('action')) {
+  case '':
+    wiki_apply_perms($perms[0]);
+    break;
+
+  case 'edit':
+    wiki_apply_perms($perms[1]);
+    break;
+
+  default:
+    wiki_apply_perms('admin');
+    break;
+}
+
+if ($p = Post::v('setrperms')) {
+    wiki_apply_perms('admin');
+    if (wiki_set_perms($n, $p, $perms[1])) {
+        $perms = wiki_get_perms($n);
+        $page->trig('Permissions mises à jour');
+    }
+}
+
+if ($p = Post::v('setwperms')) {
+    wiki_apply_perms('admin');
+    if (wiki_set_perms($n, $perms[0], $p)) {
+        $perms = wiki_get_perms($n);
+        $page->trig('Permissions mises à jour');
+    }
+}
+
+$wiki_cache   = wiki_work_dir().'/cache_'.$n.'.tpl';
+$cache_exists = file_exists($wiki_cache);
+
+if (Env::v('action') || !$cache_exists) {
+    @unlink($wiki_cache);
+
+    // we leave pmwiki do whatever it wants and store everything
+    ob_start();
+    require_once($globals->spoolroot.'/wiki/pmwiki.php');
+
+    $wikiAll = ob_get_clean();
+    // the pmwiki skin we are using (almost empty) has these keywords:
+    $i = strpos($wikiAll, "<!--/HeaderText-->");
+    $j = strpos($wikiAll, "<!--/PageLeftFmt-->", $i);
+}
+
+if (Env::v('action')) {
+    $page->assign('xorg_extra_header', substr($wikiAll, 0, $i));
+    $wikiAll = substr($wikiAll, $j);
+} else {
+    if (!$cache_exists) {
+        $wikiAll = substr($wikiAll, $j);
+        wiki_putfile($wiki_cache, $wikiAll);
+    } else {
+        $wikiAll = file_get_contents($wiki_cache);
+    }
+}
+
+$page->assign('perms', $perms);
+$page->assign('perms_opts', wiki_perms_options());
+
+$page->assign('canedit',    wiki_may_have_perms($perms[1]));
+$page->assign('has_perms',  wiki_may_have_perms('admin'));
+
+$page->assign('wikipage', str_replace('.', '/', $n));
+$page->assign('pmwiki',   $wikiAll);
+
+$page->addCssLink('wiki.css');
+$page->addJsLink('javascript/wiki.js');
+
+$page->useMenu();
+$page->run();
+?>
index e90d320..deb061c 100644 (file)
@@ -27,7 +27,7 @@ table.quickref {
 }
 
 table.quickref tr {
-    padding 0px;
+    padding: 0px;
     margin: 0px;
 }
 
index 40dc108..2c7aa48 100644 (file)
@@ -111,14 +111,16 @@ function wiki_apply_perms($perm) {
         return;
 
       case 'logged':
-        if (!XorgSession::doAuthCookie()) {
+        if ((empty($GLOBALS['IS_XNET_SITE']) && !XorgSession::doAuthCookie()) ||
+          ($GLOBALS['IS_XNET_SITE'] && !XnetSession::doAuth())) {
             $platal = new Platal();
             $platal->force_login($page);
         }
         return;
 
       default:
-        if (!XorgSession::doAuth()) {
+        if ((empty($GLOBALS['IS_XNET_SITE']) && !XorgSession::doAuthe()) ||
+          ($GLOBALS['IS_XNET_SITE'] && !XnetSession::doAuth())) {
             $platal = new Platal();
             $platal->force_login($page);
         }