ET_IpSecurity - Version 2.1.1

Version Notes

stable release

Download this release

Release Info

Developer Magento Core Team
Extension ET_IpSecurity
Version 2.1.1
Comparing to
See all releases


Code changes from version 2.1.0 to 2.1.1

app/code/community/ET/IpSecurity/Model/Observer.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * NOTICE OF LICENSE
4
  *
@@ -16,7 +17,6 @@
16
  * @contacts support@etwebsolutions.com
17
  * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
  */
19
-
20
  class ET_IpSecurity_Model_Observer
21
  {
22
  protected $_redirectPage = null;
@@ -465,19 +465,19 @@ class ET_IpSecurity_Model_Observer
465
  foreach ($recipients as $recipient) {
466
  $sendResult = $emailTemplate->setDesignConfig(array('area' => 'backend'))
467
  ->sendTransactional(
468
- $this->_emailTemplate,
469
- $this->_emailIdentity,
470
- trim($recipient),
471
- trim($recipient),
472
- array(
473
- 'ip' => $currentIp,
474
- 'ip_rule' => Mage::helper('etipsecurity')->__($this->getLastBlockRule()), // TODO: translation
475
- 'date' => Mage::helper('core')->formatDate(null, Mage_Core_Model_Locale::FORMAT_TYPE_FULL, true),
476
- 'storetype' => $this->_storeType,
477
- 'url' => Mage::helper('core/url')->getCurrentUrl(),
478
- 'info' => base64_encode(serialize(array($this->_rawAllowIpData, $this->_rawBlockIpData))),
479
- )
480
- );
481
  }
482
  return $sendResult;
483
  }
@@ -506,7 +506,28 @@ class ET_IpSecurity_Model_Observer
506
  $helper = Mage::helper('etipsecurity');
507
  $selectedIpVariable = $helper->getIpVariable();
508
  $currentIp = $_SERVER[$selectedIpVariable];
509
- return $currentIp;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
510
  }
511
 
512
  /**
1
  <?php
2
+
3
  /**
4
  * NOTICE OF LICENSE
5
  *
17
  * @contacts support@etwebsolutions.com
18
  * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
19
  */
 
20
  class ET_IpSecurity_Model_Observer
21
  {
22
  protected $_redirectPage = null;
465
  foreach ($recipients as $recipient) {
466
  $sendResult = $emailTemplate->setDesignConfig(array('area' => 'backend'))
467
  ->sendTransactional(
468
+ $this->_emailTemplate,
469
+ $this->_emailIdentity,
470
+ trim($recipient),
471
+ trim($recipient),
472
+ array(
473
+ 'ip' => $currentIp,
474
+ 'ip_rule' => Mage::helper('etipsecurity')->__($this->getLastBlockRule()), // TODO: translation
475
+ 'date' => Mage::helper('core')->formatDate(null, Mage_Core_Model_Locale::FORMAT_TYPE_FULL, true),
476
+ 'storetype' => $this->_storeType,
477
+ 'url' => Mage::helper('core/url')->getCurrentUrl(),
478
+ 'info' => base64_encode(serialize(array($this->_rawAllowIpData, $this->_rawBlockIpData))),
479
+ )
480
+ );
481
  }
482
  return $sendResult;
483
  }
506
  $helper = Mage::helper('etipsecurity');
507
  $selectedIpVariable = $helper->getIpVariable();
508
  $currentIp = $_SERVER[$selectedIpVariable];
509
+ return $this->_getCurrentIp($currentIp, $selectedIpVariable);
510
+ }
511
+
512
+ /**
513
+ * HTTP_X_FORWARDED_FOR can return comma delimetered list of IP addresses.
514
+ * We need only one IP address to check
515
+ *
516
+ * @param $currentIp
517
+ * @param $selectedIpVariable
518
+ * @return string
519
+ */
520
+ protected function _getCurrentIp($currentIp, $selectedIpVariable)
521
+ {
522
+ switch ($selectedIpVariable) {
523
+ case 'HTTP_X_FORWARDED_FOR':
524
+ $resultArray = explode(',', $currentIp);
525
+ $result = trim($resultArray[0]);
526
+ break;
527
+ default:
528
+ $result = $currentIp;
529
+ }
530
+ return $result;
531
  }
532
 
533
  /**
app/code/community/ET/IpSecurity/etc/config.xml CHANGED
@@ -23,7 +23,7 @@
23
  <modules>
24
  <ET_IpSecurity>
25
  <name>ET Ip Security</name>
26
- <version>2.1.0</version>
27
  <descr>
28
  <ru_RU><![CDATA[Модуль позволяет ограничивать доступ к сайту посетителям по IP, IP маскам или диапозону IP.
29
  <br>При срабатывании правила перенаправляет посетителя на указанную CMS страницу или просто на пустую страницу.
23
  <modules>
24
  <ET_IpSecurity>
25
  <name>ET Ip Security</name>
26
+ <version>2.1.1</version>
27
  <descr>
28
  <ru_RU><![CDATA[Модуль позволяет ограничивать доступ к сайту посетителям по IP, IP маскам или диапозону IP.
29
  <br>При срабатывании правила перенаправляет посетителя на указанную CMS страницу или просто на пустую страницу.
app/code/community/ET/IpSecurity/etc/system.xml CHANGED
@@ -98,6 +98,7 @@
98
  </allow>
99
  <block translate="label">
100
  <label>Block these IPs</label>
 
101
  <frontend_type>textarea</frontend_type>
102
  <sort_order>20</sort_order>
103
  <show_in_default>1</show_in_default>
@@ -181,6 +182,7 @@
181
  </allow>
182
  <block translate="label">
183
  <label>Block these IPs</label>
 
184
  <frontend_type>textarea</frontend_type>
185
  <sort_order>20</sort_order>
186
  <show_in_default>1</show_in_default>
98
  </allow>
99
  <block translate="label">
100
  <label>Block these IPs</label>
101
+ <comment><![CDATA[You can enter IP addresses, masks and ranges. Comments are added with character |. Each rule on separate row.<br>Example:<br>127.0.0.1|My address<br>10.*.*.*|internal company IPs<br>10.0.0.1-20.0.0.1|IP Range<br>10.0.0.192/26|IP Range]]></comment>
102
  <frontend_type>textarea</frontend_type>
103
  <sort_order>20</sort_order>
104
  <show_in_default>1</show_in_default>
182
  </allow>
183
  <block translate="label">
184
  <label>Block these IPs</label>
185
+ <comment><![CDATA[You can enter IP addresses, masks and ranges. Comments are added with character |. Each rule on separate row.<br>Example:<br>127.0.0.1|My address<br>10.*.*.*|internal company IPs<br>10.0.0.1-20.0.0.1|IP Range<br>10.0.0.192/26|IP Range]]></comment>
186
  <frontend_type>textarea</frontend_type>
187
  <sort_order>20</sort_order>
188
  <show_in_default>1</show_in_default>
app/locale/ru_RU/ET_IpSecurity.csv CHANGED
@@ -53,3 +53,5 @@
53
  "You can see description of extension features and answers to the frequently asked questions on <a href=""%s"" target=""_blank"">our website</a>.","Описание позможностей модуля и ответы на часто задаваемые вопросы смотрите на <a href=""%s"" target=""_blank"">нашем сайте</a>."
54
  "You can hire our team to customize the extension. E-mail us on sales@etwebsolutions.com.<br><br>You can see a list of provided services on <a href=""%s"" target=""_blank"">our website</a>.","Вы можете нанять нашу команду для любых работ по модификации модуля. Пишите на адрес sales@etwebsolutions.com.<br><br>Со списком предоставляемых нами услуг вы можете ознакомиться <a href=""%s"" target=""_blank"">на нашем сайте</a>."
55
  "Extension support is available through <a href=""%s"" target=""_blank"">issue tracking system</a>.<br>You can see information freely, but you will have to sign up to open a ticket.<br><br>Please, report all bugs and feature requests that are related to this extension.<br><br>If by some reason you can not submit a question, bug report or feature request to our ticket system, you can write us an email - support@etwebsolutions.com.","Поддержка модуля осуществляется через <a href=""%s"" target=""_blank"">систему отслеживания заданий</a>.<br>Для создания задачи будет необходимо зарегистрироваться. Для просмотра информации регистрация не требуется.<br><br>Пожалуйста, сообщайте нам о найденных ошибках и о своих пожеланиях в рамках этого модуля.<br><br>Если по каким-либо причинам вы не можете размеситить вопрос/сообщение об ошибке/пожелание в списке задач, то можете написать нам по адресу support@etwebsolutions.com."
 
 
53
  "You can see description of extension features and answers to the frequently asked questions on <a href=""%s"" target=""_blank"">our website</a>.","Описание позможностей модуля и ответы на часто задаваемые вопросы смотрите на <a href=""%s"" target=""_blank"">нашем сайте</a>."
54
  "You can hire our team to customize the extension. E-mail us on sales@etwebsolutions.com.<br><br>You can see a list of provided services on <a href=""%s"" target=""_blank"">our website</a>.","Вы можете нанять нашу команду для любых работ по модификации модуля. Пишите на адрес sales@etwebsolutions.com.<br><br>Со списком предоставляемых нами услуг вы можете ознакомиться <a href=""%s"" target=""_blank"">на нашем сайте</a>."
55
  "Extension support is available through <a href=""%s"" target=""_blank"">issue tracking system</a>.<br>You can see information freely, but you will have to sign up to open a ticket.<br><br>Please, report all bugs and feature requests that are related to this extension.<br><br>If by some reason you can not submit a question, bug report or feature request to our ticket system, you can write us an email - support@etwebsolutions.com.","Поддержка модуля осуществляется через <a href=""%s"" target=""_blank"">систему отслеживания заданий</a>.<br>Для создания задачи будет необходимо зарегистрироваться. Для просмотра информации регистрация не требуется.<br><br>Пожалуйста, сообщайте нам о найденных ошибках и о своих пожеланиях в рамках этого модуля.<br><br>Если по каким-либо причинам вы не можете размеситить вопрос/сообщение об ошибке/пожелание в списке задач, то можете написать нам по адресу support@etwebsolutions.com."
56
+
57
+ "You can enter IP addresses, masks and ranges. Comments are added with character |. Each rule on separate row.<br>Example:<br>127.0.0.1|My address<br>10.*.*.*|internal company IPs<br>10.0.0.1-20.0.0.1|IP Range<br>10.0.0.192/26|IP Range","Можно указывать как IP адреса, так и маски адресов и диапазоны IP адресов. К каждому правилу можно добавить комментарий через символ |. По одному правилу на строку.<br>Пример:<br>127.0.0.1|My address<br>10.*.*.*|internal company IPs<br>10.0.0.1-20.0.0.1|IP Range<br>10.0.0.192/26|IP Range"
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ET_IpSecurity</name>
4
- <version>2.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://shop.etwebsolutions.com/eng/etws-license-free-v1">ETWS Free License (EFL1)</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>IP Security can restrict access to website by IP address or IP masks. When restrict rule is triggered, customer gets redirected to CMS page specified in settings or just blank page. You can get notifications about triggered rules by email. There is also opportunity to switch your website off for maintenance.</description>
11
  <notes>stable release</notes>
12
  <authors><author><name>Jurij</name><user>auto-converted</user><email>support@etwebsolutions.com</email></author><author><name>Andrej</name><user>auto-converted</user><email>support@etwebsolutions.com</email></author></authors>
13
- <date>2014-10-13</date>
14
- <time>11:41:03</time>
15
- <contents><target name="magecommunity"><dir name="ET"><dir name="IpSecurity"><dir name="Block"><dir name="Adminhtml"><dir name="Log"><dir name="Renderer"><file name="Translaterule.php" hash="ca65f7951033aa9012d28e2d57aef2a5"/></dir><file name="Grid.php" hash="2fb7a3f5f89954ed59c6fba4547d6633"/></dir><file name="GetIpInfo.php" hash="2ebe7ee7e4eedbf51b0d783c0e2a5a8e"/><file name="Log.php" hash="71e986aa8d17ca38fbbebf293aaadb7c"/><file name="Support.php" hash="77efaf8ff27650fb652a42e4173734ba"/></dir></dir><dir name="Helper"><file name="Data.php" hash="bb998ef9431d76e3a03e9d0b3c55e5f8"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Ipsecuritylog"><file name="Collection.php" hash="d052dd9e02c801d4343dcc847e48a7b2"/></dir><file name="Ipsecuritylog.php" hash="bbefc57c3bea478057e6038f6882843c"/></dir><file name="IpVariable.php" hash="0308a6b2b1a0b4491b3b3af8700338d5"/><file name="Ipsecuritylog.php" hash="73e41e474f5bde2b994f097de68a2d3b"/><file name="Observer.php" hash="5868ff8ed26638ba4f9b290e2c6e4167"/></dir><dir name="Test"><dir name="Model"><dir name="Observer"><dir name="providers"><file name="testIsIpAllowed.yaml" hash="404d102cf95f0ccce2169ff28bdbb74f"/><file name="testIsIpInList.yaml" hash="ba21c5f51a0b20d1e0e04ca3e1a9db11"/></dir></dir><file name="Observer.php" hash="173a1298271aeaa8811f8b7759975b0e"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="LogController.php" hash="3dc568a8b73ac5698041ecf1485c2e54"/></dir></dir><dir name="etc"><file name="config.xml" hash="698c0c264df319c91a08dd4cf3eee76d"/><file name="system.xml" hash="61098dd58209e0d3c2ab8bc002a44d81"/></dir><dir name="sql"><dir name="ipsecurity_setup"><file name="mysql4-install-1.5.php" hash="8ab37ac7b1e54c6f3c1a41aad932b5c6"/><file name="mysql4-upgrade-1.5.3-2.0.0.php" hash="1b6f0580e385634cd93c688adae5d19d"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="ru_RU"><dir name="template"><dir name="email"><file name="et_ipsecurity.html" hash="b25448f879024a4f9694136cb45258b3"/><file name="et_ipsecurity_admin.html" hash="33efea1ec67fbcb5946fbb34429470f2"/></dir></dir><file name="ET_IpSecurity.csv" hash="2b710e0955c9a4611d7b4899960fb93b"/></dir><dir name="en_US"><dir name="template"><dir name="email"><file name="et_ipsecurity.html" hash="ffb1da1a35a7f598a8d2edfe4cba3ef3"/><file name="et_ipsecurity_admin.html" hash="ffb1da1a35a7f598a8d2edfe4cba3ef3"/></dir></dir><file name="ET_IpSecurity.csv" hash="7f9caec31be429a5851a67357eb44848"/></dir></target><target name="mageetc"><dir name="modules"><file name="ET_IpSecurity.xml" hash="3405c1babf6948a8af04228c60894fcf"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="et_ipsecurity.xml" hash="4b41ce53fd6ad2a29a4fd5f95119230d"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ET_IpSecurity</name>
4
+ <version>2.1.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://shop.etwebsolutions.com/eng/etws-license-free-v1">ETWS Free License (EFL1)</license>
7
  <channel>community</channel>
10
  <description>IP Security can restrict access to website by IP address or IP masks. When restrict rule is triggered, customer gets redirected to CMS page specified in settings or just blank page. You can get notifications about triggered rules by email. There is also opportunity to switch your website off for maintenance.</description>
11
  <notes>stable release</notes>
12
  <authors><author><name>Jurij</name><user>auto-converted</user><email>support@etwebsolutions.com</email></author><author><name>Andrej</name><user>auto-converted</user><email>support@etwebsolutions.com</email></author></authors>
13
+ <date>2015-05-07</date>
14
+ <time>10:28:47</time>
15
+ <contents><target name="magecommunity"><dir name="ET"><dir name="IpSecurity"><dir name="Block"><dir name="Adminhtml"><dir name="Log"><dir name="Renderer"><file name="Translaterule.php" hash="ca65f7951033aa9012d28e2d57aef2a5"/></dir><file name="Grid.php" hash="2fb7a3f5f89954ed59c6fba4547d6633"/></dir><file name="GetIpInfo.php" hash="2ebe7ee7e4eedbf51b0d783c0e2a5a8e"/><file name="Log.php" hash="71e986aa8d17ca38fbbebf293aaadb7c"/><file name="Support.php" hash="77efaf8ff27650fb652a42e4173734ba"/></dir></dir><dir name="Helper"><file name="Data.php" hash="bb998ef9431d76e3a03e9d0b3c55e5f8"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Ipsecuritylog"><file name="Collection.php" hash="d052dd9e02c801d4343dcc847e48a7b2"/></dir><file name="Ipsecuritylog.php" hash="bbefc57c3bea478057e6038f6882843c"/></dir><file name="IpVariable.php" hash="0308a6b2b1a0b4491b3b3af8700338d5"/><file name="Ipsecuritylog.php" hash="73e41e474f5bde2b994f097de68a2d3b"/><file name="Observer.php" hash="7ab5d8e0697d4aedeb81eacf45b22e9a"/></dir><dir name="Test"><dir name="Model"><dir name="Observer"><dir name="providers"><file name="testIsIpAllowed.yaml" hash="404d102cf95f0ccce2169ff28bdbb74f"/><file name="testIsIpInList.yaml" hash="ba21c5f51a0b20d1e0e04ca3e1a9db11"/></dir></dir><file name="Observer.php" hash="173a1298271aeaa8811f8b7759975b0e"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="LogController.php" hash="3dc568a8b73ac5698041ecf1485c2e54"/></dir></dir><dir name="etc"><file name="config.xml" hash="b733bad9a6204e817d27d55daecb0edf"/><file name="system.xml" hash="5e6bb0e9f1dde5a5872b52f07ec62bc6"/></dir><dir name="sql"><dir name="ipsecurity_setup"><file name="mysql4-install-1.5.php" hash="8ab37ac7b1e54c6f3c1a41aad932b5c6"/><file name="mysql4-upgrade-1.5.3-2.0.0.php" hash="1b6f0580e385634cd93c688adae5d19d"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="ru_RU"><dir name="template"><dir name="email"><file name="et_ipsecurity.html" hash="b25448f879024a4f9694136cb45258b3"/><file name="et_ipsecurity_admin.html" hash="33efea1ec67fbcb5946fbb34429470f2"/></dir></dir><file name="ET_IpSecurity.csv" hash="550ce954f02f6a3b1a4ddd2e7c7e0c05"/></dir><dir name="en_US"><dir name="template"><dir name="email"><file name="et_ipsecurity.html" hash="ffb1da1a35a7f598a8d2edfe4cba3ef3"/><file name="et_ipsecurity_admin.html" hash="ffb1da1a35a7f598a8d2edfe4cba3ef3"/></dir></dir><file name="ET_IpSecurity.csv" hash="7f9caec31be429a5851a67357eb44848"/></dir></target><target name="mageetc"><dir name="modules"><file name="ET_IpSecurity.xml" hash="3405c1babf6948a8af04228c60894fcf"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="et_ipsecurity.xml" hash="4b41ce53fd6ad2a29a4fd5f95119230d"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>