1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27:
28: class Mage_Core_Controller_Varien_Router_Admin extends Mage_Core_Controller_Varien_Router_Standard
29: {
30: 31: 32:
33: public function fetchDefault()
34: {
35:
36: $d = explode('/', $this->_getDefaultPath());
37: $this->getFront()->setDefault(array(
38: 'module' => !empty($d[0]) ? $d[0] : '',
39: 'controller' => !empty($d[1]) ? $d[1] : 'index',
40: 'action' => !empty($d[2]) ? $d[2] : 'index'
41: ));
42: }
43:
44: 45: 46: 47:
48: protected function _getDefaultPath()
49: {
50: return (string)Mage::getConfig()->getNode('default/web/default/admin');
51: }
52:
53: 54: 55: 56: 57:
58: protected function _beforeModuleMatch()
59: {
60: return true;
61: }
62:
63: 64: 65: 66: 67:
68: protected function _afterModuleMatch()
69: {
70: if (!Mage::isInstalled()) {
71: Mage::app()->getFrontController()->getResponse()
72: ->setRedirect(Mage::getUrl('install'))
73: ->sendResponse();
74: exit;
75: }
76: return true;
77: }
78:
79: 80: 81: 82: 83: 84:
85: protected function _noRouteShouldBeApplied()
86: {
87: return true;
88: }
89:
90: 91: 92: 93: 94: 95:
96: protected function _shouldBeSecure($path)
97: {
98: return substr((string)Mage::getConfig()->getNode('default/web/unsecure/base_url'), 0, 5) === 'https'
99: || Mage::getStoreConfigFlag('web/secure/use_in_adminhtml', Mage_Core_Model_App::ADMIN_STORE_ID)
100: && substr((string)Mage::getConfig()->getNode('default/web/secure/base_url'), 0, 5) === 'https';
101: }
102:
103: 104: 105: 106: 107: 108:
109: protected function _getCurrentSecureUrl($request)
110: {
111: return Mage::app()->getStore(Mage_Core_Model_App::ADMIN_STORE_ID)
112: ->getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/');
113: }
114:
115: 116: 117: 118: 119: 120:
121: public function collectRoutes($configArea, $useRouterName)
122: {
123: if ((string)Mage::getConfig()->getNode(Mage_Adminhtml_Helper_Data::XML_PATH_USE_CUSTOM_ADMIN_PATH)) {
124: $customUrl = (string)Mage::getConfig()->getNode(Mage_Adminhtml_Helper_Data::XML_PATH_CUSTOM_ADMIN_PATH);
125: $xmlPath = Mage_Adminhtml_Helper_Data::XML_PATH_ADMINHTML_ROUTER_FRONTNAME;
126: if ((string)Mage::getConfig()->getNode($xmlPath) != $customUrl) {
127: Mage::getConfig()->setNode($xmlPath, $customUrl, true);
128: }
129: }
130: parent::collectRoutes($configArea, $useRouterName);
131: }
132: }
133: