fix(i18n): switch le domaine si le server_name n'est pas trouvée dans l'url déclarée #1

Merged
Cpm merged 1 commits from :master into master 2020-04-18 18:55:32 +02:00
Showing only changes of commit 4c24f4e48d - Show all commits

View File

@ -55,12 +55,18 @@ $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 ()));
}
}
}