summaryrefslogtreecommitdiff
path: root/includes/locale.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/locale.inc')
-rw-r--r--includes/locale.inc14
1 files changed, 10 insertions, 4 deletions
diff --git a/includes/locale.inc b/includes/locale.inc
index 6154cf3c3..02653a3c5 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -207,10 +207,16 @@ function locale_language_from_url($languages) {
case LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN:
foreach ($languages as $language) {
- $host = parse_url($language->domain, PHP_URL_HOST);
- if ($host && ($_SERVER['HTTP_HOST'] == $host)) {
- $language_url = $language->language;
- break;
+ // Skip check if the language doesn't have a domain.
+ if ($language->domain) {
+ // Only compare the domains not the protocols or ports.
+ // 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) {
+ $language_url = $language->language;
+ break;
+ }
}
}
break;