From 2dd259f469bf2d7a922318f008aa14e4de04996b Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sun, 21 Nov 2010 09:01:30 +0000 Subject: #926212 by plach, bforchhammer: Fixed URLs rewritten with disabled languages --- includes/locale.inc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'includes') diff --git a/includes/locale.inc b/includes/locale.inc index 75e534395..b36bcd9e9 100644 --- a/includes/locale.inc +++ b/includes/locale.inc @@ -321,11 +321,27 @@ function locale_language_switcher_session($type, $path) { * Rewrite URLs for the URL language provider. */ function locale_language_url_rewrite_url(&$path, &$options) { + static $drupal_static_fast; + if (!isset($drupal_static_fast)) { + $drupal_static_fast['languages'] = &drupal_static(__FUNCTION__); + } + $languages = &$drupal_static_fast['languages']; + + if (!isset($languages)) { + $languages = language_list('enabled'); + $languages = array_flip(array_keys($languages[1])); + } + // Language can be passed as an option, or we go for current URL language. if (!isset($options['language'])) { global $language_url; $options['language'] = $language_url; } + // We allow only enabled languages here. + elseif (!isset($languages[$options['language']->language])) { + unset($options['language']); + return; + } if (isset($options['language'])) { switch (variable_get('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX)) { -- cgit v1.2.3