DeveloperToolbar - Version 1.2

Version Notes

Compatible with magento 1.2.x - 1.4.x

Download this release

Release Info

Developer Magento Core Team
Extension DeveloperToolbar
Version 1.2
Comparing to
See all releases


Code changes from version 1.1.3 to 1.2

app/code/community/HM/DeveloperToolbar/controllers/IndexController.php CHANGED
@@ -2,70 +2,158 @@
2
 
3
  class HM_DeveloperToolbar_IndexController extends Mage_Core_Controller_Front_Action
4
  {
5
- public function hintsAction()
6
- {
7
- $enabled = $this->getRequest()->getParam('enabled');
8
- $type = $this->getRequest()->getParam('type');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
- $scope = $type === 'front' ? 'stores' : 'default';
11
- $scope_id = $type === 'front' ? Mage::app()->getStore()->getStoreId() : '0';
12
- Mage::getConfig()->saveConfig('dev/debug/template_hints', $enabled, $scope, $scope_id);
13
- Mage::getConfig()->saveConfig('dev/debug/template_hints_blocks', $enabled, $scope, $scope_id);
14
 
15
- $this->_redirectReferer();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
17
 
18
  public function logAction()
19
- {
20
- $scope = 'stores';
21
- $scope_id = Mage::app()->getStore()->getStoreId();
22
- $enabled = $this->getRequest()->getParam('enabled');
23
- Mage::getConfig()->saveConfig('dev/log/active', $enabled, $scope, $scope_id);
24
- $this->_redirectReferer();
 
 
 
 
25
  }
26
 
27
  public function jsAction()
28
- {
29
- $scope = 'stores';
30
- $scope_id = Mage::app()->getStore()->getStoreId();
31
- $enabled = $this->getRequest()->getParam('enabled');
32
- Mage::getConfig()->saveConfig('dev/js/merge_files', $enabled, $scope, $scope_id);
33
- $this->_redirectReferer();
 
 
 
 
 
 
 
34
  }
35
 
36
  public function urlAction()
37
- {
38
- $enabled = $this->getRequest()->getParam('enabled');
39
- Mage::getConfig()->saveConfig('web/url/use_store', $enabled);
40
- $this->_redirectReferer();
 
 
 
 
 
 
41
  }
42
 
43
  public function seoAction()
44
  {
45
- $enabled = $this->getRequest()->getParam('enabled');
46
- Mage::getConfig()->saveConfig('web/seo/use_rewrites', $enabled);
47
- $this->_redirectReferer();
 
 
 
 
 
 
48
  }
49
 
50
  public function translateAction()
51
- {
52
- $scope = 'stores';
53
- $scope_id = Mage::app()->getStore()->getStoreId();
54
- $enabled = $this->getRequest()->getParam('enabled');
55
- Mage::getConfig()->saveConfig('dev/translate_inline/active', $enabled, $scope, $scope_id);
56
- $this->_redirectReferer();
 
 
 
 
 
 
57
  }
58
 
59
  public function cacheAction()
60
- {
61
- Mage::app()->cleanCache();
62
- $cacheTypes = array_keys(Mage::helper('core')->getCacheTypes());
63
- $enable = array();
64
- foreach ($cacheTypes as $type) {
65
- $enable[$type] = 0;
66
- }
67
- Mage::app()->saveUseCache($enable);
68
- $this->_redirectReferer();
 
 
 
 
 
 
69
  }
70
  }
71
  ?>
2
 
3
  class HM_DeveloperToolbar_IndexController extends Mage_Core_Controller_Front_Action
4
  {
5
+ function check()
6
+ {
7
+ $getConfigCustomer = Mage::getStoreConfig('dev/developertoolbar/enablename');
8
+ $getCustomer = Mage::getSingleton('customer/customer')->load(Mage::getSingleton('customer/session')->getId())->getEmail();
9
+ $getCustomerArray = explode(",",$getConfigCustomer);
10
+
11
+ $getConfigIp = Mage::getStoreConfig('dev/developertoolbar/enableip');
12
+ $getIp = $_SERVER["REMOTE_ADDR"];
13
+ $getIprArray = explode(",",$getConfigIp);
14
+
15
+ $getConfigIp==""?$checkip=false:$checkip=true;
16
+ $enablename = false;
17
+ for($i=0;$i<sizeof($getCustomerArray);$i++)
18
+ {
19
+ if($getCustomer == trim($getCustomerArray[$i]))
20
+ {
21
+ $enablename = true;
22
+ break;
23
+ }
24
+ }
25
 
26
+ $getConfigCustomer==""?$checkcustomer=false:$checkcustomer=true;
 
 
 
27
 
28
+ $enableip = false;
29
+ for($i=0;$i<sizeof($getIprArray);$i++)
30
+ {
31
+ if($getIp == trim($getIprArray[$i]))
32
+ {
33
+ $enableip = true;
34
+ break;
35
+ }
36
+ }
37
+ $case=false;
38
+ if(!$checkip && !$checkcustomer && Mage::getStoreConfig('dev/developertoolbar/enabled')) $case=true;
39
+
40
+ if($checkip && !$checkcustomer)
41
+ {
42
+ if(Mage::getStoreConfig('dev/developertoolbar/enabled') && $enableip) $case=true;
43
+ }
44
+ else if(!$checkip && $checkcustomer)
45
+ {
46
+ if(Mage::getStoreConfig('dev/developertoolbar/enabled') && $enablename) $case=true;
47
+ }
48
+ else if($checkip && $checkcustomer)
49
+ {
50
+ if(((Mage::getStoreConfig('dev/developertoolbar/enabled') && $enablename)) && ((Mage::getStoreConfig('dev/developertoolbar/enabled') && $enableip))) $case =true;
51
+ }
52
+ return $case;
53
+ }
54
+
55
+ public function hintsAction()
56
+ {
57
+ if(!$this->check())
58
+ $this->_forward('noRoute');
59
+ else{
60
+ $enabled = $this->getRequest()->getParam('enabled');
61
+ $type = $this->getRequest()->getParam('type');
62
+ $scope = $type === 'front' ? 'stores' : 'default';
63
+ $scope_id = $type === 'front' ? Mage::app()->getStore()->getStoreId() : '0';
64
+ Mage::getConfig()->saveConfig('dev/debug/template_hints', $enabled, $scope, $scope_id);
65
+ Mage::getConfig()->saveConfig('dev/debug/template_hints_blocks', $enabled, $scope, $scope_id);
66
+
67
+ $this->_redirectReferer();
68
+ }
69
  }
70
 
71
  public function logAction()
72
+ {
73
+ if(!$this->check())
74
+ $this->_forward('noRoute');
75
+ else{
76
+ $scope = 'stores';
77
+ $scope_id = Mage::app()->getStore()->getStoreId();
78
+ $enabled = $this->getRequest()->getParam('enabled');
79
+ Mage::getConfig()->saveConfig('dev/log/active', $enabled, $scope, $scope_id);
80
+ $this->_redirectReferer();
81
+ }
82
  }
83
 
84
  public function jsAction()
85
+ {
86
+
87
+ if(!$this->check())
88
+ $this->_forward('noRoute');
89
+ else{
90
+ $scope = 'stores';
91
+ $scope_id = Mage::app()->getStore()->getStoreId();
92
+ $enabled = $this->getRequest()->getParam('enabled');
93
+ Mage::getConfig()->saveConfig('dev/js/merge_files', $enabled, $scope, $scope_id);
94
+ if(!Mage::getStoreConfig('dev/js/merge_files') || !Mage::getStoreConfig('dev/developertoolbar/enabled'))
95
+ $this->_forward('noRoute');
96
+ $this->_redirectReferer();
97
+ }
98
  }
99
 
100
  public function urlAction()
101
+ {
102
+ if(!$this->check())
103
+ $this->_forward('noRoute');
104
+ else{
105
+ $enabled = $this->getRequest()->getParam('enabled');
106
+ Mage::getConfig()->saveConfig('web/url/use_store', $enabled);
107
+ if(!Mage::getStoreConfig('web/url/use_store') || !Mage::getStoreConfig('dev/developertoolbar/enabled'))
108
+ $this->_forward('noRoute');
109
+ $this->_redirectReferer();
110
+ }
111
  }
112
 
113
  public function seoAction()
114
  {
115
+ if(!$this->check())
116
+ $this->_forward('noRoute');
117
+ else{
118
+ $enabled = $this->getRequest()->getParam('enabled');
119
+ Mage::getConfig()->saveConfig('web/seo/use_rewrites', $enabled);
120
+ if(!Mage::getStoreConfig('web/seo/use_rewrites') || !Mage::getStoreConfig('dev/developertoolbar/enabled'))
121
+ $this->_forward('noRoute');
122
+ $this->_redirectReferer();
123
+ }
124
  }
125
 
126
  public function translateAction()
127
+ {
128
+ if(!$this->check())
129
+ $this->_forward('noRoute');
130
+ else{
131
+ $scope = 'stores';
132
+ $scope_id = Mage::app()->getStore()->getStoreId();
133
+ $enabled = $this->getRequest()->getParam('enabled');
134
+ Mage::getConfig()->saveConfig('dev/translate_inline/active', $enabled, $scope, $scope_id);
135
+ if(!Mage::getStoreConfig('dev/translate_inline/active') || !Mage::getStoreConfig('dev/developertoolbar/enabled'))
136
+ $this->_forward('noRoute');
137
+ $this->_redirectReferer();
138
+ }
139
  }
140
 
141
  public function cacheAction()
142
+ {
143
+ if(!$this->check())
144
+ $this->_forward('noRoute');
145
+ else{
146
+ Mage::app()->cleanCache();
147
+ $cacheTypes = array_keys(Mage::helper('core')->getCacheTypes());
148
+ $enable = array();
149
+ foreach ($cacheTypes as $type) {
150
+ $enable[$type] = 0;
151
+ }
152
+ Mage::app()->saveUseCache($enable);
153
+ if(!Mage::getStoreConfig('dev/developertoolbar/enabled'))
154
+ $this->_forward('noRoute');
155
+ $this->_redirectReferer();
156
+ }
157
  }
158
  }
159
  ?>
app/code/community/HM/DeveloperToolbar/etc/system.xml CHANGED
@@ -53,6 +53,22 @@
53
  <show_in_website>1</show_in_website>
54
  <show_in_store>1</show_in_store>
55
  </enabled>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  </fields>
57
  </developertoolbar>
58
  </groups>
53
  <show_in_website>1</show_in_website>
54
  <show_in_store>1</show_in_store>
55
  </enabled>
56
+ <enablename>
57
+ <label>Allowed Users (comma separated)</label>
58
+ <frontend_type>text</frontend_type>
59
+ <sort_order>21</sort_order>
60
+ <show_in_default>1</show_in_default>
61
+ <show_in_website>1</show_in_website>
62
+ <show_in_store>1</show_in_store>
63
+ </enablename>
64
+ <enableip>
65
+ <label>Allowed IPs (comma separated)</label>
66
+ <frontend_type>text</frontend_type>
67
+ <sort_order>22</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ </enableip>
72
  </fields>
73
  </developertoolbar>
74
  </groups>
app/design/frontend/default/default/template/developertoolbar/toolbar.phtml CHANGED
@@ -1,4 +1,55 @@
1
- <?php if(Mage::getStoreConfig('dev/developertoolbar/enabled')): ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  <style>
3
  .developertoolbar {
4
  position: fixed;
@@ -60,6 +111,7 @@ function hide_developer_toolbar(){
60
  }
61
  }
62
  </script>
 
63
  <div class="developertoolbar" id="developertoolbar">
64
  <a href="" onclick="hide_developer_toolbar(); return false;"><span class="bar_name">Developer Toolbar</span></a>
65
 
@@ -89,4 +141,4 @@ function hide_developer_toolbar(){
89
  <a style="color:#FF0000;" href="<?php echo $this->getUrl('developertoolbar/index/cache/') ?>">Clean & Disable All Cache</a>
90
  </span>
91
  </div>
92
- <?php endif; ?>
1
+ <?php
2
+ $getConfigCustomer = Mage::getStoreConfig('dev/developertoolbar/enablename');
3
+ $getCustomer = Mage::getSingleton('customer/customer')->load(Mage::getSingleton('customer/session')->getId())->getEmail();
4
+ $getCustomerArray = explode(",",$getConfigCustomer);
5
+
6
+ $getConfigIp = Mage::getStoreConfig('dev/developertoolbar/enableip');
7
+ $getIp = $_SERVER["REMOTE_ADDR"];
8
+ $getIprArray = explode(",",$getConfigIp);
9
+
10
+ $getConfigIp==""?$checkip=false:$checkip=true;
11
+ $enablename = false;
12
+ for($i=0;$i<sizeof($getCustomerArray);$i++)
13
+ {
14
+ if($getCustomer == trim($getCustomerArray[$i]))
15
+ {
16
+ $enablename = true;
17
+ break;
18
+ }
19
+ }
20
+
21
+ $getConfigCustomer==""?$checkcustomer=false:$checkcustomer=true;
22
+
23
+ $enableip = false;
24
+ for($i=0;$i<sizeof($getIprArray);$i++)
25
+ {
26
+ if($getIp == trim($getIprArray[$i]))
27
+ {
28
+ $enableip = true;
29
+ break;
30
+ }
31
+ }
32
+ $case=false;
33
+ if(!$checkip && !$checkcustomer && Mage::getStoreConfig('dev/developertoolbar/enabled')) $case=true;
34
+
35
+ if($checkip && !$checkcustomer)
36
+ {
37
+ if(Mage::getStoreConfig('dev/developertoolbar/enabled') && $enableip) $case=true;
38
+ }
39
+ else if(!$checkip && $checkcustomer)
40
+ {
41
+ if(Mage::getStoreConfig('dev/developertoolbar/enabled') && $enablename) $case=true;
42
+ }
43
+ else if($checkip && $checkcustomer)
44
+ {
45
+ if(((Mage::getStoreConfig('dev/developertoolbar/enabled') && $enablename)) && ((Mage::getStoreConfig('dev/developertoolbar/enabled') && $enableip))) $case =true;
46
+ }
47
+
48
+ if(!$case){
49
+ exit;
50
+ }else{
51
+
52
+ ?>
53
  <style>
54
  .developertoolbar {
55
  position: fixed;
111
  }
112
  }
113
  </script>
114
+
115
  <div class="developertoolbar" id="developertoolbar">
116
  <a href="" onclick="hide_developer_toolbar(); return false;"><span class="bar_name">Developer Toolbar</span></a>
117
 
141
  <a style="color:#FF0000;" href="<?php echo $this->getUrl('developertoolbar/index/cache/') ?>">Clean & Disable All Cache</a>
142
  </span>
143
  </div>
144
+ <?php } ?>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>DeveloperToolbar</name>
4
- <version>1.1.3</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>
8
  <extends/>
9
  <summary>A must have extension of Magento Developer</summary>
10
  <description>Developer Toolbar is an useful tool for magento developer. It allow you access quickly to regular used functions without logging in to admin.</description>
11
- <notes>Compatible with magento 1.2.x - 1.3.x</notes>
12
- <authors><author><name>Hai NGUYEN</name><user>auto-converted</user><email>haint@hello-magento.com</email></author></authors>
13
- <date>2010-02-05</date>
14
- <time>08:00:55</time>
15
- <contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="developertoolbar.xml" hash="ce223c8b7ebcb02b94001298493a538d"/></dir><dir name="template"><dir name="developertoolbar"><file name="toolbar.phtml" hash="28bb1b032cc255e17beb0cd6c1cc79f6"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="HM"><dir name="DeveloperToolbar"><dir name="controllers"><file name="IndexController.php" hash="9b51ca0d357576b3ba0c892c39cab231"/></dir><dir name="etc"><file name="config.xml" hash="88dccd6de1a371868366e88d2b46e457"/><file name="system.xml" hash="d3a464b2dafd444f734c948f4c8e43b8"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="HM_DeveloperToolbar.xml" hash="08f56679bb2ba0892395f48520b0c09a"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>DeveloperToolbar</name>
4
+ <version>1.2</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>
8
  <extends/>
9
  <summary>A must have extension of Magento Developer</summary>
10
  <description>Developer Toolbar is an useful tool for magento developer. It allow you access quickly to regular used functions without logging in to admin.</description>
11
+ <notes>Compatible with magento 1.2.x - 1.4.x</notes>
12
+ <authors><author><name>Hai NGUYEN</name><user>auto-converted</user><email>haint@mage-world.com</email></author></authors>
13
+ <date>2010-04-10</date>
14
+ <time>14:41:58</time>
15
+ <contents><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="developertoolbar.xml" hash="ce223c8b7ebcb02b94001298493a538d"/></dir><dir name="template"><dir name="developertoolbar"><file name="toolbar.phtml" hash="c1b37de01864a10a6ca2e87a2ae5cf51"/></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="HM"><dir name="DeveloperToolbar"><dir name="controllers"><file name="IndexController.php" hash="1ec8252b57d58fdb48b479dced5d0519"/></dir><dir name="etc"><file name="config.xml" hash="88dccd6de1a371868366e88d2b46e457"/><file name="system.xml" hash="4fa690d966befea2c4605983306ec8c5"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="HM_DeveloperToolbar.xml" hash="08f56679bb2ba0892395f48520b0c09a"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>