Merge pull request 'fix(i18n): switch le domaine si le server_name n'est pas trouvée dans l'url déclarée' (#1) from PoluX/Expolibre-3-www:master into master

This commit is contained in:
Christian P. MOMON 2020-04-18 18:55:23 +02:00
commit a31af59752

View File

@ -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 ()));
}
}
}
?>
?>