summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-07-20 10:48:20 +0000
committerDries Buytaert <dries@buytaert.net>2005-07-20 10:48:20 +0000
commit31387c5a77f6331a65360ddc9acd1e8053da2e3f (patch)
tree8781ead559d92cd2a4caa93d8ceeb7fbaa65e588 /includes
parent02ca763ea0e93e7b0bb9cf13e2d9810e753c982c (diff)
downloadbrdo-31387c5a77f6331a65360ddc9acd1e8053da2e3f.tar.gz
brdo-31387c5a77f6331a65360ddc9acd1e8053da2e3f.tar.bz2
- Patch #26467 by drumm: make the destination persist across multiple pages
and fixed the node delete form to use a return destination.
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc24
1 files changed, 16 insertions, 8 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 6f4353e29..7c5971087 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -133,20 +133,28 @@ function drupal_get_headers() {
/**
* Prepare a destination query string for use in combination with
- * drupal_goto(). Used to direct the user back to the referring page
- * after completing a form.
+ * drupal_goto(). Used to direct the user back to the referring page
+ * after completing a form. By default the current URL is returned.
+ * If a destination exists in the previous request, that destination
+ * is returned. As such, a destination can persist across multiple
+ * pages.
*
* @see drupal_goto()
*/
function drupal_get_destination() {
- $destination[] = $_GET['q'];
- $params = array('page', 'sort', 'order');
- foreach ($params as $param) {
- if (isset($_GET[$param])) {
- $destination[] = "$param=". $_GET[$param];
+ if ($_REQUEST['destination']) {
+ return 'destination='. urlencode($_REQUEST['destination']);
+ }
+ else {
+ $destination[] = $_GET['q'];
+ $params = array('page', 'sort', 'order');
+ foreach ($params as $param) {
+ if (isset($_GET[$param])) {
+ $destination[] = "$param=". $_GET[$param];
+ }
}
+ return 'destination='. urlencode(implode('&', $destination));
}
- return 'destination='. urlencode(implode('&', $destination));
}
/**