From e26e7aaeab869656cb0a42e2e02862a30a9e6e42 Mon Sep 17 00:00:00 2001 From: Neil Blakey-Milner Date: Tue, 31 Jan 2006 11:16:14 +0000 Subject: [PATCH] Allow for forms to set buttons to the kt_cancel request variable, allowing for a redirect to a given URL. kt_cancel is expected to be an associative array with a single key/value pair. The redirected URL is the key. --- lib/dispatcher.inc.php | 9 +++++++++ 1 file changed, 9 insertions(+), 0 deletions(-) diff --git a/lib/dispatcher.inc.php b/lib/dispatcher.inc.php index ca768a4..4e4ffb0 100644 --- a/lib/dispatcher.inc.php +++ b/lib/dispatcher.inc.php @@ -13,6 +13,7 @@ class KTDispatchStandardRedirector { class KTDispatcher { var $event_var = "action"; + var $cancel_var = "kt_cancel"; var $bAutomaticTransaction = false; var $bTransactionStarted = false; var $oValidator = null; @@ -23,6 +24,14 @@ class KTDispatcher { } function dispatch () { + if (array_key_exists($this->cancel_var, $_REQUEST)) { + $var = $_REQUEST[$this->cancel_var]; + if (is_array($var)) { + $keys = array_keys($var); + redirect($keys[0]); + exit(0); + } + } $method = 'do_main'; if (array_key_exists($this->event_var, $_REQUEST)) { $event = $_REQUEST[$this->event_var]; -- libgit2 0.21.4