Commit ef9b4f798a6523547e7db3169c921a52d36fe5d1

Authored by nbm
1 parent 282b6418

Make the process of redirection somewhat controllable, by introducing

the oRedirector attribute to KTDispatcher, which is called when a
redirection is required.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4413 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 9 additions and 1 deletions
lib/dispatcher.inc.php
@@ -5,6 +5,12 @@ require_once(KT_LIB_DIR . '/actions/portletregistry.inc.php'); @@ -5,6 +5,12 @@ require_once(KT_LIB_DIR . '/actions/portletregistry.inc.php');
5 require_once(KT_LIB_DIR . "/widgets/portlet.inc.php"); 5 require_once(KT_LIB_DIR . "/widgets/portlet.inc.php");
6 require_once(KT_LIB_DIR . '/templating/kt3template.inc.php'); 6 require_once(KT_LIB_DIR . '/templating/kt3template.inc.php');
7 7
  8 +class KTDispatchStandardRedirector {
  9 + function redirect($url) {
  10 + redirect($url);
  11 + }
  12 +}
  13 +
8 class KTDispatcher { 14 class KTDispatcher {
9 var $event_var = "action"; 15 var $event_var = "action";
10 var $bAutomaticTransaction = false; 16 var $bAutomaticTransaction = false;
@@ -13,6 +19,7 @@ class KTDispatcher { @@ -13,6 +19,7 @@ class KTDispatcher {
13 19
14 function KTDispatcher() { 20 function KTDispatcher() {
15 $this->oValidator =& new KTDispatcherValidation($this); 21 $this->oValidator =& new KTDispatcherValidation($this);
  22 + $this->oRedirector =& new KTDispatchStandardRedirector($this);
16 } 23 }
17 24
18 function dispatch () { 25 function dispatch () {
@@ -89,7 +96,8 @@ class KTDispatcher { @@ -89,7 +96,8 @@ class KTDispatcher {
89 $sQuery = '?action=' . $event; 96 $sQuery = '?action=' . $event;
90 } 97 }
91 } 98 }
92 - exit(redirect($_SERVER["PHP_SELF"] . $sQuery)); 99 + $this->oRedirector->redirect($_SERVER["PHP_SELF"] . $sQuery);
  100 + exit(0);
93 } 101 }
94 102
95 function errorRedirectToMain($error_message, $sQuery = "") { 103 function errorRedirectToMain($error_message, $sQuery = "") {