From 4777845d4f0db2684eaaa036318c593b02663eef Mon Sep 17 00:00:00 2001 From: David Rothstein Date: Sat, 9 Jun 2012 16:16:19 -0400 Subject: Issue #1572394 by attiks, Sweetchuck: Fixed Language detection by domain only works on port 80. --- includes/locale.inc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'includes') diff --git a/includes/locale.inc b/includes/locale.inc index 7fb8d6424..fde19dd55 100644 --- a/includes/locale.inc +++ b/includes/locale.inc @@ -279,6 +279,12 @@ function locale_language_from_url($languages) { break; case LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN: + // Get only the host, not the port. + $http_host= $_SERVER['HTTP_HOST']; + if (strpos($http_host, ':') !== FALSE) { + $http_host_tmp = explode(':', $http_host); + $http_host = current($http_host_tmp); + } foreach ($languages as $language) { // Skip check if the language doesn't have a domain. if ($language->domain) { @@ -286,7 +292,7 @@ function locale_language_from_url($languages) { // Remove protocol and add http:// so parse_url works $host = 'http://' . str_replace(array('http://', 'https://'), '', $language->domain); $host = parse_url($host, PHP_URL_HOST); - if ($_SERVER['HTTP_HOST'] == $host) { + if ($http_host == $host) { $language_url = $language->language; break; } -- cgit v1.2.3