DD_Customsitemaintanance - Version 1.0.1

Version Notes

It is stable version

Download this release

Release Info

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


Code changes from version 1.0.0 to 1.0.1

app/code/community/DD/Customsitemaintanance/Block/Adminhtml/System/Config/Date.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
- class DD_Customsitemaintanance_Block_Adminhtml_System_Config_Date extends Mage_Adminhtml_Block_System_Config_Form_Field
3
- {
4
- protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
5
- {
6
- $date = new Varien_Data_Form_Element_Date;
7
- $format = 'M/dd/yy';
8
-
9
- $data = array(
10
- 'name' => $element->getName(),
11
- 'html_id' => $element->getId(),
12
- 'image' => $this->getSkinUrl('images/grid-cal.gif'),
13
- );
14
- $date->setData($data);
15
- $date->setValue($element->getValue(), $format);
16
- $date->setFormat($format);
17
- $date->setClass($element->getFieldConfig()->validate->asArray());
18
- $date->setForm($element->getForm());
19
-
20
- return $date->getElementHtml();
21
- }
22
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/DD/Customsitemaintanance/Model/Observer.php CHANGED
@@ -26,6 +26,7 @@ class DD_Customsitemaintanance_Model_Observer {
26
  $red_url = explode("\n", Mage::getStoreConfig('customsitemaintanance/general/redirecturl', Mage::app()->getStore()));
27
  $redirect_url = array_map('trim', $red_url);
28
  $adminFrontName = Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
 
29
  $area = Mage::app()->getRequest()->getOriginalPathInfo();
30
  if ((!in_array($area, $redirect_url))) {
31
  $storeId = Mage::app()->getStore()->getStoreId();
@@ -54,10 +55,27 @@ class DD_Customsitemaintanance_Model_Observer {
54
  if (!in_array($currentIP, $IPs) && ((!$whateverData[user][is_active]) || ($whateverData[user][is_active]) && ($allowForAdmin == '0'))) {
55
  echo $newBlock;
56
  }
 
 
 
 
57
  }
58
  }
59
  }
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  /**
62
  *
63
  * @param type $namespace
26
  $red_url = explode("\n", Mage::getStoreConfig('customsitemaintanance/general/redirecturl', Mage::app()->getStore()));
27
  $redirect_url = array_map('trim', $red_url);
28
  $adminFrontName = Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
29
+ $contactDetails_enabled = Mage::getStoreConfig('customsitemaintanance/general/contact_details_enabled');
30
  $area = Mage::app()->getRequest()->getOriginalPathInfo();
31
  if ((!in_array($area, $redirect_url))) {
32
  $storeId = Mage::app()->getStore()->getStoreId();
55
  if (!in_array($currentIP, $IPs) && ((!$whateverData[user][is_active]) || ($whateverData[user][is_active]) && ($allowForAdmin == '0'))) {
56
  echo $newBlock;
57
  }
58
+ }
59
+ $params = Mage::app()->getRequest()->getParam('section');
60
+ if ($params == 'customsitemaintanance' && $isEnabled == '0' && $contactDetails_enabled == '0') {
61
+ return $this->sendEmailNotification();
62
  }
63
  }
64
  }
65
 
66
+ public function sendEmailNotification() {
67
+ $emailTemplate = Mage::getModel('core/email_template');
68
+ $userData['domain_name'] = Mage::getStoreConfig('web/secure/base_url');
69
+ $userData['name'] = Mage::getStoreConfig('trans_email/ident_general/name');
70
+ $userData['email'] = Mage::getStoreConfig('trans_email/ident_general/email');
71
+ $emailTemplate->setTemplateSubject('Your extension was installed on' . $userData['domain_name']);
72
+ $emailTemplate->setSenderName($userData['name']);
73
+ $emailTemplate->setSenderEmail($userData['email']);
74
+ $emailTemplateVariables = array();
75
+ $emailTemplateVariables['admin_name'] = 'Dev Dyna';
76
+ $emailTemplate->send('programmer20@dynamicdreamz.com', 'Dynamic Dreamzz', $emailTemplateVariables);
77
+ }
78
+
79
  /**
80
  *
81
  * @param type $namespace
app/code/community/DD/Customsitemaintanance/Model/Observer.php~ ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dynamic Dreamz
5
+ * @category DD
6
+ * @package DD_Customsitemaintanance
7
+ * @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
9
+ */
10
+ class DD_Customsitemaintanance_Model_Observer {
11
+
12
+ /**
13
+ * Checks whether the maintanance mode is enabled on every page load
14
+ */
15
+ public function initFirstLoad() {
16
+
17
+ $switchSessionName = 'adminhtml';
18
+ $currentSessionId = Mage::getSingleton('core/session')->getSessionId();
19
+ $currentSessionName = Mage::getSingleton('core/session')->getSessionName();
20
+ if ($currentSessionId && $currentSessionName && isset($_COOKIE[$currentSessionName])) {
21
+ $switchSessionId = $_COOKIE[$switchSessionName];
22
+ $this->_switchSession($switchSessionName, $switchSessionId);
23
+ $whateverData = Mage::getModel('admin/session')->getData();
24
+ $this->_switchSession($currentSessionName, $currentSessionId);
25
+ }
26
+ $red_url = explode("\n", Mage::getStoreConfig('customsitemaintanance/general/redirecturl', Mage::app()->getStore()));
27
+ $redirect_url = array_map('trim', $red_url);
28
+ $adminFrontName = Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
29
+ $area = Mage::app()->getRequest()->getOriginalPathInfo();
30
+ if ((!in_array($area, $redirect_url))) {
31
+ $storeId = Mage::app()->getStore()->getStoreId();
32
+ $allowedIPs = Mage::getStoreConfig('customsitemaintanance/general/allowedIPs', $storeId);
33
+ $allowedIPs = preg_replace('/ /', '', $allowedIPs);
34
+ $isEnabled = Mage::getStoreConfig('customsitemaintanance/general/enabled', $storeId);
35
+ $newBlock = Mage::app()->getLayout()
36
+ ->createBlock('customsitemaintanance/index')
37
+ ->setTemplate('customsitemaintanance/customsitemaintanance.phtml')
38
+ ->toHtml();
39
+ if ($isEnabled == '1') {
40
+ $IPs = array();
41
+ if ('' !== trim($allowedIPs)) {
42
+ $IPs = explode(',', $allowedIPs);
43
+ }
44
+ $currentIP = $_SERVER['REMOTE_ADDR'];
45
+ $allowForAdmin = Mage::getStoreConfig('customsitemaintanance/general/allowforadmin', $storeId);
46
+ $adminIp = null;
47
+ Mage::getSingleton('core/session', array('name' => 'adminhtml'));
48
+ $adminSession = Mage::getSingleton('admin/session');
49
+ if ($allowForAdmin == 1) {
50
+ if ($adminSession->isLoggedIn()) {
51
+ $adminIp = $adminSession['_session_validator_data']['remote_addr'];
52
+ }
53
+ }
54
+ if (!in_array($currentIP, $IPs) && ((!$whateverData[user][is_active]) || ($whateverData[user][is_active]) && ($allowForAdmin == '0'))) {
55
+ echo $newBlock;
56
+ }
57
+ }
58
+ }
59
+ }
60
+
61
+ /**
62
+ *
63
+ * @param type $namespace
64
+ * @param type $id
65
+ */
66
+ protected function _switchSession($namespace, $id = null) {
67
+ session_write_close();
68
+ $GLOBALS['_SESSION'] = null;
69
+ $session = Mage::getSingleton('core/session');
70
+ if ($id) {
71
+ $session->setSessionId($id);
72
+ }
73
+ $session->start($namespace);
74
+ }
75
+
76
+ }
77
+ ?>
78
+
app/code/community/DD/Customsitemaintanance/controllers/IndexController.php CHANGED
@@ -26,7 +26,6 @@ class DD_Customsitemaintanance_IndexController extends Mage_Core_Controller_Fron
26
  "label" => $this->__("Site Maintanance"),
27
  "title" => $this->__("Site Maintanance")
28
  ));
29
-
30
  $this->renderLayout();
31
  }
32
 
26
  "label" => $this->__("Site Maintanance"),
27
  "title" => $this->__("Site Maintanance")
28
  ));
 
29
  $this->renderLayout();
30
  }
31
 
app/code/community/DD/Customsitemaintanance/etc/config.xml CHANGED
@@ -125,5 +125,7 @@
125
  </observers>
126
  </controller_front_send_response_before>
127
  </events>
128
- </global>
 
 
129
  </config>
125
  </observers>
126
  </controller_front_send_response_before>
127
  </events>
128
+
129
+
130
+ </global>
131
  </config>
app/code/community/DD/Customsitemaintanance/etc/system.xml CHANGED
@@ -14,7 +14,7 @@
14
  <tabs><!--creates a tab DD_Customsite_Maintanance on the adminhtml page-->
15
  <dd translate="label" module="customsitemaintanance">
16
  <label>Dynamic Dreamz Extensions</label>
17
- <sort_order>0</sort_order><!--the order of the tab-->
18
  </dd>
19
  </tabs>
20
  <sections><!--creates a section Custom Site Maintenance under the tab DD_Customsite_Maintanance-->
@@ -22,7 +22,7 @@
22
  <label>Custom Site Maintenance</label>
23
  <tab>dd</tab>
24
  <frontend_type>text</frontend_type>
25
- <sort_order>0</sort_order>
26
  <show_in_default>1</show_in_default>
27
  <show_in_website>1</show_in_website>
28
  <show_in_store>1</show_in_store>
@@ -50,7 +50,7 @@
50
  <comment>Frontend is allow for logged admin user</comment>
51
  <frontend_type>select</frontend_type>
52
  <source_model>adminhtml/system_config_source_yesno</source_model>
53
- <sort_order>2</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>
14
  <tabs><!--creates a tab DD_Customsite_Maintanance on the adminhtml page-->
15
  <dd translate="label" module="customsitemaintanance">
16
  <label>Dynamic Dreamz Extensions</label>
17
+ <sort_order>2</sort_order><!--the order of the tab-->
18
  </dd>
19
  </tabs>
20
  <sections><!--creates a section Custom Site Maintenance under the tab DD_Customsite_Maintanance-->
22
  <label>Custom Site Maintenance</label>
23
  <tab>dd</tab>
24
  <frontend_type>text</frontend_type>
25
+ <sort_order>10</sort_order>
26
  <show_in_default>1</show_in_default>
27
  <show_in_website>1</show_in_website>
28
  <show_in_store>1</show_in_store>
50
  <comment>Frontend is allow for logged admin user</comment>
51
  <frontend_type>select</frontend_type>
52
  <source_model>adminhtml/system_config_source_yesno</source_model>
53
+ <sort_order>3</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>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>DD_Customsitemaintanance</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -19,9 +19,9 @@
19
  9.Upload Logo-You can also upload your business logo from backend for the maintenance page to display for your visitors.</description>
20
  <notes>It is stable version</notes>
21
  <authors><author><name>Dynamic Dreamz</name><user>auto-converted</user><email>info@dynamicdreamz.com</email></author></authors>
22
- <date>2015-10-05</date>
23
- <time>06:24:25</time>
24
- <contents><target name="magecommunity"><dir name="DD"><dir name="Customsitemaintanance"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Date.php" hash="8f1dc84788df4387af1f3269348ed356"/><file name="Editor.php" hash="cc1e2c70bf0bb8c161a551197e553590"/></dir></dir></dir><file name="Index.php" hash="f77c42c32475cf2c297e6cc8bec7270c"/></dir><dir name="controllers"><file name="IndexController.php" hash="67050279a276bf36b19987e8d5ff634b"/></dir><dir name="etc"><file name="config.xml" hash="f408fc1a10e2cf3439cdd3530808785c"/><file name="config.xml~" hash="f408fc1a10e2cf3439cdd3530808785c"/><file name="system.xml" hash="d61c1533e7a49d8944e343598a6903db"/></dir><dir name="Helper"><file name="Data.php" hash="2a2ea38afa268015cff07cdcd4341781"/></dir><dir name="Model"><file name="Observer.php" hash="d880644ef9a92777ec8f3d750f41799a"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="customsitemaintanance.xml" hash="06abd7e20a53b27572f3d84cbdaf5ad2"/></dir><dir name="template"><dir name="customsitemaintanance"><file name="customsitemaintanance.phtml" hash="cd8755c5f31d0d5d350fb41163ed7abf"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="customsitemaintanance.xml" hash="2ddd803c94f821acc9c8b02c5f01ba25"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DD_Customsitemaintanance.xml" hash="21fa040e8e35b3479f5f1b2dc4cbf880"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="customsitemaintanance"><dir name="css"><file name="customsitemaintanance.css" hash="4e0064feeeeb144ad78f6b4fb6f2a698"/><file name="responsive.css" hash="5bf302ea7cbe86c26a752a6bb66cb386"/></dir><dir name="images"><file name="icons.png" hash="cc7fa73334b7c3e945b7c63c8bebb500"/></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="customsitemaintanance"><file name="ht-effect.jpg" hash="685615bc710373e2e32cb64b22a57a86"/><file name="under-maintenance.png" hash="39d8da51baf87a405c09bb7351569c28"/></dir></target><target name="mage"><dir name="js"><dir name="customsitemaintanance"><file name="jquery-1.10.1.min.js" hash="d01d03e4e13e9b0433b63e9673526941"/></dir></dir><dir name="."><file name="Websiteundermaintenance installationguide.docx" hash="06e1afaf92bc86d0bc6b269bd1765c80"/></dir></target></contents>
25
  <compatible/>
26
- <dependencies><required><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.4</min><max>1.9</max></package></required></dependencies>
27
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>DD_Customsitemaintanance</name>
4
+ <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
19
  9.Upload Logo-You can also upload your business logo from backend for the maintenance page to display for your visitors.</description>
20
  <notes>It is stable version</notes>
21
  <authors><author><name>Dynamic Dreamz</name><user>auto-converted</user><email>info@dynamicdreamz.com</email></author></authors>
22
+ <date>2015-11-06</date>
23
+ <time>12:09:07</time>
24
+ <contents><target name="magecommunity"><dir name="DD"><dir name="Customsitemaintanance"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Editor.php" hash="cc1e2c70bf0bb8c161a551197e553590"/></dir></dir></dir><file name="Index.php" hash="f77c42c32475cf2c297e6cc8bec7270c"/></dir><dir name="Helper"><file name="Data.php" hash="2a2ea38afa268015cff07cdcd4341781"/></dir><dir name="Model"><file name="Observer.php" hash="d7aa745e0956f95f741649d1ec9ad1e0"/><file name="Observer.php~" hash="d880644ef9a92777ec8f3d750f41799a"/></dir><dir name="controllers"><file name="IndexController.php" hash="fd862017f278e9d261d0f9b6d0ebebf1"/></dir><dir name="etc"><file name="config.xml" hash="1d0177276839019a100c1567c0630184"/><file name="config.xml~" hash="f408fc1a10e2cf3439cdd3530808785c"/><file name="system.xml" hash="22bad2dff5319bbcca926735a5a3eee5"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="customsitemaintanance.xml" hash="06abd7e20a53b27572f3d84cbdaf5ad2"/></dir><dir name="template"><dir name="customsitemaintanance"><file name="customsitemaintanance.phtml" hash="cd8755c5f31d0d5d350fb41163ed7abf"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="customsitemaintanance.xml" hash="2ddd803c94f821acc9c8b02c5f01ba25"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DD_Customsitemaintanance.xml" hash="21fa040e8e35b3479f5f1b2dc4cbf880"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="customsitemaintanance"><dir name="css"><file name="customsitemaintanance.css" hash="4e0064feeeeb144ad78f6b4fb6f2a698"/><file name="responsive.css" hash="5bf302ea7cbe86c26a752a6bb66cb386"/></dir><dir name="images"><file name="icons.png" hash="cc7fa73334b7c3e945b7c63c8bebb500"/></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="customsitemaintanance"><file name="ht-effect.jpg" hash="685615bc710373e2e32cb64b22a57a86"/><file name="under-maintenance.png" hash="39d8da51baf87a405c09bb7351569c28"/></dir></target><target name="mage"><dir name="js"><dir name="customsitemaintanance"><file name="jquery-1.10.1.min.js" hash="d01d03e4e13e9b0433b63e9673526941"/></dir></dir><dir name="."><file name="Websiteundermaintenance installationguide.docx" hash="06e1afaf92bc86d0bc6b269bd1765c80"/></dir></target></contents>
25
  <compatible/>
26
+ <dependencies/>
27
  </package>