From b48860d74f240974b5e92cabb09bc0292301e9e9 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 19 Dec 2006 04:43:56 +0000 Subject: [PATCH] Tad cleaner code for the determining of requests and actions --- Router.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Router.php b/Router.php index 8f9b642..55704fc 100644 --- a/Router.php +++ b/Router.php @@ -107,8 +107,8 @@ class BSRouter { if ((defined('ISSO_ROUTER_NO_REWRITE') AND constant('ISSO_ROUTER_NO_REWRITE')) OR isset($_REQUEST['controller'])) { - $this->request = $_REQUEST['controller']; - $this->action = ((!isset($_REQUEST['action']) OR empty($_REQUEST['action'])) ? 'Index' : $_REQUEST['action']); + $this->request = (isset($_REQUEST['controller']) ? $_REQUEST['controller'] : ''); + $this->action = (isset($_REQUEST['action']) ? $_REQUEST['action'] : ''); $this->params = $_GET; } else @@ -118,7 +118,7 @@ class BSRouter $params = explode('/', $request); $request = explode('.', $params[0]); $this->request = $request[0]; - $this->action = ((!isset($request[1]) OR empty($request[1])) ? 'Index' : $request[1]); + $this->action = (isset($request[1]) ? $request[1] : ''); unset($params[0]); if (sizeof($params) == 0) @@ -166,6 +166,9 @@ class BSRouter } } + $this->request = (empty($this->request) ? 'Index' : $this->request); + $this->action = (empty($this->action) ? 'Index' : $this->action); + if (isset($this->map[ $this->request ])) { call_user_func_array(array($this, $this->map[ $this->request ][self::MAP_LOADER]), $this->map[ $this->request ][self::MAP_PARAMS]); -- 2.22.5