Briel_VisitorIpSecurity - Version 0.3.1

Version Notes

Stable version, fully functional on our website.

Download this release

Release Info

Developer Velica Onel
Extension Briel_VisitorIpSecurity
Version 0.3.1
Comparing to
See all releases


Code changes from version 0.3.0 to 0.3.1

app/code/local/Briel/Visitoripsecurity/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Briel_Visitoripsecurity>
5
- <version>0.3.0</version>
6
  </Briel_Visitoripsecurity>
7
  </modules>
8
  <default>
2
  <config>
3
  <modules>
4
  <Briel_Visitoripsecurity>
5
+ <version>0.3.1</version>
6
  </Briel_Visitoripsecurity>
7
  </modules>
8
  <default>
app/code/local/Briel/Visitoripsecurity/sql/visitoripsecurity_setup/{mysql4-install-0.3.0.php → mysql4-install-0.3.1.php} RENAMED
File without changes
app/design/adminhtml/default/default/template/briel/visitoripsecurity/inline-edit.phtml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ function updateNote(button, fieldId)
3
+ {
4
+ new Ajax.Request('<?php echo Mage::helper("adminhtml")->getUrl("*/*/updateNote") ?>', {
5
+ method: 'post',
6
+ parameters: { id: fieldId, note: $(button).getValue() }
7
+ });
8
+ }
9
+ function blockThisIp(button, fieldId)
10
+ {
11
+ new Ajax.Request('<?php echo Mage::helper("adminhtml")->getUrl("*/*/blockThisIp") ?>', {
12
+ method: 'post',
13
+ parameters: { ip: fieldId },
14
+ onSuccess: function(response){
15
+ $(button).up(1).hide();
16
+ //$(button).up().update(response.responseText);
17
+
18
+ }
19
+ });
20
+ }
21
+ function unBlockThisIp(button, fieldId)
22
+ {
23
+ new Ajax.Request('<?php echo Mage::helper("adminhtml")->getUrl("*/*/unBlockThisIp") ?>', {
24
+ method: 'post',
25
+ parameters: { ip: fieldId },
26
+ onSuccess: function(response){
27
+ $(button).up(1).hide();
28
+ //$(button).up().update(response.responseText);
29
+ }
30
+ });
31
+ }
32
+ function whiteThisIp(button, fieldId)
33
+ {
34
+ new Ajax.Request('<?php echo Mage::helper("adminhtml")->getUrl("*/*/whiteThisIp") ?>', {
35
+ method: 'post',
36
+ parameters: { ip: fieldId },
37
+ onSuccess: function(response){
38
+ $(button).up(1).hide();
39
+ //$(button).up().update(response.responseText);
40
+ }
41
+ });
42
+ }
43
+ function unWhiteThisIp(button, fieldId)
44
+ {
45
+ new Ajax.Request('<?php echo Mage::helper("adminhtml")->getUrl("*/*/unWhiteThisIp") ?>', {
46
+ method: 'post',
47
+ parameters: { ip: fieldId },
48
+ onSuccess: function(response){
49
+ $(button).up(1).hide();
50
+ //$(button).up().update(response.responseText);
51
+ }
52
+ });
53
+ }
54
+ function watchThisIp(button, fieldId)
55
+ {
56
+ new Ajax.Request('<?php echo Mage::helper("adminhtml")->getUrl("*/*/watchThisIp") ?>', {
57
+ method: 'post',
58
+ parameters: { ip: fieldId },
59
+ onSuccess: function(response){
60
+ $(button).up(1).hide();
61
+ //$(button).up().update(response.responseText);
62
+ }
63
+ });
64
+ }
65
+ function unWatchThisIp(button, fieldId)
66
+ {
67
+ new Ajax.Request('<?php echo Mage::helper("adminhtml")->getUrl("*/*/unWatchThisIp") ?>', {
68
+ method: 'post',
69
+ parameters: { ip: fieldId },
70
+ onSuccess: function(response){
71
+ $(button).up(1).hide();
72
+ //$(button).up().update(response.responseText);
73
+ }
74
+ });
75
+ }
76
+ </script>
77
+
78
+ <?php
app/design/adminhtml/default/default/template/briel/visitoripsecurity/oneip.phtml ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="content-header">
3
+ <table cellspacing="0">
4
+ <tr>
5
+ <td>
6
+ <h3 class="icon-head"><?php echo $this->__('Block IP classes or single IP'); ?></h3></td>
7
+ <td class="form-buttons">
8
+ <button title="<?php echo $this->__('View list'); ?>" type="button" class="scalable " onclick="setLocation('<?php echo Mage::helper("adminhtml")->getUrl('*/*/index'); ?>')" style="">
9
+ <span><span><span><?php echo $this->__('View list'); ?></span></span></span>
10
+ </button>
11
+ <button title="<?php echo $this->__('View blocked'); ?>" type="button" class="scalable " onclick="setLocation('<?php echo Mage::helper("adminhtml")->getUrl('*/*/blocked'); ?>')" style="">
12
+ <span><span><span><?php echo $this->__('View blocked'); ?></span></span></span>
13
+ </button>
14
+ <button title="<?php echo $this->__('View white list'); ?>" type="button" class="scalable " onclick="setLocation('<?php echo Mage::helper("adminhtml")->getUrl('*/*/white'); ?>')" style="">
15
+ <span><span><span><?php echo $this->__('View white list'); ?></span></span></span>
16
+ </button>
17
+ <button title="<?php echo $this->__('View watch list'); ?>" type="button" class="scalable " onclick="setLocation('<?php echo Mage::helper("adminhtml")->getUrl('*/*/watch'); ?>')" style="">
18
+ <span><span><span><?php echo $this->__('View watch list'); ?></span></span></span>
19
+ </button>
20
+ <button title="<?php echo $this->__('Block ip classes'); ?>" type="button" class="scalable " onclick="setLocation('<?php echo Mage::helper("adminhtml")->getUrl('*/*/oneip'); ?>')" style="">
21
+ <span><span><span><?php echo $this->__('Block ip classes'); ?></span></span></span>
22
+ </button>
23
+ </td>
24
+ </tr>
25
+ </table>
26
+ </div>
27
+ <div>
28
+ <ul class="messages">
29
+ <li class="notice-msg">
30
+ <ul>
31
+ <li>
32
+ <?php echo $this->__('You can use * as a wildcard to block an entire IP class. Ex: 192.168.0.*'); ?>
33
+ </li>
34
+ </ul>
35
+ </li>
36
+ </ul>
37
+ </div>
38
+ <br />
39
+ <div class="grid" style="width: 500px;">
40
+ <table class="data" cellspacing="0">
41
+ <thead>
42
+ <tr class="headings">
43
+ <th colspan="2" style="padding: 5px;">
44
+ <?php echo $this->__('Block this ip'); ?>
45
+ </th>
46
+ </tr>
47
+ </thead>
48
+ <tbody>
49
+ <tr class="even">
50
+ <td style="padding: 15px;" width="60%">
51
+ <input type="text" class="input-text" id="ip_to_block" value="" style="width: 220px;" />
52
+ </td>
53
+ <td style="padding: 15px; text-align: center;">
54
+ <button title="<?php echo $this->__('Block this ip'); ?>" type="button" class="scalable " onclick="block_one_ip();" style="">
55
+ <span><span><span><?php echo $this->__('Block this ip'); ?></span></span></span>
56
+ </button>
57
+ </td>
58
+ </tr>
59
+ </tbody>
60
+ </table>
61
+ </div>
62
+ <br />
63
+
64
+ <div class="grid" style="width: 500px;">
65
+ <table class="data" cellspacing="0" id="blocked_ip_classes">
66
+ <thead>
67
+ <tr class="headings">
68
+ <th colspan="2" style="padding: 5px;">
69
+ <?php echo $this->__('Blocked ip classes'); ?>
70
+ </th>
71
+ </tr>
72
+ </thead>
73
+ <tbody>
74
+ <?php
75
+
76
+ $arrBlocked = Mage::helper('visitoripsecurity')->getBlocked();
77
+ $i = 0;
78
+ foreach ($arrBlocked as $k => $v){
79
+ if(stripos($v, "*") !== false){
80
+ $i++;
81
+ ?>
82
+ <tr class="even">
83
+ <td style="padding: 5px;" width="60%"><?php echo $v; ?></td>
84
+ <td style="padding: 5px; text-align: center;">
85
+ <button title="<?php echo $this->__('Unblock this ip'); ?>" type="button" class="scalable " onclick="unblock_one_ip('<?php echo $v; ?>', this);" style="">
86
+ <span><span><span><?php echo $this->__('Unblock this ip'); ?></span></span></span>
87
+ </button>
88
+ </td>
89
+ </tr>
90
+
91
+ <?php
92
+ }
93
+ }
94
+
95
+ //var_dump($arrBlocked);
96
+ ?>
97
+ </tbody>
98
+ </table>
99
+ </div>
100
+ <?php
101
+ $button = '<button title="'.$this->__('Unblock this ip').'" type="button" class="scalable " onclick="unblock_one_ip('.$v.', this);" style="">';
102
+ $button .= '<span><span><span>'.$this->__('Unblock this ip').'</span></span></span>';
103
+ $button .= '</button>';
104
+ ?>
105
+ <script type="text/javascript">
106
+ function block_one_ip(){
107
+ var ip_to_bl = document.getElementById('ip_to_block').value;
108
+ if(ip_to_bl){
109
+ //alert(ip_to_bl);
110
+ new Ajax.Request('<?php echo Mage::helper("adminhtml")->getUrl("*/*/blockOneIp") ?>', {
111
+ method: 'post',
112
+ parameters: { ip: ip_to_bl},
113
+ onSuccess: function(response){
114
+ //alert(response.responseText);
115
+ if(response.responseText == 'blocked'){
116
+ $('messages').update('<ul class="messages"><li class="notice-msg"><ul><li><?php echo $this->__('IP'); ?> '+ip_to_bl+' <?php echo $this->__('was blocked'); ?></li></ul></li></ul>');
117
+ //$('blocked_ip_classes').insert('<tr class="even"><td style="padding: 5px;">'+ip_to_bl+'</td><td style="padding: 5px; text-align: center;"></td></tr>');
118
+ tr = new Element('tr').addClassName('even');
119
+ tr.insert(new Element('td').setStyle({'padding': '5px'}).update(ip_to_bl));
120
+ tr.insert(new Element('td').setStyle({'textAlign': 'center', 'padding': '5px'}).update(''));
121
+ $('blocked_ip_classes').down('tbody').insert(tr);
122
+ }else{
123
+ $('messages').update('<ul class="messages"><li class="notice-msg"><ul><li>'+response.responseText+'</li></ul></li></ul>');
124
+ }
125
+
126
+ //$(button).up().update(response.responseText);
127
+
128
+ }
129
+ });
130
+ }else{
131
+ alert('<?php echo $this->__('Ip field cannot be empty!'); ?>');
132
+ }
133
+ }
134
+ function unblock_one_ip(ip, field){
135
+
136
+ //alert(ip_to_bl);
137
+ new Ajax.Request('<?php echo Mage::helper("adminhtml")->getUrl("*/*/unblockOneIp") ?>', {
138
+ method: 'post',
139
+ parameters: { ip: ip},
140
+ onSuccess: function(response){
141
+ //alert(response.responseText);
142
+ $('messages').update('<ul class="messages"><li class="notice-msg"><ul><li>'+response.responseText+'</li></ul></li></ul>');
143
+ $(field).up(1).hide();
144
+ //$(button).up().update(response.responseText);
145
+
146
+ }
147
+ });
148
+
149
+ }
150
+
151
+ </script>
152
+
153
+ <?php
154
+ ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Briel_VisitorIpSecurity</name>
4
- <version>0.3.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/gpl-license.php">GNU General Public License (GPL)</license>
7
  <channel>community</channel>
@@ -16,9 +16,9 @@
16
  - email notification when any ip has more then a certain number of visits</description>
17
  <notes>Stable version, fully functional on our website.</notes>
18
  <authors><author><name>Velica Onel</name><user>mage_briel</user><email>mage@briel.ro</email></author></authors>
19
- <date>2014-09-27</date>
20
- <time>10:54:52</time>
21
- <contents><target name="magelocal"><dir name="Briel"><dir name="Visitoripsecurity"><dir name="Block"><dir name="Adminhtml"><file name="Blocked.php" hash="33a3043d5a87b31a5da1baa44e38189e"/><file name="Grid.php" hash="4248a2b9f787ceb5bc7e597abdfb5f4d"/><file name="Logurl.php" hash="cc8c46363a2dd600f620e4c7e17b0e92"/><file name="Oneip.php" hash="b57cd3ce62b33fb8f1c486106035cec4"/><dir name="Visitoripsecurity"><dir name="Blocked"><file name="Grid.php" hash="d321f1bd3329c3b6ab640bfc37e04034"/></dir><file name="Grid.php" hash="105d4ec67128ee9aa4f945e1d9475e93"/><dir name="Logurl"><file name="Grid.php" hash="6d37f6a97fcaa46c31883e1dc05ee158"/></dir><dir name="Oneip"><file name="Block.php" hash="bdbd31b85d8cc3bbb2affbaf2e3dbceb"/></dir><dir name="Renderer"><file name="Blockthisip.php" hash="36b650bf097db55b92bf1bb1dd92ced1"/><file name="Count.php" hash="2350b63f23c6f70a5c926a2647320183"/><file name="Firstvisit.php" hash="0f35b6e245e5d107d9e1cb7d598a1928"/><file name="Google.php" hash="32de8dc43091331794a455d6ef866256"/><file name="Lasturl.php" hash="8ca49c2016294db423823879a3eae866"/><file name="Lastvisit.php" hash="24312fcd960774793d22fb70d849064a"/><file name="Notes.php" hash="0ec22910ca8838f0dca025cfc6fad999"/><file name="Pretty.php" hash="a19a856a05afa57df2eb43a781d2d0c9"/><file name="Watchthisip.php" hash="e76fc4de0c64d40304b0fa701726f959"/><file name="Whitethisip.php" hash="66a77f968542d8078c4da42d444e8c0b"/></dir><file name="Renderer.php" hash="68b74b3d0da4582cfbadb9b39cff0ea6"/><dir name="Watch"><file name="Grid.php" hash="08e7d30bd586f288d8b34e89486b597f"/></dir><dir name="White"><file name="Grid.php" hash="5cb80b664833cb4236bb25fadaf4dcf9"/></dir></dir><file name="Watch.php" hash="cfcd4d46cecf14b22520034080e0fe8e"/><file name="White.php" hash="68554d80f01ca19883dc7cacc5edf141"/></dir></dir><dir name="Helper"><file name="Data.php" hash="047ed0a80bb55c95b1b59517fd518901"/></dir><dir name="Model"><dir name="Log"><dir name="Remoteaddr"><file name="Notes.php" hash="438b0b61d28f73d08894c38ae9c0bb7c"/></dir><file name="Url.php" hash="a9dd406c9de369a95aabc1350765c566"/></dir><dir name="Mysql4"><dir name="Log"><dir name="Remoteaddr"><dir name="Notes"><file name="Collection.php" hash="3a0fbe8040b0522fe9f75443f357763b"/></dir><file name="Notes.php" hash="8126aa142aa289b71c905133335476e2"/></dir><dir name="Url"><file name="Collection.php" hash="51d54a1cbd4f9b7d3e84255bdac31bc1"/></dir><file name="Url.php" hash="d80317d7998b812928938e68f9c16784"/></dir><dir name="Visitoripsecurity"><file name="Collection.php" hash="8eacc6635320ef3865134e0fc5d5def5"/></dir><file name="Visitoripsecurity.php" hash="adc846eb0382fa63781ec109d044599d"/></dir><file name="Notes.php" hash="ef56f20501a4b4206d6f9908ec3f3376"/><file name="Observer.php" hash="c9b36a67f3675e64d622122e03ffa2a1"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="VisitoripsecurityController.php" hash="f0d61570544a38fe334604dea33e38b4"/></dir><file name="IndexController.php" hash="65dd524e63822785eb5ed11a009cc1b8"/></dir><dir name="etc"><file name="adminhtml.xml" hash="00fbd9aec0c828c5e62a82314ee98dba"/><file name="config.xml" hash="f46d74cccdcf0d1c18dcbff78b1b7a1a"/><file name="system.xml" hash="33216eab7c16ab17905ce2d69835817c"/></dir><dir name="sql"><dir name="visitoripsecurity_setup"><file name="mysql4-install-0.3.0.php" hash="eb018ad2b85783c8856e322c5a5a8f25"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="briel_visitoripsecurity.xml" hash="b449d538b7c27ee019d4a3ed1171b639"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Briel_Visitoripsecurity.xml" hash="57b66b169d5072e54f7b173a849df631"/></dir></target></contents>
22
  <compatible/>
23
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
24
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Briel_VisitorIpSecurity</name>
4
+ <version>0.3.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/gpl-license.php">GNU General Public License (GPL)</license>
7
  <channel>community</channel>
16
  - email notification when any ip has more then a certain number of visits</description>
17
  <notes>Stable version, fully functional on our website.</notes>
18
  <authors><author><name>Velica Onel</name><user>mage_briel</user><email>mage@briel.ro</email></author></authors>
19
+ <date>2014-09-28</date>
20
+ <time>10:56:25</time>
21
+ <contents><target name="magelocal"><dir name="Briel"><dir name="Visitoripsecurity"><dir name="Block"><dir name="Adminhtml"><file name="Blocked.php" hash="33a3043d5a87b31a5da1baa44e38189e"/><file name="Grid.php" hash="4248a2b9f787ceb5bc7e597abdfb5f4d"/><file name="Logurl.php" hash="cc8c46363a2dd600f620e4c7e17b0e92"/><file name="Oneip.php" hash="b57cd3ce62b33fb8f1c486106035cec4"/><dir name="Visitoripsecurity"><dir name="Blocked"><file name="Grid.php" hash="d321f1bd3329c3b6ab640bfc37e04034"/></dir><file name="Grid.php" hash="105d4ec67128ee9aa4f945e1d9475e93"/><dir name="Logurl"><file name="Grid.php" hash="6d37f6a97fcaa46c31883e1dc05ee158"/></dir><dir name="Oneip"><file name="Block.php" hash="bdbd31b85d8cc3bbb2affbaf2e3dbceb"/></dir><dir name="Renderer"><file name="Blockthisip.php" hash="36b650bf097db55b92bf1bb1dd92ced1"/><file name="Count.php" hash="2350b63f23c6f70a5c926a2647320183"/><file name="Firstvisit.php" hash="0f35b6e245e5d107d9e1cb7d598a1928"/><file name="Google.php" hash="32de8dc43091331794a455d6ef866256"/><file name="Lasturl.php" hash="8ca49c2016294db423823879a3eae866"/><file name="Lastvisit.php" hash="24312fcd960774793d22fb70d849064a"/><file name="Notes.php" hash="0ec22910ca8838f0dca025cfc6fad999"/><file name="Pretty.php" hash="a19a856a05afa57df2eb43a781d2d0c9"/><file name="Watchthisip.php" hash="e76fc4de0c64d40304b0fa701726f959"/><file name="Whitethisip.php" hash="66a77f968542d8078c4da42d444e8c0b"/></dir><file name="Renderer.php" hash="68b74b3d0da4582cfbadb9b39cff0ea6"/><dir name="Watch"><file name="Grid.php" hash="08e7d30bd586f288d8b34e89486b597f"/></dir><dir name="White"><file name="Grid.php" hash="5cb80b664833cb4236bb25fadaf4dcf9"/></dir></dir><file name="Watch.php" hash="cfcd4d46cecf14b22520034080e0fe8e"/><file name="White.php" hash="68554d80f01ca19883dc7cacc5edf141"/></dir></dir><dir name="Helper"><file name="Data.php" hash="047ed0a80bb55c95b1b59517fd518901"/></dir><dir name="Model"><dir name="Log"><dir name="Remoteaddr"><file name="Notes.php" hash="438b0b61d28f73d08894c38ae9c0bb7c"/></dir><file name="Url.php" hash="a9dd406c9de369a95aabc1350765c566"/></dir><dir name="Mysql4"><dir name="Log"><dir name="Remoteaddr"><dir name="Notes"><file name="Collection.php" hash="3a0fbe8040b0522fe9f75443f357763b"/></dir><file name="Notes.php" hash="8126aa142aa289b71c905133335476e2"/></dir><dir name="Url"><file name="Collection.php" hash="51d54a1cbd4f9b7d3e84255bdac31bc1"/></dir><file name="Url.php" hash="d80317d7998b812928938e68f9c16784"/></dir><dir name="Visitoripsecurity"><file name="Collection.php" hash="8eacc6635320ef3865134e0fc5d5def5"/></dir><file name="Visitoripsecurity.php" hash="adc846eb0382fa63781ec109d044599d"/></dir><file name="Notes.php" hash="ef56f20501a4b4206d6f9908ec3f3376"/><file name="Observer.php" hash="c9b36a67f3675e64d622122e03ffa2a1"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="VisitoripsecurityController.php" hash="f0d61570544a38fe334604dea33e38b4"/></dir><file name="IndexController.php" hash="65dd524e63822785eb5ed11a009cc1b8"/></dir><dir name="etc"><file name="adminhtml.xml" hash="00fbd9aec0c828c5e62a82314ee98dba"/><file name="config.xml" hash="08db82cb148bcf470e66404109ec76d6"/><file name="system.xml" hash="33216eab7c16ab17905ce2d69835817c"/></dir><dir name="sql"><dir name="visitoripsecurity_setup"><file name="mysql4-install-0.3.1.php" hash="eb018ad2b85783c8856e322c5a5a8f25"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="briel_visitoripsecurity.xml" hash="b449d538b7c27ee019d4a3ed1171b639"/></dir><dir name="template"><dir name="briel"><dir name="visitoripsecurity"><file name="inline-edit.phtml" hash="1b42183608c087284a9c20fbb0276d87"/><file name="oneip.phtml" hash="c2dbe93357b9ca6611ca0bfb6b58e8bd"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Briel_Visitoripsecurity.xml" hash="57b66b169d5072e54f7b173a849df631"/></dir></target></contents>
22
  <compatible/>
23
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
24
  </package>