/** * Create the controller coresponding to the request if the access is granted * @param Request $p_oRequest User request * @return Controller Associated controller * @throws Error */ private function createController($p_oRequest) { // Create current user $oCurrentUser = new User(); $oCurrentUser->loadFromSession(); if ($p_oRequest->existParam('p')) { $this->sPage = strtolower($p_oRequest->getParam('p')); } elseif ($oCurrentUser->checkAccess('search')) { $this->sPage = 'search'; } else { $this->sPage = 'login'; } // Check for access if (!$oCurrentUser->checkAccess($this->sPage)) { throw new Error('FRAMEWORK_ERROR_ACCESS_PRIVILEGE', 2); } // Create controller $sControllerClass = "Controller" . ucfirst($this->sPage); $this->oController = new $sControllerClass($p_oRequest); $this->oController->setCurrentUser($oCurrentUser); }