summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2011-10-01 15:44:35 -0400
committerDries Buytaert <dries@buytaert.net>2011-10-01 15:44:35 -0400
commitc8e7100a060ffc9f60604caa373f5c57883b4bfb (patch)
tree843e371031de8db8d829ce417dac093a62c5140f /includes
parent6395a07329e9a67e7750b7b9023d1479e577980f (diff)
downloadbrdo-c8e7100a060ffc9f60604caa373f5c57883b4bfb.tar.gz
brdo-c8e7100a060ffc9f60604caa373f5c57883b4bfb.tar.bz2
- Patch #1250800 by attiks, dereine: language domain should work regardless of ports or protocols.
Diffstat (limited to 'includes')
-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;