- Patch #144634 by chx: fixed critical bug that prevented language negotiation to work after/when drupal_goto() is called.

6.x
Dries Buytaert 2007-10-02 16:03:17 +00:00
parent ec75cf33fd
commit c389c90529
12 changed files with 370 additions and 365 deletions

View File

@ -1197,6 +1197,8 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL
* as in an RSS feed.
* 'alias' (default FALSE)
* Whether the given path is an alias already.
* 'external'
* Whether the given path is an external URL.
* @return
* a string containing a URL to the given path.
*
@ -1211,6 +1213,12 @@ function url($path = NULL, $options = array()) {
'absolute' => FALSE,
'alias' => FALSE,
);
if (!isset($options['external'])) {
// Return an external link if $path contains an allowed absolute URL.
// Only call the slow filter_xss_bad_protocol if $path contains a ':' before any / ? or #.
$colonpos = strpos($path, ':');
$options['external'] = ($colonpos !== FALSE && !preg_match('![/?#]!', substr($path, 0, $colonpos)) && filter_xss_bad_protocol($path, FALSE) == check_plain($path));
}
// May need language dependant rewriting if language.inc is present
if (function_exists('language_url_rewrite')) {
@ -1223,10 +1231,7 @@ function url($path = NULL, $options = array()) {
$options['query'] = drupal_query_string_encode($options['query']);
}
// Return an external link if $path contains an allowed absolute URL.
// Only call the slow filter_xss_bad_protocol if $path contains a ':' before any / ? or #.
$colonpos = strpos($path, ':');
if ($colonpos !== FALSE && !preg_match('![/?#]!', substr($path, 0, $colonpos)) && filter_xss_bad_protocol($path, FALSE) == check_plain($path)) {
if ($options['external']) {
// Split off the fragment
if (strpos($path, '#') !== FALSE) {
list($path, $old_fragment) = explode('#', $path, 2);

View File

@ -100,7 +100,7 @@ function language_url_rewrite(&$path, &$options) {
global $language;
// Only modify relative (insite) URLs.
if (!$options['absolute']) {
if (!$options['external']) {
// Language can be passed as an option, or we go for current language.
$path_language = isset($options['language']) ? $options['language'] : $language;