summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-11-21 09:01:30 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-11-21 09:01:30 +0000
commit2dd259f469bf2d7a922318f008aa14e4de04996b (patch)
treea092266c599e48505fc8cc496be8995c8e9a4e8b /includes
parent1242612ee7a9cc502895f31b3bd9e4b57587f8df (diff)
downloadbrdo-2dd259f469bf2d7a922318f008aa14e4de04996b.tar.gz
brdo-2dd259f469bf2d7a922318f008aa14e4de04996b.tar.bz2
#926212 by plach, bforchhammer: Fixed URLs rewritten with disabled languages
Diffstat (limited to 'includes')
-rw-r--r--includes/locale.inc16
1 files changed, 16 insertions, 0 deletions
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)) {