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:
commit
a31af59752
@ -55,12 +55,18 @@ $server_names= array('expolibre.org', 'www.expolibre.org', 'libreexpo.org', 'www
|
|||||||
if (!isset ($_SERVER['HTTP_REFERER']) or (
|
if (!isset ($_SERVER['HTTP_REFERER']) or (
|
||||||
strrpos ($_SERVER['HTTP_REFERER'], 'expolibre.org') === false and
|
strrpos ($_SERVER['HTTP_REFERER'], 'expolibre.org') === false and
|
||||||
strrpos ($_SERVER['HTTP_REFERER'], 'libreexpo.org') === false)) {
|
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") {
|
if ($current_dir == "expolibre.org") {
|
||||||
$current_dir= $registered_languages['fr']['loc'];
|
$current_dir= $registered_languages['fr']['loc'];
|
||||||
$prefered_dir= $registered_languages[prefered_language ()]['loc'];
|
$prefered_dir= $registered_languages[prefered_language ()]['loc'];
|
||||||
if (basename($current_dir) != basename ($prefered_dir)) {
|
if (basename($current_dir) != basename ($prefered_dir)) {
|
||||||
header ("Location: " . url_translate ($_SERVER['REQUEST_URI'], prefered_language ()));
|
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