cartware_maintenance_page - Version 1.0.1

Version Notes

version 1.0.1

Download this release

Release Info

Developer Magento Core Team
Extension cartware_maintenance_page
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

app/code/community/Cartware/MaintenancePage/Block/Adminhtml/System/Config/Form/Field/Ip.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Cartware_MaintenancePage_Block_Adminhtml_System_Config_Form_Field_Ip
3
+ extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
+ {
5
+
6
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
7
+ {
8
+
9
+ return $_SERVER['REMOTE_ADDR'];
10
+ }
11
+
12
+
13
+
14
+ }
app/code/community/Cartware/MaintenancePage/Block/Adminhtml/System/Config/Form/Field/Iptable.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Cartware_MaintenancePage_Block_Adminhtml_System_Config_Form_Field_Iptable
3
+ extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
+ {
5
+
6
+ protected $_addAfter = false;
7
+
8
+ public function __construct()
9
+ {
10
+ $this->addColumn('ip_address', array(
11
+ 'label' => Mage::helper('cartware_maintenancepage')->__('IP Address'),
12
+ 'style' => 'width:120px',
13
+ ));
14
+
15
+ $this->_addButtonLabel = Mage::helper('cartware_maintenancepage')->__('add IP');
16
+
17
+ parent::__construct();
18
+ }
19
+ }
app/code/community/Cartware/MaintenancePage/Helper/Config.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Cartware_MaintenancePage_Helper_Config
4
+ *
5
+ * Implements helper functionality. Provides basic read-access to all
6
+ * the module's config options through the abstract config helper.
7
+ *
8
+ * License: GNU General Public License
9
+ *
10
+ * Copyright (c) 2011 Cartware GmbH. All rights reserved.
11
+ * Note: Original work copyright to respective authors
12
+ *
13
+ * This program is free software; you can redistribute it and/or modify
14
+ * it under the terms of the GNU General Public License as published by
15
+ * the Free Software Foundation; either version 3 of the License, or
16
+ * (at your option) any later version.
17
+ *
18
+ * This program is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ * GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU General Public License
24
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
25
+ *
26
+ * @category Cartware
27
+ * @package Cartware_MaintenancePage
28
+ * @subpackage Helper
29
+ * @copyright Copyright (c) 2010-2012 Cartware GmbH (http://www.cartware.de)
30
+ * @license http://www.gnu.org/licenses/gpl.html GPL, version 3
31
+ * @version $Id:$
32
+ * @link http://www.cartware.de
33
+ * @since File available since Release 0.1.0
34
+ * @author Cartware Core Team <info@cartware.de>
35
+ */
36
+
37
+ /**
38
+ * Cartware_MaintenancePage_Helper_Config
39
+ *
40
+ * Implements helper functionality. Provides basic read-access to all
41
+ * the module's config options through the abstract config helper.
42
+ *
43
+ * @category Cartware
44
+ * @package Cartware_MaintenancePage
45
+ * @subpackage Helper
46
+ * @copyright Copyright (c) 2010-2012 Cartware GmbH (http://www.cartware.de)
47
+ * @license http://www.gnu.org/licenses/gpl.html GPL, version 3
48
+ * @version Release: @package_version@
49
+ * @since Class available since Release 0.1.0
50
+ * @author Cartware Core Team <info@cartware.de>
51
+ */
52
+
53
+ class Cartware_MaintenancePage_Helper_Config
54
+ extends Cartware_MaintenancePage_Helper_Config_Abstract
55
+ {
56
+
57
+ }
app/code/community/Cartware/MaintenancePage/Helper/Data.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Cartware_MaintenancePage_Helper_Data
4
+ *
5
+ * Implements helper functionality.
6
+ *
7
+ * License: GNU General Public License
8
+ *
9
+ * Copyright (c) 2011 Cartware GmbH. All rights reserved.
10
+ * Note: Original work copyright to respective authors
11
+ *
12
+ * This program is free software; you can redistribute it and/or modify
13
+ * it under the terms of the GNU General Public License as published by
14
+ * the Free Software Foundation; either version 3 of the License, or
15
+ * (at your option) any later version.
16
+ *
17
+ * This program is distributed in the hope that it will be useful,
18
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ * GNU General Public License for more details.
21
+ *
22
+ * You should have received a copy of the GNU General Public License
23
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
24
+ *
25
+ * @category Cartware
26
+ * @package Cartware_MaintenancePage
27
+ * @subpackage Helper
28
+ * @copyright Copyright (c) 2010-2012 Cartware GmbH (http://www.cartware.de)
29
+ * @license http://www.gnu.org/licenses/gpl.html GPL, version 3
30
+ * @version $Id:$
31
+ * @link http://www.cartware.de
32
+ * @since File available since Release 0.1.0
33
+ * @author Cartware Core Team <info@cartware.de>
34
+ */
35
+
36
+ /**
37
+ * Cartware_MaintenancePage_Helper_Data
38
+ *
39
+ * Implements helper functionality.
40
+ *
41
+ * @category Cartware
42
+ * @package Cartware_MaintenancePage
43
+ * @subpackage Helper
44
+ * @copyright Copyright (c) 2010-2012 Cartware GmbH (http://www.cartware.de)
45
+ * @license http://www.gnu.org/licenses/gpl.html GPL, version 3
46
+ * @version Release: @package_version@
47
+ * @since Class available since Release 0.1.0
48
+ * @author Cartware Core Team <info@cartware.de>
49
+ */
50
+
51
+ class Cartware_MaintenancePage_Helper_Data
52
+ extends Mage_Core_Helper_Abstract
53
+ {
54
+
55
+ }
app/code/community/Cartware/MaintenancePage/Model/Adminhtml/System/Config/Source/Activate.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Cartware_MaintenancePage_Model_Adminhtml_System_Config_Source_Activate
4
+ {
5
+
6
+ /**
7
+ * Options getter
8
+ *
9
+ * @return array
10
+ */
11
+ public function toOptionArray()
12
+ {
13
+ return array(
14
+ array('value' => 1, 'label'=>Mage::helper('cartware_maintenancepage')->__('Yes')),
15
+ array('value' => 0, 'label'=>Mage::helper('cartware_maintenancepage')->__('No')),
16
+ array('value' => 2, 'label'=>Mage::helper('cartware_maintenancepage')->__('Bypass IP')),
17
+ array('value' => 3, 'label'=>Mage::helper('cartware_maintenancepage')->__('Only IP')),
18
+ );
19
+ }
20
+
21
+ }
app/code/community/Cartware/MaintenancePage/Model/Adminhtml/System/Config/Source/Cms.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Cartware_MaintenancePage_Model_Adminhtml_System_Config_Source_Cms
4
+ {
5
+
6
+ /**
7
+ * Options getter
8
+ *
9
+ * @return array
10
+ */
11
+ public function toOptionArray()
12
+ {
13
+
14
+ /* @var $collection Mage_Cms_Model_Page */
15
+ return Mage::getModel('cms/block')->getCollection()->toOptionArray();
16
+
17
+ }
18
+
19
+ }
app/code/community/Cartware/MaintenancePage/Model/Observer.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Cartware_Prices_Model_Observer
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade
14
+ * Cartware_Prices to newer versions in the future. If you wish to
15
+ * customize Cartware_Prices for your needs please refer to
16
+ * http://www.cartware.de for more information.
17
+ *
18
+ * @category Cartware
19
+ * @package Cartware_Prices
20
+ * @copyright Copyright (c) 2010 <info@cartware.de> Cartware
21
+ * @license http://opensource.org/licenses/osl-3.0.php
22
+ * Open Software License (OSL 3.0)
23
+ */
24
+
25
+ /**
26
+ *
27
+ *
28
+ * @category Cartware
29
+ * @package Cartware_Prices
30
+ * @copyright Copyright (c) 2010 <info@cartware.de> Cartware
31
+ * @license http://opensource.org/licenses/osl-3.0.php
32
+ * Open Software License (OSL 3.0)
33
+ * @author Michael Leiss <m.leiss@cartware.de>
34
+ */
35
+
36
+ class Cartware_MaintenancePage_Model_Observer extends Mage_Core_Model_Abstract{
37
+
38
+
39
+ const XML_CONFIG_PATH_MAINTENANCE_PAGE_ENABLED = 'cartware_maintenancepage/general/activate_maintenance';
40
+ const XML_CONFIG_PATH_MAINTENANCE_PAGE_IPS = 'cartware_maintenancepage/general/ip_table';
41
+
42
+ const MAINTENANCE_ONLY_IP = 3;
43
+ const MAINTENANCE_IGNORE_IP = 2;
44
+ const MAINTENANCE_ENABLED = 1;
45
+ const MAINTENANCE_DISABLED = 0;
46
+
47
+
48
+ protected $_active;
49
+ protected $_url;
50
+ protected $_ips;
51
+
52
+ /**
53
+ *
54
+ * Constructor
55
+ */
56
+ public function __construct() {
57
+ $this->_active = (string) Mage::getStoreConfig(self::XML_CONFIG_PATH_MAINTENANCE_PAGE_ENABLED);
58
+ $this->_url = Mage::getUrl('cartware_maintenancepage/index/enabled');
59
+ $this->_ips = unserialize(Mage::getStoreConfig(self::XML_CONFIG_PATH_MAINTENANCE_PAGE_IPS));
60
+ }
61
+
62
+ /**
63
+ *
64
+ * On event "controller_dispatch_before"
65
+ * @param Varien_Event_Observer $observer
66
+ */
67
+ public function maintenanceCheck(Varien_Event_Observer $observer){
68
+ $controller = $observer->getEvent()->getControllerAction();
69
+
70
+ /* @var $controller Mage_Core_Controller_Front_Action */
71
+
72
+ /* QUICK DROPOUT IF MAINTENANCE PAGE DISABLED */
73
+ if ($this->_active == self::MAINTENANCE_DISABLED){
74
+ return;
75
+ }
76
+
77
+ if ($controller->getFullActionName() != 'cartware_maintenancepage_index_enabled'
78
+ && $controller->getLayout()->getArea('') == 'frontend'){
79
+
80
+ /* SHOW MAINTENANCE PAGE ONLY FOR IP */
81
+ if ($this->_active == self::MAINTENANCE_ONLY_IP){
82
+ foreach ($this->_ips as $key => $value){
83
+ if ($value['ip_address'] == $_SERVER['REMOTE_ADDR']){
84
+ $this->_redirectRequest($controller, $this->_url);
85
+ return;
86
+ }
87
+ }
88
+ }
89
+ /* DONT SHOW MAINTENANCE PAGE FOR IP */
90
+ elseif ($this->_active == self::MAINTENANCE_IGNORE_IP){
91
+ foreach ($this->_ips as $key => $value){
92
+ if ($value['ip_address'] == $_SERVER['REMOTE_ADDR']){
93
+ return;
94
+ }
95
+ }
96
+ $this->_redirectRequest($controller, $this->_url);
97
+ return;
98
+ }
99
+
100
+ /* MAINTENANCE PAGE ENABLED / IGNORE ANY IPS AND ALWAYS SHOW MP */
101
+ elseif ($this->_active == self::MAINTENANCE_ENABLED){
102
+ $this->_redirectRequest($controller, $this->_url);
103
+ }
104
+ }
105
+
106
+
107
+ else {
108
+
109
+
110
+ return;
111
+ }
112
+ }
113
+
114
+ /**
115
+ *
116
+ * Redirect to the maintenance page
117
+ * @param Mage_Core_Controller_Front_Action $controller
118
+ * @param String $url
119
+ */
120
+ protected function _redirectRequest($controller, $url){
121
+ $controller->getResponse()->setRedirect( $url );
122
+ $controller->getResponse()->sendResponse();
123
+ $controller->getRequest()->setDispatched( true );
124
+ return;
125
+ }
126
+
127
+ }
app/code/community/Cartware/MaintenancePage/controllers/IndexController.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Cartware_MaintenancePage_IndexController
4
+ *
5
+ * Implements front controller actions.
6
+ *
7
+ * License: GNU General Public License
8
+ *
9
+ * Copyright (c) 2011 Cartware GmbH. All rights reserved.
10
+ * Note: Original work copyright to respective authors
11
+ *
12
+ * This program is free software; you can redistribute it and/or modify
13
+ * it under the terms of the GNU General Public License as published by
14
+ * the Free Software Foundation; either version 3 of the License, or
15
+ * (at your option) any later version.
16
+ *
17
+ * This program is distributed in the hope that it will be useful,
18
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ * GNU General Public License for more details.
21
+ *
22
+ * You should have received a copy of the GNU General Public License
23
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
24
+ *
25
+ * @category Cartware
26
+ * @package Cartware_MaintenancePage
27
+ * @subpackage Controller
28
+ * @copyright Copyright (c) 2010-2012 Cartware GmbH (http://www.cartware.de)
29
+ * @license http://www.gnu.org/licenses/gpl.html GPL, version 3
30
+ * @version $Id:$
31
+ * @link http://www.cartware.de
32
+ * @since File available since Release 0.1.0
33
+ * @author Cartware Core Team <info@cartware.de>
34
+ */
35
+
36
+ /**
37
+ * Cartware_MaintenancePage_IndexController
38
+ *
39
+ * Implements front controller actions
40
+ *
41
+ * @category Cartware
42
+ * @package Cartware_MaintenancePage
43
+ * @subpackage Controller
44
+ * @copyright Copyright (c) 2010-2012 Cartware GmbH (http://www.cartware.de)
45
+ * @license http://www.gnu.org/licenses/gpl.html GPL, version 3
46
+ * @version Release: @package_version@
47
+ * @since Class available since Release 0.1.0
48
+ * @author Cartware Core Team <info@cartware.de>
49
+ */
50
+
51
+ class Cartware_MaintenancePage_IndexController
52
+ extends Mage_Core_Controller_Front_Action
53
+ {
54
+
55
+ const XML_CONFIG_PATH_MAINTENANCE_CMS_BLOCK = 'cartware_maintenancepage/general/cms_block';
56
+
57
+ /**
58
+ * Fetch the selected block for maintenance page and respond with the html
59
+ * @return String
60
+ */
61
+ public function enabledAction(){
62
+
63
+
64
+ $cmsBlockId = Mage::getStoreConfig(self::XML_CONFIG_PATH_MAINTENANCE_CMS_BLOCK, Mage::app()->getStore());
65
+ $cmsBlockHtml = $this->getLayout()->createBlock('cms/block')->setBlockId($cmsBlockId)->toHtml();
66
+ $response = $this->getResponse();
67
+ $response->setHeader('Content-Type', 'text/html');
68
+ $response->setHeader('HTTP/1.1', '503 Service Temporarily Unavailable');
69
+ $response->setHeader('Status', '503 Service Temporarily Unavailable');
70
+ $response->setHeader('Retry-After', '5000');
71
+ $response->setBody($cmsBlockHtml);
72
+
73
+ return;
74
+ }
75
+
76
+ }
app/code/community/Cartware/MaintenancePage/etc/config.xml ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * config.xml
5
+ *
6
+ * Modules configuration file.
7
+ *
8
+ * License: GNU General Public License
9
+ *
10
+ * Copyright (c) 2011 Cartware GmbH. All rights reserved.
11
+ * Note: Original work copyright to respective authors
12
+ *
13
+ * This program is free software; you can redistribute it and/or modify
14
+ * it under the terms of the GNU General Public License as published by
15
+ * the Free Software Foundation; either version 3 of the License, or
16
+ * (at your option) any later version.
17
+ *
18
+ * This program is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ * GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU General Public License
24
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
25
+ *
26
+ * @category Cartware
27
+ * @package Cartware_MaintenancePage
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2010-2012 Cartware GmbH (http://www.cartware.de)
30
+ * @license http://www.gnu.org/licenses/gpl.html GPL, version 3
31
+ * @version $Id:$
32
+ * @link http://www.cartware.de
33
+ * @since File available since Release 0.1.0
34
+ * @author Cartware Core Team <info@cartware.de>
35
+ */
36
+
37
+ /**
38
+ * config.xml
39
+ *
40
+ * Modules configuration file.
41
+ *
42
+ * @category Cartware
43
+ * @package Cartware_MaintenancePage
44
+ * @subpackage Config
45
+ * @copyright Copyright (c) 2010-2012 Cartware GmbH (http://www.cartware.de)
46
+ * @license http://www.gnu.org/licenses/gpl.html GPL, version 3
47
+ * @version Release: @package_version@
48
+ * @since Class available since Release 0.1.0
49
+ * @author Cartware Core Team <info@cartware.de>
50
+ */
51
+ -->
52
+ <config>
53
+ <modules>
54
+ <Cartware_MaintenancePage>
55
+ <version>1.0.1</version>
56
+ </Cartware_MaintenancePage>
57
+ </modules>
58
+ <frontend>
59
+ <translate>
60
+ <modules>
61
+ <cartware_maintenancepage>
62
+ <files>
63
+ <default>Cartware_MaintenancePage.csv</default>
64
+ </files>
65
+ </cartware_maintenancepage>
66
+ </modules>
67
+ </translate>
68
+ <routers>
69
+ <cartware_maintenancepage>
70
+ <use>standard</use>
71
+ <args>
72
+ <module>Cartware_MaintenancePage</module>
73
+ <frontName>cartware_maintenancepage</frontName>
74
+ </args>
75
+ </cartware_maintenancepage>
76
+ </routers>
77
+ <layout>
78
+ <updates>
79
+ <cartware_maintenancepage>
80
+ <file>cartware_maintenancepage.xml</file>
81
+ </cartware_maintenancepage>
82
+ </updates>
83
+ </layout>
84
+ <events>
85
+ <controller_action_predispatch>
86
+ <observers>
87
+ <cartware_maintenance_check>
88
+ <type>singleton</type>
89
+ <class>cartware_maintenancepage/observer</class>
90
+ <method>maintenanceCheck</method>
91
+ </cartware_maintenance_check>
92
+ </observers>
93
+ </controller_action_predispatch>
94
+ </events>
95
+ </frontend>
96
+ <admin>
97
+ <routers>
98
+ <admin_cartware_maintenancepage>
99
+ <use>admin</use>
100
+ <args>
101
+ <module>Cartware_MaintenancePage</module>
102
+ <frontName>admin_cartware_maintenancepage</frontName>
103
+ </args>
104
+ </admin_cartware_maintenancepage>
105
+ </routers>
106
+ </admin>
107
+ <adminhtml>
108
+ <translate>
109
+ <modules>
110
+ <cartware_maintenancepage>
111
+ <files>
112
+ <default>Cartware_MaintenancePage.csv</default>
113
+ </files>
114
+ </cartware_maintenancepage>
115
+ </modules>
116
+ </translate>
117
+ <acl>
118
+ <resources>
119
+ <admin>
120
+ <children>
121
+ <system>
122
+ <children>
123
+ <config>
124
+ <children>
125
+ <cartware_maintenancepage translate="title" module="cartware_maintenancepage">
126
+ <title>Maintenance Page Section</title>
127
+ <sort_order>50</sort_order>
128
+ </cartware_maintenancepage>
129
+ </children>
130
+ </config>
131
+ </children>
132
+ </system>
133
+ </children>
134
+ </admin>
135
+ </resources>
136
+ </acl>
137
+ <layout>
138
+ <updates>
139
+ <cartware_maintenancepage>
140
+ <file>cartware_maintenancepage.xml</file>
141
+ </cartware_maintenancepage>
142
+ </updates>
143
+ </layout>
144
+ </adminhtml>
145
+ <global>
146
+ <models>
147
+ <cartware_maintenancepage>
148
+ <class>Cartware_MaintenancePage_Model</class>
149
+ <resourceModel>cartware_maintenancepage_resource</resourceModel>
150
+ </cartware_maintenancepage>
151
+ <cartware_maintenancepage_resource>
152
+ <class>Cartware_MaintenancePage_Model_Resource</class>
153
+ <entities/>
154
+ </cartware_maintenancepage_resource>
155
+ </models>
156
+ <resources>
157
+ <cartware_maintenancepage_setup>
158
+ <setup>
159
+ <module>Cartware_MaintenancePage</module>
160
+ </setup>
161
+ <connection>
162
+ <use>core_setup</use>
163
+ </connection>
164
+ </cartware_maintenancepage_setup>
165
+ <cartware_maintenancepage_write>
166
+ <connection>
167
+ <use>core_write</use>
168
+ </connection>
169
+ </cartware_maintenancepage_write>
170
+ <cartware_maintenancepage_read>
171
+ <connection>
172
+ <use>core_read</use>
173
+ </connection>
174
+ </cartware_maintenancepage_read>
175
+ </resources>
176
+ <blocks>
177
+ <cartware_maintenancepage>
178
+ <class>Cartware_MaintenancePage_Block</class>
179
+ </cartware_maintenancepage>
180
+ </blocks>
181
+ <helpers>
182
+ <cartware_maintenancepage>
183
+ <class>Cartware_MaintenancePage_Helper</class>
184
+ </cartware_maintenancepage>
185
+ </helpers>
186
+ </global>
187
+ </config>
app/code/community/Cartware/MaintenancePage/etc/system.xml ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!-- /** * system.xml * * Configuration for backend integrated forms. * *
3
+ License: GNU General Public License * * Copyright (c) 2011 Cartware GmbH.
4
+ All rights reserved. * Note: Original work copyright to respective authors
5
+ * * This program is free software; you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by *
7
+ the Free Software Foundation; either version 3 of the License, or * (at your
8
+ option) any later version. * * This program is distributed in the hope that
9
+ it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty
10
+ of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General
11
+ Public License for more details. * * You should have received a copy of the
12
+ GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>.
13
+ * * @category Cartware * @package Cartware_MaintenancePage * @subpackage
14
+ Config * @copyright Copyright (c) 2010-2012 Cartware GmbH (http://www.cartware.de)
15
+ * @license http://www.gnu.org/licenses/gpl.html GPL, version 3 * @version
16
+ $Id:$ * @link http://www.cartware.de * @since File available since Release
17
+ 0.1.0 * @author Cartware Core Team <info@cartware.de> */ /** * system.xml
18
+ * * Configuration for backend integrated forms. * * @category Cartware *
19
+ @package Cartware_MaintenancePage * @subpackage Config * @copyright Copyright
20
+ (c) 2010-2012 Cartware GmbH (http://www.cartware.de) * @license http://www.gnu.org/licenses/gpl.html
21
+ GPL, version 3 * @version Release: @package_version@ * @since Class available
22
+ since Release 0.1.0 * @author Cartware Core Team <info@cartware.de> */ -->
23
+ <config>
24
+ <tabs>
25
+ <cartware>
26
+ <label>Cartware</label>
27
+ <sort_order>301</sort_order>
28
+ </cartware>
29
+ </tabs>
30
+ <sections>
31
+ <cartware_maintenancepage translate="label"
32
+ module="cartware_maintenancepage">
33
+ <label>Maintenance Page</label>
34
+ <tab>cartware</tab>
35
+ <sort_order>130</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ <groups>
40
+ <general translate="label">
41
+ <label>Settings</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>10</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ <fields>
48
+ <activate_maintenance translate="label">
49
+ <label>Enabled</label>
50
+ <frontend_type>select</frontend_type>
51
+ <source_model>cartware_maintenancepage/adminhtml_system_config_source_activate
52
+ </source_model>
53
+ <sort_order>5</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </activate_maintenance>
58
+ <ip_table translate="label">
59
+ <label>IP Adresses</label>
60
+ <frontend_model>cartware_maintenancepage/adminhtml_system_config_form_field_iptable</frontend_model>
61
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
62
+ <sort_order>10</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </ip_table>
67
+ <cms_block translate="label">
68
+ <label>Maintenance CMS Block</label>
69
+ <frontend_type>select</frontend_type>
70
+ <source_model>cartware_maintenancepage/adminhtml_system_config_source_cms
71
+ </source_model>
72
+ <sort_order>15</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </cms_block>
77
+ <current_ip translate="label">
78
+ <label>Current IP</label>
79
+ <frontend_type>label</frontend_type>
80
+ <frontend_model>cartware_maintenancepage/adminhtml_system_config_form_field_ip</frontend_model>
81
+ <sort_order>12</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ </current_ip>
86
+ </fields>
87
+ </general>
88
+
89
+ </groups>
90
+ </cartware_maintenancepage>
91
+ </sections>
92
+ </config>
app/code/community/Cartware/MaintenancePage/sql/cartware_maintenancepage_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * mysql4-install-0.1.0.php
4
+ *
5
+ * Initital database install script.
6
+ *
7
+ * License: GNU General Public License
8
+ *
9
+ * Copyright (c) 2011 Cartware GmbH. All rights reserved.
10
+ * Note: Original work copyright to respective authors
11
+ *
12
+ * This program is free software; you can redistribute it and/or modify
13
+ * it under the terms of the GNU General Public License as published by
14
+ * the Free Software Foundation; either version 3 of the License, or
15
+ * (at your option) any later version.
16
+ *
17
+ * This program is distributed in the hope that it will be useful,
18
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ * GNU General Public License for more details.
21
+ *
22
+ * You should have received a copy of the GNU General Public License
23
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
24
+ *
25
+ * @category Cartware
26
+ * @package Cartware_MaintenancePage
27
+ * @subpackage Setup
28
+ * @copyright Copyright (c) 2010-2012 Cartware GmbH (http://www.cartware.de)
29
+ * @license http://www.gnu.org/licenses/gpl.html GPL, version 3
30
+ * @version $Id:$
31
+ * @link http://www.cartware.de
32
+ * @since File available since Release 0.1.0
33
+ * @author Cartware Core Team <info@cartware.de>
34
+ */
35
+
36
+ /**
37
+ * mysql4-install-0.1.0.php
38
+ *
39
+ * Initital database install script.
40
+ *
41
+ * @category Cartware
42
+ * @package Cartware_MaintenancePage
43
+ * @subpackage Setup
44
+ * @copyright Copyright (c) 2010-2012 Cartware GmbH (http://www.cartware.de)
45
+ * @license http://www.gnu.org/licenses/gpl.html GPL, version 3
46
+ * @version Release: @package_version@
47
+ * @since Class available since Release 0.1.0
48
+ * @author Cartware Core Team <info@cartware.de>
49
+ */
50
+
51
+
52
+
53
+ /* initiate installer ********************************************************/
54
+ $installer = $this;
55
+
56
+ /* start setup ***************************************************************/
57
+ $installer->startSetup();
58
+
59
+ /* do setup ******************************************************************/
60
+ $installer->run("");
61
+
62
+ /* end setup *****************************************************************/
63
+ $installer->endSetup();
app/etc/modules/Cartware_MaintenancePage.xml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Cartware_MaintenancePage.xml
5
+ *
6
+ * Main registration and configuration file.
7
+ *
8
+ * License: GNU General Public License
9
+ *
10
+ * Copyright (c) 2011 Cartware GmbH. All rights reserved.
11
+ * Note: Original work copyright to respective authors
12
+ *
13
+ * This program is free software; you can redistribute it and/or modify
14
+ * it under the terms of the GNU General Public License as published by
15
+ * the Free Software Foundation; either version 3 of the License, or
16
+ * (at your option) any later version.
17
+ *
18
+ * This program is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ * GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU General Public License
24
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
25
+ *
26
+ * @category Cartware
27
+ * @package Cartware_MaintenancePage
28
+ * @subpackage Config
29
+ * @copyright Copyright (c) 2010-2012 Cartware GmbH (http://www.cartware.de)
30
+ * @license http://www.gnu.org/licenses/gpl.html GPL, version 3
31
+ * @version $Id:$
32
+ * @link http://www.cartware.de
33
+ * @since File available since Release 0.1.0
34
+ * @author Cartware Core Team <info@cartware.de>
35
+ */
36
+
37
+ /**
38
+ * Cartware_MaintenancePage.xml
39
+ *
40
+ * Main registration and configuration file.
41
+ *
42
+ * @category Cartware
43
+ * @package Cartware_MaintenancePage
44
+ * @subpackage Config
45
+ * @copyright Copyright (c) 2010-2012 Cartware GmbH (http://www.cartware.de)
46
+ * @license http://www.gnu.org/licenses/gpl.html GPL, version 3
47
+ * @version Release: @package_version@
48
+ * @since Class available since Release 0.1.0
49
+ * @author Cartware Core Team <info@cartware.de>
50
+ */
51
+ -->
52
+ <config>
53
+ <modules>
54
+ <Cartware_MaintenancePage>
55
+ <active>true</active>
56
+ <codePool>community</codePool>
57
+ </Cartware_MaintenancePage>
58
+ </modules>
59
+ </config>
app/locale/de_DE/Cartware_MaintenancePage.csv ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "General", "Allgemein"
2
+ "Yes","Ja"
3
+ "No","Nein"
4
+ "Only IP","Nur IP"
5
+ "Bypass IP","Nicht IP"
6
+ "Enabled","Aktiviert"
7
+ "Disabled for", "Deaktiviert für"
8
+ "Maintenance CMS Block", "Wartungs CMS Block"
9
+ "Settings", "Einstellungen"
10
+ "Maintenance Page","Maintenance Page"
11
+ "add IP","IP hinzufügen"
12
+ "IP Address", "IP Adresse"
13
+ "Current IP","Aktuelle IP"
14
+ "IP Adresses","IP Adressen"
package.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>cartware_maintenance_page</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.gnu.org/licenses/gpl.html">GPL version 3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Module shows a CMS block as maintenance page and returns 503 "service temporarily not avail." http status.</summary>
10
+ <description>Module shows a selected CMS block as maintenance page and returns 503 "service temporarily not available" http status code.&#xD;
11
+ &#xD;
12
+ CMS block can be shown either for:&#xD;
13
+ &#xD;
14
+ -Everybody&#xD;
15
+ -Nobody&#xD;
16
+ -All users not in IP list&#xD;
17
+ -All users in IP list</description>
18
+ <notes>version 1.0.1</notes>
19
+ <authors><author><name>Cartware GmbH - Core Team</name><user>auto-converted</user><email>info@cartware.de</email></author></authors>
20
+ <date>2013-08-08</date>
21
+ <time>13:09:15</time>
22
+ <contents><target name="magecommunity"><dir name="Cartware"><dir name="MaintenancePage"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Ip.php" hash="3a6a2661a29b20f7cce379e650f4def0"/><file name="Iptable.php" hash="b4db6621ef57de09530c197045822e96"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Config.php" hash="84852920badd77acaeb177a6ae2421fd"/><file name="Data.php" hash="f5da08053959afa745b95b4d28eeacbe"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Activate.php" hash="62c97ef8a9c135dab79d651b968cf912"/><file name="Cms.php" hash="88169d46c4f2dbe6c4a190f06f2d5d73"/></dir></dir></dir></dir><file name="Observer.php" hash="7b69ff7c90ca38b832ad92b93c282493"/></dir><dir name="controllers"><file name="IndexController.php" hash="70293f3dff1844a0d8609087afd76b77"/></dir><dir name="etc"><file name="config.xml" hash="4b8e66735d2769012caa180915777cd4"/><file name="system.xml" hash="e0f9ff3c4740e85cb48a1b5dd797c617"/></dir><dir name="sql"><dir name="cartware_maintenancepage_setup"><file name="mysql4-install-0.1.0.php" hash="7922b7d0e43a0bc125dad2a672cbdc5f"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cartware_MaintenancePage.xml" hash="98b62027bf8e8516d07f2ed9b28feb8b"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Cartware_MaintenancePage.csv" hash="a6ea75959d2eb91f7c6575a33ed136bf"/></dir></target></contents>
23
+ <compatible/>
24
+ <dependencies/>
25
+ </package>