- Patch #144634 by chx: fixed critical bug that prevented language negotiation to work after/when drupal_goto() is called.
parent
ec75cf33fd
commit
c389c90529
|
@ -1197,6 +1197,8 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL
|
||||||
* as in an RSS feed.
|
* as in an RSS feed.
|
||||||
* 'alias' (default FALSE)
|
* 'alias' (default FALSE)
|
||||||
* Whether the given path is an alias already.
|
* Whether the given path is an alias already.
|
||||||
|
* 'external'
|
||||||
|
* Whether the given path is an external URL.
|
||||||
* @return
|
* @return
|
||||||
* a string containing a URL to the given path.
|
* a string containing a URL to the given path.
|
||||||
*
|
*
|
||||||
|
@ -1211,6 +1213,12 @@ function url($path = NULL, $options = array()) {
|
||||||
'absolute' => FALSE,
|
'absolute' => FALSE,
|
||||||
'alias' => 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
|
// May need language dependant rewriting if language.inc is present
|
||||||
if (function_exists('language_url_rewrite')) {
|
if (function_exists('language_url_rewrite')) {
|
||||||
|
@ -1223,10 +1231,7 @@ function url($path = NULL, $options = array()) {
|
||||||
$options['query'] = drupal_query_string_encode($options['query']);
|
$options['query'] = drupal_query_string_encode($options['query']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return an external link if $path contains an allowed absolute URL.
|
if ($options['external']) {
|
||||||
// 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)) {
|
|
||||||
// Split off the fragment
|
// Split off the fragment
|
||||||
if (strpos($path, '#') !== FALSE) {
|
if (strpos($path, '#') !== FALSE) {
|
||||||
list($path, $old_fragment) = explode('#', $path, 2);
|
list($path, $old_fragment) = explode('#', $path, 2);
|
||||||
|
|
|
@ -100,7 +100,7 @@ function language_url_rewrite(&$path, &$options) {
|
||||||
global $language;
|
global $language;
|
||||||
|
|
||||||
// Only modify relative (insite) URLs.
|
// Only modify relative (insite) URLs.
|
||||||
if (!$options['absolute']) {
|
if (!$options['external']) {
|
||||||
|
|
||||||
// Language can be passed as an option, or we go for current language.
|
// Language can be passed as an option, or we go for current language.
|
||||||
$path_language = isset($options['language']) ? $options['language'] : $language;
|
$path_language = isset($options['language']) ? $options['language'] : $language;
|
||||||
|
|
Loading…
Reference in New Issue