/** * disablePages event listener * * @param iMSCP_Events_Event $event * @return void */ public function disablePages($event) { $requestPage = $_SERVER['SCRIPT_NAME']; foreach ($this->disabledPages as $page) { if (preg_match("~{$page}~i", $requestPage)) { showNotFoundErrorPage(); } } if (iMSCP_Registry::isRegistered('navigation')) { /** @var Zend_Navigation $navigation */ $navigation = iMSCP_Registry::get('navigation'); foreach ($this->disabledPages as $page) { $pages = $navigation->findAllBy('uri', "~{$page}~i", true, true); foreach ($pages as $page) { $navigation->removePage($page, true); } } } }
$eventsManager = iMSCP_Events_Aggregator::getInstance(); if (($urlComponents = parse_url($_SERVER['REQUEST_URI'])) !== false) { $responses = $eventsManager->dispatch(iMSCP_Events::onBeforePluginsRoute, array('pluginManager' => $pluginManager)); if (!$responses->isStopped()) { foreach ($plugins as $plugin) { if ($scriptPath = $plugin->route($urlComponents)) { break; } foreach ($plugin->getRoutes() as $pluginRoute => $pluginControllerPath) { if ($pluginRoute == $urlComponents['path']) { $scriptPath = $pluginControllerPath; $_SERVER['SCRIPT_NAME'] = $pluginRoute; break; } } if ($scriptPath) { break; } } $eventsManager->dispatch(iMSCP_Events::onAfterPluginsRoute, array('pluginManager' => $pluginManager, 'scriptPath' => $scriptPath)); if ($scriptPath) { include_once $scriptPath; exit; } } } else { throw new iMSCP_Exception(sprintf('Unable to parse URL: %s', $_SERVER['REQUEST_URI'])); } } showNotFoundErrorPage();