summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-10-02 16:03:17 +0000
committerDries Buytaert <dries@buytaert.net>2007-10-02 16:03:17 +0000
commitc389c90529d45b33c21f55fc7b7f4539fcea762c (patch)
tree3ad0730e32a2cc9d57af693b170ee41265506a9b /includes
parentec75cf33fd083092b5b9f7b6f3f30fe0102dd734 (diff)
downloadbrdo-c389c90529d45b33c21f55fc7b7f4539fcea762c.tar.gz
brdo-c389c90529d45b33c21f55fc7b7f4539fcea762c.tar.bz2
- Patch #144634 by chx: fixed critical bug that prevented language negotiation to work after/when drupal_goto() is called.
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc27
-rw-r--r--includes/language.inc2
2 files changed, 17 insertions, 12 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 40efc961a..080d95681 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -311,8 +311,8 @@ function drupal_goto($path = '', $query = NULL, $fragment = NULL, $http_response
// data will be written to the database before the header is sent to the
// browser.
register_shutdown_function('header', "Location: $url", TRUE, $http_response_code);
-
- // Make sure none of the code below the drupal_goto() call gets executed.
+
+ // Make sure none of the code below the drupal_goto() call gets executed.
exit();
}
@@ -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.
*
@@ -1206,11 +1208,17 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL
function url($path = NULL, $options = array()) {
// Merge in defaults
$options += array(
- 'fragment' => '',
- 'query' => '',
- 'absolute' => FALSE,
- 'alias' => FALSE,
- );
+ 'fragment' => '',
+ 'query' => '',
+ '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);
diff --git a/includes/language.inc b/includes/language.inc
index acf4c4607..9618e1402 100644
--- a/includes/language.inc
+++ b/includes/language.inc
@@ -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;