aboutsummaryrefslogtreecommitdiffstats
path: root/langs.inc.php
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2012-12-21 14:10:51 +0000
committerRomain d'Alverny <rda@mageia.org>2012-12-21 14:10:51 +0000
commit535b656a6f73fafc984a872450ef05fa6ea3115f (patch)
tree5a59d6ca1066907661c3317979ff70034216fab0 /langs.inc.php
parentfffb973b83c07a577b853d05e30c3ccf85a610fe (diff)
downloadwww-535b656a6f73fafc984a872450ef05fa6ea3115f.tar
www-535b656a6f73fafc984a872450ef05fa6ea3115f.tar.gz
www-535b656a6f73fafc984a872450ef05fa6ea3115f.tar.bz2
www-535b656a6f73fafc984a872450ef05fa6ea3115f.tar.xz
www-535b656a6f73fafc984a872450ef05fa6ea3115f.zip
add test file for browser language
Diffstat (limited to 'langs.inc.php')
-rw-r--r--langs.inc.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/langs.inc.php b/langs.inc.php
index 23a207367..57a32fc0b 100644
--- a/langs.inc.php
+++ b/langs.inc.php
@@ -95,10 +95,11 @@ function domain_redirect($host, $domains_lang, $vhost)
* @param string $page optional path to which we want to redirect
* @param string $default_locale
* @param string $force_accept_language replace remote browser HTTP_ACCEPT_LANGUAGE request header
+ * @param boolean $do_redirect
*
* @return string
*/
-function relocate($langs, $page = '', $default_locale = 'en', $force_accept_language = null)
+function relocate($langs, $page = '', $default_locale = 'en', $force_accept_language = null, $do_redirect = true)
{
require_once 'localeDetection.class.php';
@@ -108,9 +109,10 @@ function relocate($langs, $page = '', $default_locale = 'en', $force_accept_lang
$relocate = sprintf('/%s/%s', $locale->getCompatibleLocale(), $page);
$relocate = str_replace('//', '/', $relocate);
- if ('cli' != PHP_SAPI) {
+ if ('cli' != PHP_SAPI && do_redirect) {
header('Location: ' . $relocate);
}
+
return $relocate;
}