fix(i18n): switch le domaine si le server_name n'est pas trouvée dans l'url déclarée
This commit is contained in:
parent
14e8a6ebd6
commit
4c24f4e48d
@ -55,13 +55,19 @@ $server_names= array('expolibre.org', 'www.expolibre.org', 'libreexpo.org', 'www
|
||||
if (!isset ($_SERVER['HTTP_REFERER']) or (
|
||||
strrpos ($_SERVER['HTTP_REFERER'], 'expolibre.org') === false and
|
||||
strrpos ($_SERVER['HTTP_REFERER'], 'libreexpo.org') === false)) {
|
||||
|
||||
# if we are deep in the tree we don't upgrade language: it may be choosen
|
||||
if ($current_dir == "expolibre.org") {
|
||||
$current_dir= $registered_languages['fr']['loc'];
|
||||
$prefered_dir= $registered_languages[prefered_language ()]['loc'];
|
||||
if (basename($current_dir) != basename ($prefered_dir)) {
|
||||
header ("Location: " . url_translate ($_SERVER['REQUEST_URI'], prefered_language ()));
|
||||
}
|
||||
# if we are not on the good domain
|
||||
if ($prefered_dir and false === strpos($prefered_dir, $_SERVER['SERVER_NAME'])) {
|
||||
header ("Location: " . url_translate ($_SERVER['REQUEST_URI'], prefered_language ()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
Loading…
Reference in New Issue
Block a user