* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once("xorg.inc.php");
-new_skinned_page('webredirect.tpl', AUTH_MDP);
-$page->assign('xorg_title','Polytechnique.org - Redirection de page WEB');
+require_once dirname(__FILE__).'/../include/xorg.inc.php';
-$log =& Session::getMixed('log');
-$url = Env::get('url');
+list($username, $path) = preg_split('/\//', $_SERVER["REQUEST_URI"], 2, PREG_SPLIT_NO_EMPTY);
+$res = XDB::query(
+ "SELECT redirecturl
+ FROM auth_user_quick AS a
+ INNER JOIN aliases AS al ON (al.id = a.user_id AND (al.type='a_vie' OR al.type='alias'))
+ WHERE al.alias = {?}", $username);
-if ((Env::get('submit') == 'Valider' or Env::get('submit') == 'Modifier') and Env::has('url')) {
- if ($globals->xdb->execute('UPDATE auth_user_quick SET redirecturl = {?} WHERE user_id = {?}',
- $url, Session::getInt('uid')))
- {
- $log->log('carva_add', 'http://'.Env::get('url'));
- $page->trig("Redirection activée vers <a href='http://$url'>$url</a>");
+if ($url = $res->fetchOneCell()) {
+ $url = preg_replace('@/+$@', '', $url);
+ if ($path) {
+ http_redirect("http://$url/$path");
} else {
- $page->trig('Erreur de mise à jour');
- }
-} elseif (Env::get('submit') == "Supprimer") {
- if ($globals->xdb->execute("UPDATE auth_user_quick SET redirecturl = '' WHERE user_id = {?}", Session::getInt('uid')))
- {
- $log->log("carva_del", $url);
- Post::kill('url');
- $page->trig('Redirection supprimée');
- } else {
- $page->trig('Erreur de suppression');
+ http_redirect("http://$url");
}
}
+header("HTTP/1.0 404 Not Found");
-$res = $globals->xdb->query('SELECT redirecturl FROM auth_user_quick WHERE user_id = {?}', Session::getInt('uid'));
-$page->assign('carva', $res->fetchOneCell());
-
-$page->run();
?>
+<!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>