first reimport from platal
[platal.git] / scripts / listes_redirect.php
1 <?php
2 preg_match("/^\/(moderate|admin|members)\/(.*)_([^_]*)$/", $_SERVER["REQUEST_URI"], $matches);
3 if (empty($matches)) {
4 exit();
5 } else {
6 $action = $matches[1];
7 $mbox = $matches[2];
8 $fqdn = strtolower($matches[3]);
9 if ($fqdn == 'polytechnique.org') {
10 header("Location: https://www.polytechnique.org/listes/$action.php?liste=$mbox");
11 } else {
12 require("../include/xorg.inc.php");
13 $res = $globals->xdb->query("select diminutif from groupex.asso where mail_domain = {?}", $fqdn);
14 if ($gpx = $res->fetchOneCell()) {
15 header("Location: http://www.polytechnique.net/$gpx/listes-$action.php?liste=$mbox");
16 }
17 }
18 }
19 ?>