make the path be taken from 'n' instead of 'p' so that it's the same as
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 30 Jul 2006 11:16:40 +0000 (11:16 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 30 Jul 2006 11:16:40 +0000 (11:16 +0000)
the wiki :D

merge index.php and wiki.php, reflect that in the .htaccess. now the
.htaccess for xnet and xorg are the same (hmmm)

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@713 839d8a87-29fc-0310-9880-83ba4fa771e5

classes/Platal.php
htdocs.net/.htaccess
htdocs.net/index.php
htdocs.net/wiki.php [deleted file]
htdocs/.htaccess
htdocs/index.php
htdocs/wiki.php [deleted file]
include/xnet/globals.inc.php
include/xnet/session.inc.php
include/xorg.plugin.inc.php
modules/geoloc.php

index 72348a3..71dd37d 100644 (file)
@@ -34,7 +34,7 @@ class Platal
     function Platal()
     {
         $modules    = func_get_args();
-        $this->path = trim(Get::_get('p', null), '/');
+        $this->path = trim(Get::_get('n', null), '/');
 
         $this->__mods  = array();
         $this->__hooks = array();
index addfb4c..6310a7b 100644 (file)
@@ -3,11 +3,7 @@ RewriteEngine on
 
 RewriteBase /~x2000habouzit
 
-# 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
-RewriteRule ^(.*)$ index.php?p=$1 [L,QSA]
+RewriteRule ^(.*)$ index.php?n=$1 [L,QSA]
index e60b157..28cd157 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
+$GLOBALS['IS_XNET_SITE'] = true;
+
 require 'xnet.inc.php';
 
 require_once dirname(__FILE__).'/../classes/Xnet.php';
 require_once dirname(__FILE__).'/../classes/PLModule.php';
 
-$GLOBALS['IS_XNET_SITE'] = true;
-$platal = new Xnet('xnet', 'xnetgrp', 'xnetlists', 'xnetevents', 'geoloc');
-$platal->run();
+if ($path = Env::v('n') && substr($path, 0, 4) != 'Xnet') {
+
+    $platal = new Xnet('xnet', 'xnetgrp', 'xnetlists', 'xnetevents', 'geoloc');
+    $platal->run();
+
+    exit;
+}
+
+require_once 'wiki.inc.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();
 
 ?>
diff --git a/htdocs.net/wiki.php b/htdocs.net/wiki.php
deleted file mode 100644 (file)
index 749bda2..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-<?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 73d78b6..6310a7b 100644 (file)
@@ -3,11 +3,7 @@ RewriteEngine on
 
 RewriteBase /~x2000habouzit
 
-# wiki
-
-RewriteRule ^([A-Z].*) wiki.php?n=$1 [L,QSA]
-
 # Rewrite URLs of the form 'index.php?q=x':
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
-RewriteRule ^(.*)$ index.php?p=$1 [L,QSA]
+RewriteRule ^(.*)$ index.php?n=$1 [L,QSA]
index 7ab8a67..83e7a20 100644 (file)
@@ -24,9 +24,98 @@ require_once 'xorg.inc.php';
 require_once dirname(__FILE__).'/../classes/Platal.php';
 require_once dirname(__FILE__).'/../classes/PLModule.php';
 
-$platal = new Platal('auth', 'banana', 'carnet', 'email', 'events', 'geoloc',
-                     'lists', 'marketing', 'payment', 'platal', 'profile',
-                     'register', 'search', 'stats', 'admin');
-$platal->run();
+if ($path = Env::v('n') && ($path{0} < 'A' || $path{0} > 'Z')) {
+
+    $platal = new Platal('auth', 'banana', 'carnet', 'email', 'events',
+                         'geoloc', 'lists', 'marketing', 'payment', 'platal',
+                         'profile', 'register', 'search', 'stats', 'admin');
+    $platal->run();
+
+    exit;
+}
+
+/*** WIKI CODE ***/
+
+require_once 'wiki.inc.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('css/wiki.css');
+$page->addJsLink('javascript/wiki.js');
+
+$page->run();
 
 ?>
diff --git a/htdocs/wiki.php b/htdocs/wiki.php
deleted file mode 100644 (file)
index 5c65266..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-<?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                *
- ***************************************************************************/
-
-require_once 'xorg.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('css/wiki.css');
-$page->addJsLink('javascript/wiki.js');
-
-$page->run();
-?>
index e661de0..b1aec4a 100644 (file)
@@ -48,7 +48,7 @@ class XnetGlobals extends PlatalGlobals
         static $aid = null;
 
         if (is_null($aid)) {
-            $gp = Get::v('p');
+            $gp = Get::v('n');
             $gp = substr($gp, 0, strpos($gp, '/'));
 
             if ($gp) {
index 147fab8..388dee1 100644 (file)
@@ -100,8 +100,8 @@ class XnetSession
         S::kill('loginX');
         Get::kill('auth');
         Get::kill('uid');
-        $path = Get::v('p');
-        Get::kill('p');
+        $path = Get::v('n');
+        Get::kill('n');
         Get::kill('PHPSESSID');
 
         $args = array();
index 971d5a1..f6fba18 100644 (file)
@@ -82,7 +82,7 @@ class XOrgPlugin
        }
 
        foreach ($_GET as $key=>$val) {
-            if ($key == 'p') {
+            if ($key == 'n') {
                 continue;
             }
            if (in_array($key, $this->_get_vars) && array_key_exists($key, $args)) {
index 8228bd9..cfcd673 100644 (file)
@@ -46,7 +46,7 @@ class GeolocModule extends PLModule
         $querystring = "";
 
         foreach ($_GET as $v => $a) {
-            if ($v != 'initfile' && $v != 'p' && $v != 'mapid') {
+            if ($v != 'initfile' && $v != 'n' && $v != 'mapid') {
                 $querystring .= urlencode($v).'='.urlencode($a).'&amp;';
             }
         }