From 5395f208d38df7091efb4d7f827d0b13d3dffc09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Thu, 29 Nov 2007 14:42:31 +0000 Subject: #194743 by myself, reported and tested by Murz: the base URL was not properly modified for outgoing links to different language domains and path aliases were not handled in the target language --- includes/common.inc | 8 ++++++-- includes/language.inc | 14 +++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'includes') diff --git a/includes/common.inc b/includes/common.inc index b101ddc56..6455bdb71 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -1285,7 +1285,11 @@ function url($path = NULL, $options = array()) { $clean_url = (bool)variable_get('clean_url', '0'); } - $base = $options['absolute'] ? $base_url .'/' : base_path(); + if (!isset($options['base_url'])) { + // The base_url might be rewritten from the language rewrite in domain mode. + $options['base_url'] = $base_url; + } + $base = $options['absolute'] ? $options['base_url'] .'/' : base_path(); // Preserve the original path before aliasing. $original_path = $path; @@ -1293,7 +1297,7 @@ function url($path = NULL, $options = array()) { // The special path '' links to the default front page. if (!empty($path) && $path != '') { if (!$options['alias']) { - $path = drupal_get_path_alias($path); + $path = drupal_get_path_alias($path, isset($options['langcode']) ? $options['langcode'] : ''); } if (function_exists('custom_url_rewrite_outbound')) { // Modules may alter outbound links by reference. diff --git a/includes/language.inc b/includes/language.inc index 103b59d26..de4ef393a 100644 --- a/includes/language.inc +++ b/includes/language.inc @@ -111,8 +111,11 @@ function language_url_rewrite(&$path, &$options) { case LANGUAGE_NEGOTIATION_DOMAIN: if ($path_language->domain) { - $options['external'] = TRUE; - $path = $path_language->domain .'/'. $path; + // Ask for an absolute URL with our modified base_url. + $options['absolute'] = TRUE; + $options['base_url'] = $path_language->domain; + // Ensure that path alias generation will use this language. + $options['langcode'] = $path_language->language; } break; @@ -125,11 +128,8 @@ function language_url_rewrite(&$path, &$options) { case LANGUAGE_NEGOTIATION_PATH: if (isset($path_language->prefix) && $path_language->prefix) { - // Get alias if not already aliased. - if (!$options['alias']) { - $path = drupal_get_path_alias($path, $path_language->language); - $options['alias'] = TRUE; - } + // Ensure that path alias generation will use this language. + $options['langcode'] = $path_language->language; $path = (empty($path) || ($path == '')) ? $path_language->prefix : $path_language->prefix .'/'. $path; } break; -- cgit v1.2.3