summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-11-29 14:42:31 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-11-29 14:42:31 +0000
commit5395f208d38df7091efb4d7f827d0b13d3dffc09 (patch)
tree5ca7567c45b9c2867f9098e6a93642319e9407eb
parenta35fb53e7209614421c6fce51b6f468d13b99312 (diff)
downloadbrdo-5395f208d38df7091efb4d7f827d0b13d3dffc09.tar.gz
brdo-5395f208d38df7091efb4d7f827d0b13d3dffc09.tar.bz2
#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
-rw-r--r--includes/common.inc8
-rw-r--r--includes/language.inc14
2 files changed, 13 insertions, 9 deletions
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 '<front>' links to the default front page.
if (!empty($path) && $path != '<front>') {
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 == '<front>')) ? $path_language->prefix : $path_language->prefix .'/'. $path;
}
break;