2015-05-13 09:48:23 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// List here the supported languages :
|
|
|
|
$otherlang=array(
|
|
|
|
"fr" => "Français",
|
|
|
|
"en" => "English"
|
|
|
|
);
|
|
|
|
|
|
|
|
$uri=trim($_SERVER["REQUEST_URI"],"/");
|
|
|
|
|
|
|
|
// auto lang redirect:
|
|
|
|
if (!$uri) {
|
|
|
|
$lang="en";
|
2015-05-13 10:07:29 +00:00
|
|
|
if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
|
|
|
|
$l=substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2);
|
2015-05-13 09:48:23 +00:00
|
|
|
if (isset($otherlang[$l])) {
|
|
|
|
$lang=$l;
|
|
|
|
}
|
|
|
|
}
|
2015-05-13 10:03:13 +00:00
|
|
|
header("Location: /".$lang."/");
|
2015-05-13 09:48:23 +00:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
list($lang,$uri)=explode("/",$uri,2);
|
|
|
|
|
|
|
|
|
|
|
|
if (!isset($otherlang[$lang])) {
|
|
|
|
header("HTTP/1.0 404 Not Found");
|
|
|
|
echo "<h1>Lang not supported</h1>";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
unset($otherlang[$lang]);
|
|
|
|
|
|
|
|
// Now we spit the proper page:
|
|
|
|
switch ($uri) {
|
|
|
|
case "install":
|
|
|
|
require_once("install.php");
|
|
|
|
exit();
|
|
|
|
case "":
|
|
|
|
require_once("home.php");
|
|
|
|
exit();
|
|
|
|
default:
|
|
|
|
header("HTTP/1.0 404 Not Found");
|
|
|
|
echo "<h1>Page not found</h1>";
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|