Version Notes
Fixed installation / Corrigido instalação
Download this release
Release Info
Developer | Dexxtz |
Extension | Dexxtz_Store_maintenance |
Version | 1.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.0.1
- app/code/community/Dexxtz/Storemaintenance/Block/EndDate.php +38 -0
- app/code/community/Dexxtz/Storemaintenance/Block/Ip.php +21 -0
- app/code/community/Dexxtz/Storemaintenance/Block/Ipgrid.php +31 -0
- app/code/community/Dexxtz/Storemaintenance/Block/Iptable.php +18 -0
- app/code/community/Dexxtz/Storemaintenance/Helper/Data.php +14 -0
- app/code/community/Dexxtz/Storemaintenance/Model/BlockStatic.php +35 -0
- app/code/community/Dexxtz/Storemaintenance/Model/Observer.php +117 -0
- app/code/community/Dexxtz/Storemaintenance/etc/config.xml +130 -0
- app/code/community/Dexxtz/Storemaintenance/etc/system.xml +132 -0
- app/design/frontend/base/default/template/dexxtz/store_maintenance.phtml +35 -0
- package.xml +6 -7
app/code/community/Dexxtz/Storemaintenance/Block/EndDate.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright [2014] [Dexxtz]
|
5 |
+
*
|
6 |
+
* @package Dexxtz_StoreMaintenance
|
7 |
+
* @author Dexxtz
|
8 |
+
* @license http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Dexxtz_Storemaintenance_Block_EndDate extends Mage_Adminhtml_Block_System_Config_Form_Field
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
* Adds the date selection
|
15 |
+
* @return html
|
16 |
+
*/
|
17 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
18 |
+
{
|
19 |
+
$date = new Varien_Data_Form_Element_Date;
|
20 |
+
$format = 'MM/d/y';
|
21 |
+
|
22 |
+
$data = array(
|
23 |
+
'name' => $element->getName(),
|
24 |
+
'html_id' => $element->getId(),
|
25 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
26 |
+
);
|
27 |
+
|
28 |
+
$date->setData($data);
|
29 |
+
$date->setValue($element->getValue(), $format);
|
30 |
+
$date->setFormat($format);
|
31 |
+
|
32 |
+
// The line below leaves the required field
|
33 |
+
//$date->setClass($element->getFieldConfig()->validate->asArray());
|
34 |
+
$date->setForm($element->getForm());
|
35 |
+
|
36 |
+
return $date->getElementHtml();
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Dexxtz/Storemaintenance/Block/Ip.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright [2014] [Dexxtz]
|
5 |
+
*
|
6 |
+
* @package Dexxtz_StoreMaintenance
|
7 |
+
* @author Dexxtz
|
8 |
+
* @license http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Dexxtz_Storemaintenance_Block_Ip extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
12 |
+
{
|
13 |
+
/**
|
14 |
+
* Check what is the current ip
|
15 |
+
* @return current ip
|
16 |
+
*/
|
17 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
18 |
+
{
|
19 |
+
return $_SERVER['REMOTE_ADDR'];
|
20 |
+
}
|
21 |
+
}
|
app/code/community/Dexxtz/Storemaintenance/Block/Ipgrid.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright [2014] [Dexxtz]
|
5 |
+
*
|
6 |
+
* @package Dexxtz_StoreMaintenance
|
7 |
+
* @author Dexxtz
|
8 |
+
* @license http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Dexxtz_Storemaintenance_Block_Ipgrid extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
12 |
+
{
|
13 |
+
|
14 |
+
protected $_addAfter = false;
|
15 |
+
|
16 |
+
/*
|
17 |
+
* Builds the button that adds the table filling ips *
|
18 |
+
*/
|
19 |
+
public function __construct()
|
20 |
+
{
|
21 |
+
// Build rows and columns
|
22 |
+
$this->addColumn('ip_address', array(
|
23 |
+
'label' => Mage::helper('storemaintenance')->__('IP Address'),
|
24 |
+
'style' => 'width:120px',
|
25 |
+
));
|
26 |
+
|
27 |
+
$this->_addButtonLabel = Mage::helper('storemaintenance')->__('add IP');
|
28 |
+
|
29 |
+
parent::__construct();
|
30 |
+
}
|
31 |
+
}
|
app/code/community/Dexxtz/Storemaintenance/Block/Iptable.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Dexxtz_Storemaintenance_Block_Iptable extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract{
|
4 |
+
|
5 |
+
protected $_addAfter = false;
|
6 |
+
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
$this->addColumn('ip_address', array(
|
10 |
+
'label' => Mage::helper('storemaintenance')->__('IP Address'),
|
11 |
+
'style' => 'width:120px',
|
12 |
+
));
|
13 |
+
|
14 |
+
$this->_addButtonLabel = Mage::helper('storemaintenance')->__('add IP');
|
15 |
+
|
16 |
+
parent::__construct();
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Dexxtz/Storemaintenance/Helper/Data.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright [2014] [Dexxtz]
|
5 |
+
*
|
6 |
+
* @package Dexxtz_StoreMaintenance
|
7 |
+
* @author Dexxtz
|
8 |
+
* @license http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Dexxtz_Storemaintenance_Helper_Data extends Mage_Core_Helper_Abstract
|
12 |
+
{
|
13 |
+
|
14 |
+
}
|
app/code/community/Dexxtz/Storemaintenance/Model/BlockStatic.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright [2014] [Dexxtz]
|
5 |
+
*
|
6 |
+
* @package Dexxtz_StoreMaintenance
|
7 |
+
* @author Dexxtz
|
8 |
+
* @license http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Dexxtz_Storemaintenance_Model_BlockStatic
|
12 |
+
{
|
13 |
+
protected $_options;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Mounts the static blocks in combobox
|
17 |
+
* @return static blocks available
|
18 |
+
*/
|
19 |
+
public function toOptionArray()
|
20 |
+
{
|
21 |
+
if(!$this -> _options){
|
22 |
+
$this -> _options = array(
|
23 |
+
array(
|
24 |
+
'value' => 0,
|
25 |
+
'label' => Mage::helper('catalog')->__('Please select one static block ...'),
|
26 |
+
)
|
27 |
+
);
|
28 |
+
|
29 |
+
$options = Mage::getResourceModel('cms/block_collection') -> load() -> toOptionArray();
|
30 |
+
$this -> _options = array_merge($this -> _options, $options);
|
31 |
+
}
|
32 |
+
|
33 |
+
return $this->_options;
|
34 |
+
}
|
35 |
+
}
|
app/code/community/Dexxtz/Storemaintenance/Model/Observer.php
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright [2014] [Dexxtz]
|
5 |
+
*
|
6 |
+
* @package Dexxtz_StoreMaintenance
|
7 |
+
* @author Dexxtz
|
8 |
+
* @license http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Dexxtz_Storemaintenance_Model_Observer
|
12 |
+
{
|
13 |
+
public function initControllerStoremaintenance($request)
|
14 |
+
{
|
15 |
+
// Sets the timezone selected by shopkeeper
|
16 |
+
date_default_timezone_set(Mage::getStoreConfig('general/locale/timezone'));
|
17 |
+
|
18 |
+
$url = Mage::helper('core/url')->getCurrentUrl();
|
19 |
+
$adminArea = 0;
|
20 |
+
|
21 |
+
// checks whether the current page belongs to the administrator
|
22 |
+
if (strpos($url, '/admin') || strpos($url, '/adminhtml') || strpos($url, '/downloader')) {
|
23 |
+
$adminArea = 1;
|
24 |
+
}
|
25 |
+
|
26 |
+
// Performs if not is administrative area
|
27 |
+
if ($adminArea == 0) {
|
28 |
+
|
29 |
+
$storeId = Mage::app()->getStore()->getStoreId();
|
30 |
+
$isEnabled = Mage::getStoreConfig('storemaintenance/dexxtz/activate',$storeId);
|
31 |
+
|
32 |
+
// verifies if the module is enabled
|
33 |
+
if ($isEnabled == 1) {
|
34 |
+
$allowedIPs = Mage::getStoreConfig('storemaintenance/dexxtz/allowedIPs',$storeId);
|
35 |
+
$allowedIPs = preg_replace('/ /', '', $allowedIPs);
|
36 |
+
$array = unserialize(Mage::getStoreConfig('storemaintenance/dexxtz/ip_grid'));
|
37 |
+
|
38 |
+
// assembles an array with informed ips
|
39 |
+
foreach ($array as $key => $value) {
|
40 |
+
$IPs[] = $value['ip_address'];
|
41 |
+
}
|
42 |
+
|
43 |
+
$currentIP = $_SERVER['REMOTE_ADDR'];
|
44 |
+
$allowForAdmin = Mage::getStoreConfig('storemaintenance/dexxtz/activate_admin',$storeId);
|
45 |
+
$adminIp = null;
|
46 |
+
|
47 |
+
// verifies if the administrator can view the frontend
|
48 |
+
if ($allowForAdmin == 1) {
|
49 |
+
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
|
50 |
+
$adminSession = Mage::getSingleton('admin/session');
|
51 |
+
|
52 |
+
// checks if the admin is logged in and capture your ip
|
53 |
+
if ($adminSession->isLoggedIn()) {
|
54 |
+
$adminIp = $adminSession['_session_validator_data']['remote_addr'];
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
$endDate = Mage::getStoreConfig('storemaintenance/dexxtz/end_date');
|
59 |
+
$checkDate = 0;
|
60 |
+
|
61 |
+
// Checks if a date was set for the end of maintenance
|
62 |
+
if ($endDate) {
|
63 |
+
$timestamp_endDate = strtotime($endDate);
|
64 |
+
$currentDate = date('m/d/Y');
|
65 |
+
$timestamp_currentDate = strtotime($currentDate);
|
66 |
+
|
67 |
+
// checks whether the current date is greater than the date specified in the module
|
68 |
+
if ($timestamp_currentDate > $timestamp_endDate) {
|
69 |
+
$checkDate = 1;
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
// checks if the ip current is different from ip of admin logged
|
74 |
+
if ($currentIP != $adminIp) {
|
75 |
+
|
76 |
+
// checks if the ip can access or if the date will access
|
77 |
+
if (!in_array($currentIP, $IPs) && $checkDate == 0) {
|
78 |
+
|
79 |
+
// stores the html of the page maintenance
|
80 |
+
$html = Mage::getSingleton('core/layout')->createBlock('core/template')->setTemplate('dexxtz/store_maintenance.phtml')->toHtml();
|
81 |
+
$activate_log = Mage::getStoreConfig('storemaintenance/dexxtz/activate_log');
|
82 |
+
|
83 |
+
// create log
|
84 |
+
if ($activate_log == 1) {
|
85 |
+
$archive_log = Mage::getStoreConfig('storemaintenance/dexxtz/archive_log');
|
86 |
+
$file = ($archive_log == '') ? 'MaintenanceLog.txt' : $archive_log;
|
87 |
+
$date = date('m/d/Y h:i A');
|
88 |
+
$urlBase = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
89 |
+
$urlCurrent = Mage::helper('core/url')->getCurrentUrl();
|
90 |
+
$accessedArea = str_replace('index.php/','',str_replace($urlBase,'',$urlCurrent));
|
91 |
+
$accessedArea = ($accessedArea == '') ? 'home' : $accessedArea;
|
92 |
+
$log = 'array("Date" => "' . $date . '", "IP" => "' . $currentIP . '", "Accessed Area" => "' . $accessedArea . '")' . PHP_EOL;
|
93 |
+
|
94 |
+
// adds a new line to the log file
|
95 |
+
file_put_contents($file, $log, FILE_APPEND);
|
96 |
+
}
|
97 |
+
|
98 |
+
// mounts the display of the page of maintenance on page current
|
99 |
+
if ('' !== $html) {
|
100 |
+
Mage::getSingleton('core/session', array('name' => 'front'));
|
101 |
+
$response = $request->getEvent()->getFront()->getResponse();
|
102 |
+
$response->setHeader('HTTP/1.1', '503 Service Temporarily Unavailable');
|
103 |
+
$response->setHeader('Status', '503 Service Temporarily Unavailable');
|
104 |
+
$response->setHeader('Retry-After', '5000');
|
105 |
+
$response->setBody($html);
|
106 |
+
$response->sendHeaders();
|
107 |
+
$response->outputBody();
|
108 |
+
}
|
109 |
+
|
110 |
+
// break page display
|
111 |
+
exit();
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
app/code/community/Dexxtz/Storemaintenance/etc/config.xml
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Copyright [2014] [Dexxtz]
|
5 |
+
*
|
6 |
+
* @package Dexxtz_StoreMaintenance
|
7 |
+
* @author Dexxtz
|
8 |
+
* @license http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
*/
|
10 |
+
-->
|
11 |
+
<config>
|
12 |
+
<modules>
|
13 |
+
<Dexxtz_Storemaintenance>
|
14 |
+
<version>1.0.0</version>
|
15 |
+
</Dexxtz_Storemaintenance>
|
16 |
+
</modules>
|
17 |
+
<frontend>
|
18 |
+
<routers>
|
19 |
+
<storemaintenance>
|
20 |
+
<use>standard</use>
|
21 |
+
<args>
|
22 |
+
<module>Dexxtz_Storemaintenance</module>
|
23 |
+
<frontName>storemaintenance</frontName>
|
24 |
+
</args>
|
25 |
+
</storemaintenance>
|
26 |
+
</routers>
|
27 |
+
<translate>
|
28 |
+
<modules>
|
29 |
+
<Dexxtz_Storemaintenance>
|
30 |
+
<files>
|
31 |
+
<default>Dexxtz_Storemaintenance.csv</default>
|
32 |
+
</files>
|
33 |
+
</Dexxtz_Storemaintenance>
|
34 |
+
</modules>
|
35 |
+
</translate>
|
36 |
+
</frontend>
|
37 |
+
<admin>
|
38 |
+
<routers>
|
39 |
+
<storemaintenance>
|
40 |
+
<use>admin</use>
|
41 |
+
<args>
|
42 |
+
<module>Dexxtz_Storemaintenance</module>
|
43 |
+
<frontName>storemaintenance</frontName>
|
44 |
+
</args>
|
45 |
+
</storemaintenance>
|
46 |
+
</routers>
|
47 |
+
</admin>
|
48 |
+
<adminhtml>
|
49 |
+
<acl>
|
50 |
+
<resources>
|
51 |
+
<all>
|
52 |
+
<title>Allow Everything</title>
|
53 |
+
</all>
|
54 |
+
<admin>
|
55 |
+
<children>
|
56 |
+
<Dexxtz_Storemaintenance>
|
57 |
+
<title>Storemaintenance Module</title>
|
58 |
+
<sort_order>10</sort_order>
|
59 |
+
</Dexxtz_Storemaintenance>
|
60 |
+
<system>
|
61 |
+
<children>
|
62 |
+
<config>
|
63 |
+
<children>
|
64 |
+
<storemaintenance>
|
65 |
+
<title>Storemaintenance</title>
|
66 |
+
</storemaintenance>
|
67 |
+
</children>
|
68 |
+
</config>
|
69 |
+
</children>
|
70 |
+
</system>
|
71 |
+
</children>
|
72 |
+
</admin>
|
73 |
+
</resources>
|
74 |
+
</acl>
|
75 |
+
<translate>
|
76 |
+
<modules>
|
77 |
+
<Dexxtz_Storemaintenance>
|
78 |
+
<files>
|
79 |
+
<default>Dexxtz_Storemaintenance.csv</default>
|
80 |
+
</files>
|
81 |
+
</Dexxtz_Storemaintenance>
|
82 |
+
</modules>
|
83 |
+
</translate>
|
84 |
+
</adminhtml>
|
85 |
+
<global>
|
86 |
+
<models>
|
87 |
+
<storemaintenance>
|
88 |
+
<class>Dexxtz_Storemaintenance_Model</class>
|
89 |
+
</storemaintenance>
|
90 |
+
</models>
|
91 |
+
<resources>
|
92 |
+
<dexxtz_storemaintenance_setup>
|
93 |
+
<setup>
|
94 |
+
<module>Dexxtz_Storemaintenance</module>
|
95 |
+
</setup>
|
96 |
+
<connection>
|
97 |
+
<use>core_setup</use>
|
98 |
+
</connection>
|
99 |
+
</dexxtz_storemaintenance_setup>
|
100 |
+
</resources>
|
101 |
+
<blocks>
|
102 |
+
<storemaintenance>
|
103 |
+
<class>Dexxtz_Storemaintenance_Block</class>
|
104 |
+
</storemaintenance>
|
105 |
+
</blocks>
|
106 |
+
<helpers>
|
107 |
+
<storemaintenance>
|
108 |
+
<class>Dexxtz_Storemaintenance_Helper</class>
|
109 |
+
</storemaintenance>
|
110 |
+
</helpers>
|
111 |
+
<events>
|
112 |
+
<controller_front_init_routers>
|
113 |
+
<observers>
|
114 |
+
<storemaintenance>
|
115 |
+
<type>singleton</type>
|
116 |
+
<class>storemaintenance/observer</class>
|
117 |
+
<method>initControllerStoremaintenance</method>
|
118 |
+
</storemaintenance>
|
119 |
+
</observers>
|
120 |
+
</controller_front_init_routers>
|
121 |
+
</events>
|
122 |
+
</global>
|
123 |
+
<default>
|
124 |
+
<storemaintenance>
|
125 |
+
<dexxtz>
|
126 |
+
<activate_admin>1</activate_admin>
|
127 |
+
</dexxtz>
|
128 |
+
</storemaintenance>
|
129 |
+
</default>
|
130 |
+
</config>
|
app/code/community/Dexxtz/Storemaintenance/etc/system.xml
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Copyright [2014] [Dexxtz]
|
5 |
+
*
|
6 |
+
* @package Dexxtz_StoreMaintenance
|
7 |
+
* @author Dexxtz
|
8 |
+
* @license http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
*/
|
10 |
+
-->
|
11 |
+
<config>
|
12 |
+
<tabs>
|
13 |
+
<dexxtz translate="label">
|
14 |
+
<label>Dexxtz</label>
|
15 |
+
<sort_order>150</sort_order>
|
16 |
+
</dexxtz>
|
17 |
+
</tabs>
|
18 |
+
<sections>
|
19 |
+
<storemaintenance translate="label" module="storemaintenance">
|
20 |
+
<label>Store Maintenance</label>
|
21 |
+
<tab>dexxtz</tab>
|
22 |
+
<frontend_type>text</frontend_type>
|
23 |
+
<sort_order>10</sort_order>
|
24 |
+
<show_in_default>1</show_in_default>
|
25 |
+
<show_in_website>1</show_in_website>
|
26 |
+
<show_in_store>1</show_in_store>
|
27 |
+
<groups>
|
28 |
+
<dexxtz translate="label">
|
29 |
+
<label>Maintenance settings</label>
|
30 |
+
<frontend_type>text</frontend_type>
|
31 |
+
<sort_order>1</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
<fields>
|
36 |
+
<activate translate="label">
|
37 |
+
<label>Enabled</label>
|
38 |
+
<comment>Enables or disables the maintenance page</comment>
|
39 |
+
<frontend_type>select</frontend_type>
|
40 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
41 |
+
<sort_order>10</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
</activate>
|
46 |
+
<title translate="label comment">
|
47 |
+
<label>Title of page</label>
|
48 |
+
<comment>Will be added to the html title tag</comment>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>20</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</title>
|
55 |
+
<block_static translate="label">
|
56 |
+
<label>Select the static block</label>
|
57 |
+
<comment>It is the maintenance page to be displayed</comment>
|
58 |
+
<frontend_type>select</frontend_type>
|
59 |
+
<source_model>storemaintenance/blockstatic</source_model>
|
60 |
+
<sort_order>30</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>0</show_in_website>
|
63 |
+
<show_in_store>1</show_in_store>
|
64 |
+
</block_static>
|
65 |
+
<activate_admin translate="label">
|
66 |
+
<label>Administrator can view frontend</label>
|
67 |
+
<comment>Only logged administrators, can they have access</comment>
|
68 |
+
<frontend_type>select</frontend_type>
|
69 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
70 |
+
<sort_order>40</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
</activate_admin>
|
75 |
+
<end_date translate="label">
|
76 |
+
<label>End date to be accessed</label>
|
77 |
+
<comment>m/d/Y - After the date the frontend can be viewed</comment>
|
78 |
+
<frontend_type>text</frontend_type>
|
79 |
+
<frontend_model>storemaintenance/enddate</frontend_model>
|
80 |
+
<sort_order>50</sort_order>
|
81 |
+
<show_in_default>1</show_in_default>
|
82 |
+
<show_in_website>1</show_in_website>
|
83 |
+
<validate>required-entry</validate>
|
84 |
+
<show_in_store>1</show_in_store>
|
85 |
+
</end_date>
|
86 |
+
<ip_current translate="label">
|
87 |
+
<label>Your current IP is</label>
|
88 |
+
<frontend_type>label</frontend_type>
|
89 |
+
<frontend_model>storemaintenance/ip</frontend_model>
|
90 |
+
<sort_order>60</sort_order>
|
91 |
+
<show_in_default>1</show_in_default>
|
92 |
+
<show_in_website>1</show_in_website>
|
93 |
+
<show_in_store>1</show_in_store>
|
94 |
+
</ip_current>
|
95 |
+
<ip_grid translate="label">
|
96 |
+
<label>IP Adresses</label>
|
97 |
+
<comment>IP addresses permetidos pair to access the frontend</comment>
|
98 |
+
<frontend_model>storemaintenance/ipgrid</frontend_model>
|
99 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
100 |
+
<sort_order>70</sort_order>
|
101 |
+
<show_in_default>1</show_in_default>
|
102 |
+
<show_in_website>1</show_in_website>
|
103 |
+
<show_in_store>1</show_in_store>
|
104 |
+
</ip_grid>
|
105 |
+
<activate_log translate="label comment">
|
106 |
+
<label>Enable log of attempt of access</label>
|
107 |
+
<comment>Saves the ip, date and page attempt of access in log</comment>
|
108 |
+
<frontend_type>select</frontend_type>
|
109 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
110 |
+
<sort_order>80</sort_order>
|
111 |
+
<show_in_default>1</show_in_default>
|
112 |
+
<show_in_website>1</show_in_website>
|
113 |
+
<show_in_store>1</show_in_store>
|
114 |
+
</activate_log>
|
115 |
+
<archive_log translate="label comment">
|
116 |
+
<label>Name and extension of log</label>
|
117 |
+
<comment>Example: log.txt to root or var/log/maintenance.txt</comment>
|
118 |
+
<frontend_type>text</frontend_type>
|
119 |
+
<sort_order>81</sort_order>
|
120 |
+
<show_in_default>1</show_in_default>
|
121 |
+
<show_in_website>1</show_in_website>
|
122 |
+
<show_in_store>1</show_in_store>
|
123 |
+
<depends>
|
124 |
+
<activate_log>1</activate_log>
|
125 |
+
</depends>
|
126 |
+
</archive_log>
|
127 |
+
</fields>
|
128 |
+
</dexxtz>
|
129 |
+
</groups>
|
130 |
+
</storemaintenance>
|
131 |
+
</sections>
|
132 |
+
</config>
|
app/design/frontend/base/default/template/dexxtz/store_maintenance.phtml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright [2014] [Dexxtz]
|
5 |
+
*
|
6 |
+
* @package Dexxtz_StoreMaintenance
|
7 |
+
* @author Dexxtz
|
8 |
+
* @license http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
*/
|
10 |
+
?>
|
11 |
+
<?php
|
12 |
+
$page = Mage::getSingleton('Mage_Page_Block_Html');
|
13 |
+
$head = Mage::getSingleton('Mage_Page_Block_Html_Head');
|
14 |
+
$title = (Mage::getStoreConfig('storemaintenance/dexxtz/title')) ? Mage::getStoreConfig('storemaintenance/dexxtz/title') : 'Store Maintenance';
|
15 |
+
?>
|
16 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
17 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $page->getLang();?>" lang="<?php echo $page->getLang();?>">
|
18 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
19 |
+
<title><?php echo $this->__($title);?></title>
|
20 |
+
<meta name="description" content="<?php echo htmlspecialchars($head->getDescription()) ?>" />
|
21 |
+
<meta name="keywords" content="<?php echo htmlspecialchars($head->getKeywords()) ?>" />
|
22 |
+
<meta name="robots" content="<?php echo htmlspecialchars($head->getRobots()) ?>" />
|
23 |
+
<link rel="icon" href="<?php echo $head->getFaviconFile();?>" type="image/x-icon" />
|
24 |
+
<link rel="shortcut icon" href="<?php echo $head->getFaviconFile();?>" type="image/x-icon" />
|
25 |
+
<head>
|
26 |
+
<body>
|
27 |
+
<?php
|
28 |
+
// capturing the identification of the selected static block
|
29 |
+
$blockStatic = Mage::getStoreConfig('storemaintenance/dexxtz/block_static');
|
30 |
+
|
31 |
+
//displays the contents of the static block
|
32 |
+
echo Mage::getSingleton('core/layout')->createBlock('cms/block')->setBlockId($blockStatic)->toHtml() . "\n";
|
33 |
+
?>
|
34 |
+
</body>
|
35 |
+
</html>
|
package.xml
CHANGED
@@ -1,26 +1,25 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Dexxtz_Store_maintenance</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/apachepl.php">Apache Software License</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>maintenance, manutenção,
|
10 |
<description><strong>English</strong><br />
|
11 |
Leave your store in maintenance for their customers, while you work in her improving or in their developing their store.<br />
|
12 |
Your customers will not slow you down or see errors in your store.<br />
|
13 |
-
The module saves access logs, controls access by date, ip or administrator user
|
14 |
-
<hr>
|
15 |
<strong>Portuguese</strong><br />
|
16 |
Deixe sua loja em manutenção para seus clientes, enquanto você trabalha melhorando ela ou desenvolvendo sua loja.<br />
|
17 |
Seus clientes não vão te atrapalhar ou visualizar erros em sua loja.<br />
|
18 |
O módulo armazena logs de acesso, controla o acesso por data, ip ou por usuário administrador.</description>
|
19 |
-
<notes>
|
20 |
<authors><author><name>Dexxtz</name><user>Dexxtz</user><email>dexxtz@gmail.com</email></author></authors>
|
21 |
<date>2014-08-15</date>
|
22 |
-
<time>
|
23 |
-
<contents><target name="magecommunity"><dir name="."><file name="
|
24 |
<compatible/>
|
25 |
<dependencies><required><php><min>5.1.0</min><max>10.0.0</max></php></required></dependencies>
|
26 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Dexxtz_Store_maintenance</name>
|
4 |
+
<version>1.0.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/apachepl.php">Apache Software License</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>maintenance, store maintenance, store in maintenance, dexxtz, manutenção, loja manutenção, loja em manutenção</summary>
|
10 |
<description><strong>English</strong><br />
|
11 |
Leave your store in maintenance for their customers, while you work in her improving or in their developing their store.<br />
|
12 |
Your customers will not slow you down or see errors in your store.<br />
|
13 |
+
The module saves access logs, controls access by date, ip or administrator user.<br />
|
|
|
14 |
<strong>Portuguese</strong><br />
|
15 |
Deixe sua loja em manutenção para seus clientes, enquanto você trabalha melhorando ela ou desenvolvendo sua loja.<br />
|
16 |
Seus clientes não vão te atrapalhar ou visualizar erros em sua loja.<br />
|
17 |
O módulo armazena logs de acesso, controla o acesso por data, ip ou por usuário administrador.</description>
|
18 |
+
<notes>Fixed installation / Corrigido instalação</notes>
|
19 |
<authors><author><name>Dexxtz</name><user>Dexxtz</user><email>dexxtz@gmail.com</email></author></authors>
|
20 |
<date>2014-08-15</date>
|
21 |
+
<time>23:44:00</time>
|
22 |
+
<contents><target name="magecommunity"><dir name="Dexxtz"><dir name="Storemaintenance"><dir name="Block"><file name="EndDate.php" hash="60bd71dace9bfa6cdd14f09e88f72634"/><file name="Ip.php" hash="818c18d5fa9c6526a46d699f1b1a89e9"/><file name="Ipgrid.php" hash="0f29268d966d16d6e749d8a0a1c2fa51"/><file name="Iptable.php" hash="7e4c9f0db09ef4d604773db2eac815c1"/></dir><dir name="Helper"><file name="Data.php" hash="ff90181c672edbcbf79f6adbcef70422"/></dir><dir name="Model"><file name="BlockStatic.php" hash="351a05ac0c594f04a6e75d3e6c646dab"/><file name="Observer.php" hash="cf718b26a3bfae1a032b22ba8c8f080d"/></dir><dir name="etc"><file name="config.xml" hash="a4fe892a7d32c508f00360a617d8cf0b"/><file name="system.xml" hash="e1e8266f5e9c634bb24f45d508793fc4"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Dexxtz_Storemaintenance.xml" hash="deba2af2c0241c2500b48bc810909d35"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="dexxtz"><file name="store_maintenance.phtml" hash="ceab1b82db46bf62fbe674c6cf95ca72"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="pt_BR"><file name="Dexxtz_Storemaintenance.csv" hash="6b93ceaef205970438d41dc3b7860b88"/></dir><dir name="en_US"><dir name="pt_BR"><file name="Dexxtz_Storemaintenance.csv" hash=""/></dir></dir></target></contents>
|
23 |
<compatible/>
|
24 |
<dependencies><required><php><min>5.1.0</min><max>10.0.0</max></php></required></dependencies>
|
25 |
</package>
|