/** * Run Router! * * @access public * @return void */ public function runRouter() { // It displays the banishment if a banned IP address is found. if (Ban::isIp(Ip::get())) { \PH7\Framework\Page\Page::banned(); } // The maintenance page is not displayed for the module "Admin" hen and the administrator is logged. if (DbConfig::getSetting('siteStatus') === DbConfig::MAINTENANCE_SITE && !\PH7\AdminCore::auth() && $this->oRegistry->module !== PH7_ADMIN_MOD) { \PH7\Framework\Page\Page::maintenance(3600); // 1 hour for the duration time of the Service Unavailable HTTP status. } $this->_pathInitialize(); /***** FULL PATH OF MODULE FILE *****/ $this->oRegistry->path_module_controller = $this->oRegistry->path_module_controllers . $this->oRegistry->controller . '.php'; /***** FOR FILE CONFIG .INI OF MODULE *****/ $this->oConfig->load($this->oRegistry->path_module . PH7_DS . PH7_CONFIG . PH7_CONFIG_FILE); define('PH7_DEFAULT_TPL_MOD', $this->oConfig->values['module']['default_theme']); $this->_templateInitialize(); if (is_file($this->oRegistry->path_module_controller)) { // For additional options modules if (is_file($this->oRegistry->path_module . 'Bootstrap.php')) { require_once $this->oRegistry->path_module . 'Bootstrap.php'; } // Include Bootstrap Module if there exists require_once $this->oRegistry->path_module_controller; $sController = 'PH7\\' . $this->oRegistry->controller; $oCtrl = new $sController(); if ((new \ReflectionClass($oCtrl))->hasMethod($this->oRegistry->action)) { if ((new \ReflectionMethod($oCtrl, $this->oRegistry->action))->isPublic()) { // And finally there is more to perform the action call_user_func_array(array($oCtrl, $this->oRegistry->action), $this->getRequestParameter()); } else { $this->notFound('The <b>' . $this->oRegistry->action . '</b> method is not public!', 1); } } else { $this->notFound('The method <b>' . $this->oRegistry->action . '</b> of controller does not exist', 1); } unset($oCtrl); // Destruction of the object and minimize CPU resources } else { $this->notFound('The <b>' . $this->oRegistry->controller . '</b> controller of the <b>' . $this->oRegistry->module . '</b> module is not found.<br />File: <b>' . $this->oRegistry->path_module . '</b>', 1); } }
/** * Check if the site has been banned for the visitor. * Displays the banishment page if a banned IP address is found. * * @return void If banned, exit the script after displaying the ban page. */ private final function _checkBanStatus() { if (Ban::isIp(Ip::get())) { \PH7\Framework\Page\Page::banned(); } }