summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2012-06-09 16:16:19 -0400
committerDavid Rothstein <drothstein@gmail.com>2012-06-09 16:16:19 -0400
commit4777845d4f0db2684eaaa036318c593b02663eef (patch)
tree3596215931e27235da88254f2d715a873f11bc59 /includes
parent988597f0df339cfc22240852d3d130b3718a63a7 (diff)
downloadbrdo-4777845d4f0db2684eaaa036318c593b02663eef.tar.gz
brdo-4777845d4f0db2684eaaa036318c593b02663eef.tar.bz2
Issue #1572394 by attiks, Sweetchuck: Fixed Language detection by domain only works on port 80.
Diffstat (limited to 'includes')
-rw-r--r--includes/locale.inc8
1 files changed, 7 insertions, 1 deletions
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;
}