the big redirection script
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Thu, 17 Feb 2005 20:52:34 +0000 (20:52 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:28:12 +0000 (23:28 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-481

scripts/listes_redirect.php [new file with mode: 0644]

diff --git a/scripts/listes_redirect.php b/scripts/listes_redirect.php
new file mode 100644 (file)
index 0000000..5758af8
--- /dev/null
@@ -0,0 +1,20 @@
+<?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 ($action == 'members') { $action = 'membres'; }
+    if ($fqdn == 'polytechnique.org') {
+        header("Location: https://www.polytechnique.org/listes/$action?liste=$mbox");
+    } else {
+        require("../include/xorg.inc.php");
+        $res = $globals->xdb->query("select diminutif from groupex.asso where mail_domain = {?}", $fqdn);
+        if ($gpx = $res->fetchOneCell()) {
+            header("Location: http://www.polytechnique.net/$gpx/listes-$action?liste=$mbox");
+        }
+    }
+}
+?>