public function analyseAskedRequest() { \org\equinox\utils\debug\DebugBarFactory::add($this, 'Request', 'current'); $this->processPost($_POST); if (array_key_exists('PATH_INFO', $_SERVER)) { $ar = @explode('/', $_SERVER["PATH_INFO"]); } else { $ar = array(); // Then calling the root of the site eg : http://www.mysite.com, PATH_INFO is not defined } $size = sizeof($ar); if ($size > 0) { array_shift($ar); // first value is alway empty // \org\equinox\utils\debug\DebugBarFactory::add($ar, 'debug', 'params'); $aliasRoute = @$ar[0]; if (array_key_exists($aliasRoute, $this->aliasRoute)) { array_shift($ar); // we remove the alias route from the liste of parameters $route = $this->aliasRoute[$aliasRoute]; $this->module = $route['module']; $this->controller = $route['controller']; $this->action = $route['action']; $this->processGetParams($ar); } elseif (sizeof($ar) >= 3) { $param1 = $ar[0]; $param2 = $ar[1]; $potentialControllerName = $param1 . '_' . $param2 . 'Controller'; if (\org\equinox\ioc\ContainerFactory::hasBean($potentialControllerName)) { $this->module = array_shift($ar); $this->controller = array_shift($ar); $this->action = array_shift($ar); } else { \org\equinox\utils\debug\DebugBarFactory::add("Cannot find the controller '{$potentialControllerName}'", 'debug', 'Notice'); } $this->processGetParams($ar); } else { $this->processGetParams($ar); } } // else we use the default value defined in the configurations files $this->index = $_SERVER["SCRIPT_NAME"]; $this->base = trim(dirname($_SERVER["SCRIPT_NAME"])); if ($this->base == '/') { $this->base = ''; } if ($this->base == '\\') { $this->base = ''; } }
/** * @return Controller */ protected function getController($module, $controller) { $controllerName = $module . '_' . $controller . 'Controller'; if (\org\equinox\ioc\ContainerFactory::hasBean($controllerName)) { $obj = \org\equinox\ioc\ContainerFactory::getBean($controllerName); $obj->currentModule = $module; $obj->currentController = $controller; return $obj; } else { throw new \org\equinox\exception\EquinoxException("Cannot find {$controllerName} component"); } }