public function run() { for ($i = 0, $c = false; $i < 2 && !$c; $i++) { $controller = $this->request->find(0); $controller = Functions::seoUrlReverse($controller); $controller = __NAMESPACE__ . "\\" . ucfirst($controller) . "Controller"; if (!class_exists($controller)) { if ($i > 0) { Response::sendStatus(404); } $this->request->insert(0, "web"); } else { $this->controller = new $controller($this->request); $c = true; // for ($j = 0, $a = false; $j < 2 && !$a; $j++) { for ($j = 0, $a = false; $j < 3 && !$a; $j++) { $action = $this->request->find(1); if ($j == 0) { $action .= "_" . $this->request->find(2); } $action = Functions::seoUrlReverse($action); if (!Functions::isCallable($this->controller, $action)) { // if ($j > 0) if ($j > 1) { Response::sendStatus(404); } if ($j > 0) { $this->request->insert(1, "index"); } } else { if (!$this->controller->auth()) { Response::sendStatus(401); } $this->controller->{$action}(); $a = true; } } } } }