1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_Adminhtml
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26:
27: class Mage_Adminhtml_Model_System_Config_Backend_Admin_Observer
28: {
29: /**
30: * Log out user and redirect him to new admin custom url
31: *
32: * @param Varien_Event_Observer $observer
33: */
34: public function afterCustomUrlChanged($observer)
35: {
36: if (is_null(Mage::registry('custom_admin_path_redirect'))) {
37: return;
38: }
39:
40: /** @var $adminSession Mage_Admin_Model_Session */
41: $adminSession = Mage::getSingleton('admin/session');
42: $adminSession->unsetAll();
43: $adminSession->getCookie()->delete($adminSession->getSessionName());
44:
45: $route = ((bool)(string)Mage::getConfig()->getNode(Mage_Adminhtml_Helper_Data::XML_PATH_USE_CUSTOM_ADMIN_PATH))
46: ? Mage::getConfig()->getNode(Mage_Adminhtml_Helper_Data::XML_PATH_CUSTOM_ADMIN_PATH)
47: : Mage::getConfig()->getNode(Mage_Adminhtml_Helper_Data::XML_PATH_ADMINHTML_ROUTER_FRONTNAME);
48:
49: Mage::app()->getResponse()
50: ->setRedirect(Mage::getBaseUrl() . $route)
51: ->sendResponse();
52: exit(0);
53: }
54: }
55: