_getDefaultPath()); $this->getFront()->setDefault(array( 'module' => !empty($d[0]) ? $d[0] : '', 'controller' => !empty($d[1]) ? $d[1] : 'index', 'action' => !empty($d[2]) ? $d[2] : 'index' )); } /** * Get router default request path * @return string */ protected function _getDefaultPath() { return (string)Mage::getConfig()->getNode('default/web/default/admin'); } /** * dummy call to pass through checking * * @return unknown */ protected function _beforeModuleMatch() { return true; } /** * checking if we installed or not and doing redirect * * @return bool */ protected function _afterModuleMatch() { if (!Mage::isInstalled()) { Mage::app()->getFrontController()->getResponse() ->setRedirect(Mage::getUrl('install')) ->sendResponse(); exit; } return true; } /** * We need to have noroute action in this router * not to pass dispatching to next routers * * @return bool */ protected function _noRouteShouldBeApplied() { return true; } /** * Check whether URL for corresponding path should use https protocol * * @param string $path * @return bool */ protected function _shouldBeSecure($path) { return substr((string)Mage::getConfig()->getNode('default/web/unsecure/base_url'), 0, 5) === 'https' || Mage::getStoreConfigFlag('web/secure/use_in_adminhtml', Mage_Core_Model_App::ADMIN_STORE_ID) && substr((string)Mage::getConfig()->getNode('default/web/secure/base_url'), 0, 5) === 'https'; } /** * Retrieve current secure url * * @param Mage_Core_Controller_Request_Http $request * @return string */ protected function _getCurrentSecureUrl($request) { return Mage::app()->getStore(Mage_Core_Model_App::ADMIN_STORE_ID) ->getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/'); } /** * Emulate custom admin url * * @param string $configArea * @param bool $useRouterName */ public function collectRoutes($configArea, $useRouterName) { if ((string)Mage::getConfig()->getNode(Mage_Adminhtml_Helper_Data::XML_PATH_USE_CUSTOM_ADMIN_PATH)) { $customUrl = (string)Mage::getConfig()->getNode(Mage_Adminhtml_Helper_Data::XML_PATH_CUSTOM_ADMIN_PATH); $xmlPath = Mage_Adminhtml_Helper_Data::XML_PATH_ADMINHTML_ROUTER_FRONTNAME; if ((string)Mage::getConfig()->getNode($xmlPath) != $customUrl) { Mage::getConfig()->setNode($xmlPath, $customUrl, true); } } parent::collectRoutes($configArea, $useRouterName); } /** * Add module definition to routes. * * @param string $frontName * @param mixed $moduleName * @param string $routeName * @return $this */ public function addModule($frontName, $moduleName, $routeName) { $isExtensionsCompatibilityMode = (bool)(string)Mage::getConfig()->getNode( 'default/admin/security/extensions_compatibility_mode' ); $configRouterFrontName = (string)Mage::getConfig()->getNode( Mage_Adminhtml_Helper_Data::XML_PATH_ADMINHTML_ROUTER_FRONTNAME ); if ($isExtensionsCompatibilityMode || ($frontName == $configRouterFrontName)) { return parent::addModule($frontName, $moduleName, $routeName); } else { return $this; } } /** * Check if current controller instance is allowed in current router. * * @param Mage_Core_Controller_Varien_Action $controllerInstance * @return boolean */ protected function _validateControllerInstance($controllerInstance) { return true; } }