merge things from scripts into htdocs.
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 2 Aug 2006 21:15:37 +0000 (21:15 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 2 Aug 2006 21:15:37 +0000 (21:15 +0000)
the apache conf will change, this is already ready (non commited) on djali

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

htdocs/listes_redirect.php [moved from scripts/webredirect_error.php with 63% similarity]
htdocs/webredirect.php [moved from scripts/webredirect.php with 77% similarity]
htdocs/xnet.php
htdocs/xorg.php
scripts/listes_redirect.php [deleted file]

similarity index 63%
rename from scripts/webredirect_error.php
rename to htdocs/listes_redirect.php
index a467718..35d72f1 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-header("HTTP/1.0 404 Not Found");
-?>
+require_once dirname(__FILE__).'/../include/xorg.inc.php';
+
+preg_match('/^\/(moderate|admin|members)\/(.*)_([^_]*)$/', $_SERVER['REQUEST_URI'], $matches);
+
+if ($matches) {
 
+    $action = $matches[1];
+    $mbox   = $matches[2];
+    $fqdn   = strtolower($matches[3]);
+
+    if ($fqdn == 'polytechnique.org') {
+        http_redirect("https://www.polytechnique.org/lists/$action/$mbox");
+    }
+
+    $res = XDB::query("select diminutif from groupex.asso where mail_domain = {?}", $fqdn);
+    if ($gpx = $res->fetchOneCell()) {
+        http_redirect("http://www.polytechnique.net/$gpx/lists/$action/$mbox");
+    }
+}
+?>
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
-<html><head>
-<title>404 Not Found</title>
-</head><body>
-<h1>Not Found</h1>
-The requested URL <?php echo $_SERVER['REQUEST_URI'] ?> was not found on this server.<p>
-<hr>
-<address>Apache Server at www.carva.org Port 80</address>
-</body></html>
+<html>
+  <head>
+    <title>404 Not Found</title>
+  </head>
+  <body>
+    <h1>Not Found</h1>
+    The requested URL <?php echo $_SERVER['REQUEST_URI'] ?> was not found on this server.<p>
+    <hr>
+    <address>Apache Server at www.carva.org Port 80</address>
+  </body>
+</html>
similarity index 77%
rename from scripts/webredirect.php
rename to htdocs/webredirect.php
index f834e07..95c478e 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-require("../include/xorg.inc.php");
+require_once dirname(__FILE__).'/../include/xorg.inc.php';
 
-// on coupe la chaîne REQUEST_URI selon les / et on ne garde que
-// le premier non vide et éventuellement le second
-// la config d'apache impose la forme suivante pour REQUEST_URI :
-// REQUEST_URI = /prenom.nom(/path/fichier.hmtl)?
 list($username, $path) = preg_split('/\//', $_SERVER["REQUEST_URI"], 2, PREG_SPLIT_NO_EMPTY);
 $res = XDB::query(
         "SELECT  redirecturl
@@ -34,25 +30,25 @@ $res = XDB::query(
 
 if ($url = $res->fetchOneCell()) {
     $url = preg_replace('@/+$@', '', $url);
-    if($path) {
+    if ($path) {
         http_redirect("http://$url/$path");
     } else {
         http_redirect("http://$url");
     }
-    exit();
 }
 
-// si on est ici, il y a eu un erreur ou on n'a pas trouvé le redirect
 header("HTTP/1.0 404 Not Found");
 
 ?>
-
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
-<html><head>
-<title>404 Not Found</title>
-</head><body>
-<h1>Not Found</h1>
-The requested URL <?php echo $_SERVER['REQUEST_URI'] ?> was not found on this server.<p>
-<hr>
-<address>Apache Server at www.carva.org Port 80</address>
-</body></html>
+<html>
+  <head>
+    <title>404 Not Found</title>
+  </head>
+  <body>
+    <h1>Not Found</h1>
+    The requested URL <?php echo $_SERVER['REQUEST_URI'] ?> was not found on this server.<p>
+    <hr>
+    <address>Apache Server at www.carva.org Port 80</address>
+  </body>
+</html>
index 0b06746..bb96044 100644 (file)
@@ -26,7 +26,7 @@ require_once dirname(__FILE__).'/../classes/Xnet.php';
 require_once dirname(__FILE__).'/../classes/PLModule.php';
 require_once dirname(__FILE__).'/../classes/CoreLogger.php';
 
-require 'xnet.inc.php';
+require_once dirname(__FILE__).'/../include/xnet.inc.php';
 
 if (!($path = Env::v('n')) || substr($path, 0, 4) != 'Xnet') {
     $platal = new Xnet('xnet', 'xnetgrp', 'xnetlists', 'xnetevents', 'geoloc');
index 077faba..08dcbb0 100644 (file)
@@ -26,7 +26,7 @@ require_once dirname(__FILE__).'/../classes/Platal.php';
 require_once dirname(__FILE__).'/../classes/PLModule.php';
 require_once dirname(__FILE__).'/../classes/CoreLogger.php';
 
-require_once 'xorg.inc.php';
+require_once dirname(__FILE__).'/../include/xorg.inc.php';
 
 if (!($path = Env::v('n')) || ($path{0} < 'A' || $path{0} > 'Z')) {
 
diff --git a/scripts/listes_redirect.php b/scripts/listes_redirect.php
deleted file mode 100644 (file)
index 450b451..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-preg_match("/^\/(moderate|admin|members)\/(.*)_([^_]*)$/", $_SERVER["REQUEST_URI"], $matches);
-if (empty($matches)) {
-    exit();
-} else {
-    $action = $matches[1];
-    $mbox   = $matches[2];
-    $fqdn   = strtolower($matches[3]);
-    if ($fqdn == 'polytechnique.org') {
-        header("Location: https://www.polytechnique.org/lists/$action/$mbox");
-    } else {
-        require("../include/xorg.inc.php");
-        $res = XDB::query("select diminutif from groupex.asso where mail_domain = {?}", $fqdn);
-        if ($gpx = $res->fetchOneCell()) {
-            header("Location: http://www.polytechnique.net/$gpx/lists/$action/$mbox");
-        }
-    }
-}
-?>