summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-15 16:18:46 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-15 16:18:46 +0000
commite1642603eac05665d959c3d63ea8d1efbe9e431a (patch)
treeb927cc0b278e90594310d8291091d76af9c57d40 /includes
parentc7557262b3ac01f40613dd6141ef09d1ae7b84ba (diff)
downloadbrdo-e1642603eac05665d959c3d63ea8d1efbe9e431a.tar.gz
brdo-e1642603eac05665d959c3d63ea8d1efbe9e431a.tar.bz2
#216098 by kwinters, jgoldberg, drawk, sun: Make drupal_goto() use the same parameters as url().
Diffstat (limited to 'includes')
-rw-r--r--includes/batch.inc2
-rw-r--r--includes/common.inc32
-rw-r--r--includes/form.inc2
3 files changed, 19 insertions, 17 deletions
diff --git a/includes/batch.inc b/includes/batch.inc
index c0833208f..10fc2a737 100644
--- a/includes/batch.inc
+++ b/includes/batch.inc
@@ -447,7 +447,7 @@ function _batch_finished() {
$_SESSION['batch_form_state'] = $_batch['form_state'];
$function = $_batch['redirect_callback'];
if (function_exists($function)) {
- $function($_batch['source_url'], array('op' => 'finish', 'id' => $_batch['id']));
+ $function($_batch['source_url'], array('query' => array('op' => 'finish', 'id' => $_batch['id'])));
}
}
}
diff --git a/includes/common.inc b/includes/common.inc
index 9bc5e335b..c3939b9cb 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -620,14 +620,13 @@ function drupal_encode_path($path) {
* Drupal will ensure that messages set by drupal_set_message() and other
* session data are written to the database before the user is redirected.
*
- * This function ends the request; use it instead of a return in your menu callback.
+ * This function ends the request; use it instead of a return in your menu
+ * callback.
*
* @param $path
* A Drupal path or a full URL.
- * @param $query
- * A query string component, if any.
- * @param $fragment
- * A destination fragment identifier (named anchor).
+ * @param $options
+ * An associative array of additional URL options to pass to url().
* @param $http_response_code
* Valid values for an actual "goto" as per RFC 2616 section 10.3 are:
* - 301 Moved Permanently (the recommended value for most redirects)
@@ -639,22 +638,25 @@ function drupal_encode_path($path) {
* - 307 Temporary Redirect (alternative to "503 Site Down for Maintenance")
* Note: Other values are defined by RFC 2616, but are rarely used and poorly
* supported.
+ *
* @see drupal_get_destination()
+ * @see url()
*/
-function drupal_goto($path = '', array $query = array(), $fragment = NULL, $http_response_code = 302) {
+function drupal_goto($path = '', array $options = array(), $http_response_code = 302) {
+ // A destination in $_GET always overrides the function arguments.
if (isset($_GET['destination'])) {
- extract(drupal_parse_url(urldecode($_GET['destination'])));
+ $destination = drupal_parse_url(urldecode($_GET['destination']));
+ $path = $destination['path'];
+ $options['query'] = $destination['query'];
+ $options['fragment'] = $destination['fragment'];
}
- $args = array(
- 'path' => &$path,
- 'query' => &$query,
- 'fragment' => &$fragment,
- 'http_response_code' => &$http_response_code,
- );
- drupal_alter('drupal_goto', $args);
+ drupal_alter('drupal_goto', $path, $options, $http_response_code);
+
+ // The 'Location' HTTP header must be absolute.
+ $options['absolute'] = TRUE;
- $url = url($path, array('query' => $query, 'fragment' => $fragment, 'absolute' => TRUE));
+ $url = url($path, $options);
header('Location: ' . $url, TRUE, $http_response_code);
diff --git a/includes/form.inc b/includes/form.inc
index 20b3230b9..207a48c0a 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -3065,7 +3065,7 @@ function batch_process($redirect = NULL, $url = 'batch', $redirect_callback = 'd
$function = $batch['redirect_callback'];
if (function_exists($function)) {
- $function($batch['url'], array('op' => 'start', 'id' => $batch['id']));
+ $function($batch['url'], array('query' => array('op' => 'start', 'id' => $batch['id'])));
}
}
else {