ET_IpSecurity - Version 2.0.0

Version Notes

stable release

Download this release

Release Info

Developer Jurij
Extension ET_IpSecurity
Version 2.0.0
Comparing to
See all releases


Code changes from version 1.5.3 to 2.0.0

Files changed (25) hide show
  1. app/code/community/ET/ET_IpSecurity_ChangeLog.txt +0 -41
  2. app/code/community/ET/ET_IpSecurity_Description.txt +0 -62
  3. app/code/community/ET/ET_IpSecurity_LICENSE.txt +0 -48
  4. app/code/community/ET/IpSecurity/Block/Adminhtml/Log.php +30 -32
  5. app/code/community/ET/IpSecurity/Block/Adminhtml/Log/Grid.php +92 -86
  6. app/code/community/ET/IpSecurity/Block/Adminhtml/Log/Renderer/Translaterule.php +17 -0
  7. app/code/community/ET/IpSecurity/Block/Adminhtml/Support.php +122 -0
  8. app/code/community/ET/IpSecurity/Helper/Data.php +21 -23
  9. app/code/community/ET/IpSecurity/Model/Ipsecuritylog.php +27 -28
  10. app/code/community/ET/IpSecurity/Model/Mysql4/Ipsecuritylog.php +26 -27
  11. app/code/community/ET/IpSecurity/Model/Mysql4/Ipsecuritylog/Collection.php +26 -27
  12. app/code/community/ET/IpSecurity/Model/Observer.php +573 -310
  13. app/code/community/ET/IpSecurity/Test/Model/Observer.php +53 -0
  14. app/code/community/ET/IpSecurity/Test/Model/Observer/providers/testIsIpAllowed.yaml +20 -0
  15. app/code/community/ET/IpSecurity/Test/Model/Observer/providers/testIsIpInList.yaml +68 -0
  16. app/code/community/ET/IpSecurity/controllers/Adminhtml/LogController.php +69 -71
  17. app/code/community/ET/IpSecurity/etc/config.xml +273 -231
  18. app/code/community/ET/IpSecurity/etc/system.xml +252 -237
  19. app/code/community/ET/IpSecurity/sql/ipsecurity_setup/mysql4-install-1.5.php +7 -8
  20. app/code/community/ET/IpSecurity/sql/ipsecurity_setup/mysql4-upgrade-1.5.3-2.0.0.php +29 -0
  21. app/design/adminhtml/default/default/layout/et_ipsecurity.xml +27 -28
  22. app/etc/modules/ET_IpSecurity.xml +12 -13
  23. app/locale/en_US/ET_IpSecurity.csv +33 -33
  24. app/locale/ru_RU/ET_IpSecurity.csv +47 -33
  25. package.xml +9 -12
app/code/community/ET/ET_IpSecurity_ChangeLog.txt DELETED
@@ -1,41 +0,0 @@
1
- This file describes changes between versions of module ET_IpSecurity for Magento.
2
-
3
- Legend:
4
- * bug fix
5
- + added functionality
6
- - removed functionality
7
-
8
- TODO and some thoughts:
9
- + integrate anti spam service http://www.projecthoneypot.org/
10
-
11
- =====================================
12
- ver. 1.5.3 (06/06/2011)
13
- * minor bug fixes (variable initializing)
14
-
15
- ver. 1.5.2
16
- + added ability to use IP ranges (Example: 10.0.0.1-20.0.0.1|IP Range)
17
-
18
- ver. 1.5.1
19
- * resolved infinite loop when admin block rule happens and option "Add Store Code to Urls" = Yes and redirect to CMS page is on.
20
-
21
- ver. 1.5.0
22
- + added table to database to store blocked ip's
23
- + added log grid in admin
24
- + added option: send notification every time on block or only on first
25
-
26
- ver. 1.2.0
27
- + changed code pool from local to community
28
- + changed settings section
29
- + added maintenance page function
30
-
31
- ver. 1.1.0
32
- * added Helper (without it Transactional Mails - Add New Template wash't working) - actual for Magento ver. 1.4.�
33
-
34
- ver. 1.0.9
35
- + can add comments to IP's
36
- + notify by e-mail if block rule happens (e-mail templates editable)
37
- + http response status 403
38
- * rule templates processing error
39
-
40
- ver. 0.1.0
41
- + stable release
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/ET/ET_IpSecurity_Description.txt DELETED
@@ -1,62 +0,0 @@
1
- ==== Description / Для чего этот модуль? ====
2
-
3
- EN:
4
- Extension allows to restrict access to website for visitors by IP or IP mask.
5
- When blocking rule is applied user is redirected to selected CMS page or blank page. Also extension can notify website owner about blocked visitor by email.
6
-
7
- Second function: Allows to turn off frontend during maintenance operations.
8
-
9
- RU:
10
- Модуль позволяет ограничивать доступ к сайту посетителям по IP или по IP маскам.
11
- При срабатывании правила перенаправляет посетителя на указанную CMS страницу или просто на пустую страницу. Также может оповестить владельца сайта о сработавшем правиле по е-майл.
12
-
13
- Доступна функция отключения сайта на техническое обслуживание.
14
-
15
-
16
- ====Features / Особенности модуля====
17
-
18
- EN:
19
- * Open Source
20
- * Separate white/black IP lists for frontend and admin panel
21
- * Website owner notification by e-mail about rejected attempt to access frontend or admin panel
22
- * 2 types of action when blocking rule is applied (Redirect to blank page or Redirect to selected CMS page)
23
- * HTTP response code when blocking - HTTP Error 403 - Forbidden: Access is denied
24
- * Editable templates for notification letters
25
- * Available languages for admin panel (en_US, ru_RU)
26
- * You can enter IP addresses or IP masks or IP ranges. You can add comment to each rule.
27
- 127.0.0.1|My address
28
- 10.*.*.*|internal company IPs
29
- 10.0.0.1-20.0.0.1|IP Ranges
30
- * Editable message (is shown to visitors during maintenance operations.)
31
- * List of blocked IPs is saving to database
32
- * You can view log of blocking in admin panel
33
-
34
-
35
-
36
- RU:
37
- * Open Source
38
- * Отдельные белые/чёрные списки IP для пользовательской части и панели администрирования
39
- * Оповещение владельца магазина по е-майл о сработавшем правиле блокировке
40
- * Два типа действи при срабатывании правила (Показ пустой страницы и Перенаправление на указанную CMS страницу)
41
- * Статус ответа на показываемой странице при блокировке - HTTP Error 403 - Forbidden: Access is denied
42
- * Редактируемые шаблоны писем оповещения
43
- * Доступные языки для панели администрирования (en_US, ru_RU)
44
- * Можно указывать как IP адреса, так и маски адресов и диапазоны IP адресов. К каждому правилу можно добавить комментарий.
45
- 127.0.0.1|My address
46
- 10.*.*.*|internal company IPs
47
- 10.0.0.1-20.0.0.1|IP Ranges
48
- * Редактируемое сообщение (показывается посетителям во время технических работ).
49
-
50
- * Сохранение в базе данных ИП адресов на которые сработала блокировка
51
- * Просмотр журнала блокировки в панели администрирования
52
-
53
-
54
-
55
- ====Version Compatibility / Совместимость версий====
56
- 1.3.х (tested in 1.3.2.4.)
57
- 1.4.x (tested in 1.4.1.1.)
58
- 1.5.x (tested in 1.5.0.1.)
59
-
60
- ====Module tags:====
61
- ip security, disable access, maintenance, administration
62
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/ET/ET_IpSecurity_LICENSE.txt DELETED
@@ -1,48 +0,0 @@
1
- http://opensource.org/licenses/afl-3.0.php
2
-
3
- Academic Free License ("AFL") v. 3.0
4
- This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
5
-
6
- Licensed under the Academic Free License version 3.0
7
-
8
- 1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
9
-
10
- a) to reproduce the Original Work in copies, either alone or as part of a collective work;
11
-
12
- b) to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
13
-
14
- c) to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
15
-
16
- d) to perform the Original Work publicly; and
17
-
18
- e) to display the Original Work publicly.
19
-
20
- 2) Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
21
-
22
- 3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
23
-
24
- 4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
25
-
26
- 5) External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
27
-
28
- 6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
29
-
30
- 7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
31
-
32
- 8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
33
-
34
- 9) Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
35
-
36
- 10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
37
-
38
- 11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
39
-
40
- 12) Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
41
-
42
- 13) Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
43
-
44
- 14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
45
-
46
- 15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
47
-
48
- 16) Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/ET/IpSecurity/Block/Adminhtml/Log.php CHANGED
@@ -1,33 +1,31 @@
1
- <?php
2
- /**
3
- * ET Web Solutions
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- *
9
- * DISCLAIMER
10
- *
11
- * Do not edit or add to this file if you wish to upgrade to newer
12
- * versions in the future.
13
- *
14
- * @category ET
15
- * @package ET_IpSecurity
16
- * @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
17
- * @contacts support@etwebsolutions.com
18
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
- */
20
-
21
- class ET_IpSecurity_Block_Adminhtml_Log extends Mage_Adminhtml_Block_Widget_Grid_Container
22
- {
23
- public function __construct()
24
- {
25
- $this->_controller = 'adminhtml_log';
26
- $this->_blockGroup = 'etipsecurity';
27
- $this->_headerText = Mage::helper('etipsecurity')->__('ET IP Security log table');
28
-
29
- parent::__construct();
30
- $this->_removeButton('add');
31
-
32
- }
33
  }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_IpSecurity
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
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_Block_Adminhtml_Log extends Mage_Adminhtml_Block_Widget_Grid_Container
21
+ {
22
+ public function __construct()
23
+ {
24
+ $this->_controller = 'adminhtml_log';
25
+ $this->_blockGroup = 'etipsecurity';
26
+ $this->_headerText = Mage::helper('etipsecurity')->__('ET IP Security log table');
27
+
28
+ parent::__construct();
29
+ $this->_removeButton('add');
30
+ }
 
 
31
  }
app/code/community/ET/IpSecurity/Block/Adminhtml/Log/Grid.php CHANGED
@@ -1,86 +1,92 @@
1
- <?php
2
- /**
3
- * ET Web Solutions
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- *
9
- * DISCLAIMER
10
- *
11
- * Do not edit or add to this file if you wish to upgrade to newer
12
- * versions in the future.
13
- *
14
- * @category ET
15
- * @package ET_IpSecurity
16
- * @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
17
- * @contacts support@etwebsolutions.com
18
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
- */
20
-
21
- class ET_IpSecurity_Block_Adminhtml_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
22
- {
23
- public function __construct()
24
- {
25
- parent::__construct();
26
- $this->setId('etipsecuritylogGrid');
27
- $this->setDefaultSort('update_time');
28
- $this->setDefaultDir('DESC');
29
- $this->setSaveParametersInSession(true);
30
- }
31
-
32
- protected function _prepareCollection()
33
- {
34
- $collection = Mage::getModel('etipsecurity/ipsecuritylog')->getCollection();
35
- $this->setCollection($collection);
36
- return parent::_prepareCollection();
37
- }
38
-
39
- protected function _prepareColumns()
40
- {
41
- $this->addColumn('blocked_ip', array(
42
- 'header' => Mage::helper('etipsecurity')->__('Blocked IP'),
43
- 'align' =>'left',
44
- 'width' => '150px',
45
- 'index' => 'blocked_ip',
46
- ));
47
-
48
- $this->addColumn('qty', array(
49
- 'header' => Mage::helper('etipsecurity')->__('Qty blocked'),
50
- 'align' =>'left',
51
- 'width' => '100px',
52
- 'index' => 'qty',
53
- 'type' => 'number',
54
- ));
55
-
56
- $this->addColumn('create_time', array(
57
- 'header' => Mage::helper('etipsecurity')->__('First block'),
58
- 'align' =>'left',
59
- 'width' => '160px',
60
- 'index' => 'create_time',
61
- 'type' => 'datetime',
62
- ));
63
-
64
- $this->addColumn('update_time', array(
65
- 'header' => Mage::helper('etipsecurity')->__('Last block'),
66
- 'align' =>'left',
67
- 'width' => '160px',
68
- 'index' => 'update_time',
69
- 'type' => 'datetime',
70
- ));
71
-
72
- $this->addColumn('blocked_from', array(
73
- 'header' => Mage::helper('etipsecurity')->__('Blocked from'),
74
- 'align' =>'left',
75
- // 'width' => '100px',
76
- 'index' => 'blocked_from',
77
- ));
78
-
79
- $this->addExportType('*/*/exportCsv', Mage::helper('customer')->__('CSV'));
80
- $this->addExportType('*/*/exportXml', Mage::helper('customer')->__('Excel XML'));
81
-
82
-
83
- return parent::_prepareColumns();
84
- }
85
-
86
- }
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_IpSecurity
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
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_Block_Adminhtml_Log_Grid extends Mage_Adminhtml_Block_Widget_Grid
21
+ {
22
+ public function __construct()
23
+ {
24
+ parent::__construct();
25
+ $this->setId('etipsecuritylogGrid');
26
+ $this->setDefaultSort('update_time');
27
+ $this->setDefaultDir('DESC');
28
+ $this->setSaveParametersInSession(true);
29
+ }
30
+
31
+ protected function _prepareCollection()
32
+ {
33
+ $collection = Mage::getModel('etipsecurity/ipsecuritylog')->getCollection();
34
+ $this->setCollection($collection);
35
+ return parent::_prepareCollection();
36
+ }
37
+
38
+ protected function _prepareColumns()
39
+ {
40
+ $this->addColumn('blocked_ip', array(
41
+ 'header' => Mage::helper('etipsecurity')->__('Blocked IP'),
42
+ 'align' => 'left',
43
+ 'width' => '150px',
44
+ 'index' => 'blocked_ip',
45
+ ));
46
+
47
+ $this->addColumn('qty', array(
48
+ 'header' => Mage::helper('etipsecurity')->__('Qty blocked'),
49
+ 'align' => 'left',
50
+ 'width' => '100px',
51
+ 'index' => 'qty',
52
+ 'type' => 'number',
53
+ ));
54
+
55
+ $this->addColumn('last_block_rule', array(
56
+ 'header' => Mage::helper('etipsecurity')->__('Last block rule'),
57
+ 'align' => 'left',
58
+ 'width' => '300px',
59
+ 'index' => 'last_block_rule',
60
+ 'renderer' => 'etipsecurity/adminhtml_log_renderer_translaterule',
61
+ 'filter' => false,
62
+ ));
63
+
64
+ $this->addColumn('create_time', array(
65
+ 'header' => Mage::helper('etipsecurity')->__('First block'),
66
+ 'align' => 'left',
67
+ 'width' => '160px',
68
+ 'index' => 'create_time',
69
+ 'type' => 'datetime',
70
+ ));
71
+
72
+ $this->addColumn('update_time', array(
73
+ 'header' => Mage::helper('etipsecurity')->__('Last block'),
74
+ 'align' => 'left',
75
+ 'width' => '160px',
76
+ 'index' => 'update_time',
77
+ 'type' => 'datetime',
78
+ ));
79
+
80
+ $this->addColumn('blocked_from', array(
81
+ 'header' => Mage::helper('etipsecurity')->__('Blocked from'),
82
+ 'align' => 'left',
83
+ //'width' => '100px',
84
+ 'index' => 'blocked_from',
85
+ ));
86
+
87
+ $this->addExportType('*/*/exportCsv', Mage::helper('customer')->__('CSV'));
88
+ $this->addExportType('*/*/exportXml', Mage::helper('customer')->__('Excel XML'));
89
+
90
+ return parent::_prepareColumns();
91
+ }
92
+ }
app/code/community/ET/IpSecurity/Block/Adminhtml/Log/Renderer/Translaterule.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class ET_IpSecurity_Block_Adminhtml_Log_Renderer_Translaterule
3
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
4
+ {
5
+
6
+ /**
7
+ * Renders grid column
8
+ *
9
+ * @param Varien_Object $row
10
+ * @return mixed
11
+ */
12
+ public function _getValue(Varien_Object $row)
13
+ {
14
+ $data = parent::_getValue($row);
15
+ return Mage::helper('etipsecurity')->__($data);
16
+ }
17
+ }
app/code/community/ET/IpSecurity/Block/Adminhtml/Support.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_IpSecurity
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
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_Block_Adminhtml_Support
21
+ extends Mage_Adminhtml_Block_Abstract
22
+ implements Varien_Data_Form_Element_Renderer_Interface
23
+ {
24
+ /**
25
+ * Support tab
26
+ * version 1.0.0
27
+ */
28
+ public function render(Varien_Data_Form_Element_Abstract $element)
29
+ {
30
+ $helper = Mage::helper('etipsecurity');
31
+ $moduleNameId = 'ET_IpSecurity';
32
+
33
+ $moduleVersion = $this->_getConfigValue($moduleNameId, 'version');
34
+ $moduleName = $this->_getConfigValue($moduleNameId, 'name');
35
+ $moduleShortDescription = $this->_getConfigValue($moduleNameId, 'descr');
36
+ $moduleLicense = $this->_getConfigValue($moduleNameId, 'license');
37
+
38
+ $linkParameters = '?module=' . $moduleNameId . '&ver=' . $moduleVersion . '&ref=' . $_SERVER['HTTP_HOST'];
39
+ $moduleLicenseLink = $this->_getConfigValue($moduleNameId, 'licenselink') . $linkParameters;
40
+ $moduleSupportLink = $this->_getConfigValue($moduleNameId, 'redminelink') . $linkParameters;
41
+ $moduleLink = $this->_getConfigValue($moduleNameId, 'permanentlink') . $linkParameters;
42
+ $servicesLink = $this->_getConfigValue($moduleNameId, 'ourserviceslink') . $linkParameters;
43
+
44
+ $html =
45
+ '<style>
46
+ .line {border-top: 1px solid #c6c6c6; }
47
+ .developer-label {color: #000000; font-weight:bold; width: 150px;}
48
+ .developer-text { padding-bottom: 15px;}
49
+ .developer {width: 600px; }
50
+ </style>';
51
+
52
+ $html .= '
53
+ <table cellspacing="0" cellpading="0" class="developer">
54
+ <tr>
55
+ <td class="developer-label">' . $helper->__('Extension:') . '</td>
56
+ <td class="developer-text">' . $helper->__(
57
+ '<strong>%s</strong> (version %s)',
58
+ $moduleName,
59
+ $moduleVersion
60
+ ) . '</td>
61
+ </tr>
62
+ <tr>
63
+ <td class="developer-label">' . $helper->__('License:') . '</td>
64
+ <td class="developer-text">' . $helper->__(
65
+ '<a href="%s" target="_blank">%s</a>',
66
+ $moduleLicenseLink,
67
+ $moduleLicense
68
+ ) . '</td>
69
+ </tr>
70
+ <tr>
71
+ <td class="developer-label">' . $helper->__('Short Description:') . '</td>
72
+ <td class="developer-text">' .$moduleShortDescription. '</td>
73
+ </tr>
74
+ <tr>
75
+ <td class="developer-label">' . $helper->__('Documentation:') . '</td>
76
+ <td class="developer-text">' . $helper->__(
77
+ 'You can see description of extension features and answers to the ' .
78
+ 'frequently asked questions on <a href="%s" target="_balnk">our website</a>.',
79
+ $moduleLink) . '</td>
80
+ </tr>
81
+ <tr>
82
+ <td class="developer-label line">' . $helper->__('Support:') . '</td>
83
+ <td class="developer-text line">' . $helper->__(
84
+ 'Extension support is available through <a href="%s" target="_blank">issue tracking system' .
85
+ '</a>.<br>You can see information freely, but you will have to sign up to open a ticket.<br>' .
86
+ '<br>Please, report all bugs and feature requests that are connected to this extension.<br>' .
87
+ '<br>If by some reason you can not submit a question, bug report or feature request to our ' .
88
+ 'ticket system, you can write us an email - support@etwebsolutions.com.',
89
+ $moduleSupportLink) . '</td>
90
+ </tr>
91
+ <tr>
92
+ <td class="developer-label line">' . $helper->__('Advertisement:') . '</td>
93
+ <td class="developer-text line">' . $helper->__(
94
+ 'You can hire our team to customize the extension. E-mail us on sales@etwebsolutions.com.<br>' .
95
+ '<br>You can see a list of provided services on <a href="%s" target="_blank">our website</a>.',
96
+ $servicesLink) . '</td>
97
+ </tr>
98
+ </table>';
99
+
100
+
101
+ return $html;
102
+ }
103
+
104
+ protected function _getConfigValue($module, $config)
105
+ {
106
+ $locale = Mage::app()->getLocale()->getLocaleCode();
107
+ $defaultLocale = 'en_US';
108
+ $mainConfig = Mage::getConfig();
109
+ $moduleConfig = $mainConfig->getNode('modules/' . $module . '/' . $config);
110
+
111
+ if ((string)$moduleConfig) {
112
+ return $moduleConfig;
113
+ }
114
+
115
+ if ($moduleConfig->$locale) {
116
+ return $moduleConfig->$locale;
117
+ } else {
118
+ return $moduleConfig->$defaultLocale;
119
+ }
120
+ }
121
+
122
+ }
app/code/community/ET/IpSecurity/Helper/Data.php CHANGED
@@ -1,24 +1,22 @@
1
- <?php
2
- /**
3
- * ET Web Solutions
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- *
9
- * DISCLAIMER
10
- *
11
- * Do not edit or add to this file if you wish to upgrade to newer
12
- * versions in the future.
13
- *
14
- * @category ET
15
- * @package ET_IpSecurity
16
- * @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
17
- * @contacts support@etwebsolutions.com
18
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
- */
20
-
21
- class ET_IpSecurity_Helper_Data extends Mage_Core_Helper_Abstract
22
- {
23
-
24
  }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_IpSecurity
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
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_Helper_Data extends Mage_Core_Helper_Abstract
21
+ {
 
 
22
  }
app/code/community/ET/IpSecurity/Model/Ipsecuritylog.php CHANGED
@@ -1,28 +1,27 @@
1
- <?php
2
- /**
3
- * ET Web Solutions
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- *
9
- * DISCLAIMER
10
- *
11
- * Do not edit or add to this file if you wish to upgrade to newer
12
- * versions in the future.
13
- *
14
- * @category ET
15
- * @package ET_IpSecurity
16
- * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
17
- * @contacts support@etwebsolutions.com
18
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
- */
20
-
21
- class ET_IpSecurity_Model_Ipsecuritylog extends Mage_Core_Model_Abstract
22
- {
23
- public function _construct()
24
- {
25
- parent::_construct();
26
- $this->_init('etipsecurity/ipsecuritylog');
27
- }
28
- }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_IpSecurity
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
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_Ipsecuritylog extends Mage_Core_Model_Abstract
21
+ {
22
+ public function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->_init('etipsecurity/ipsecuritylog');
26
+ }
27
+ }
 
app/code/community/ET/IpSecurity/Model/Mysql4/Ipsecuritylog.php CHANGED
@@ -1,28 +1,27 @@
1
- <?php
2
- /**
3
- * ET Web Solutions
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- *
9
- * DISCLAIMER
10
- *
11
- * Do not edit or add to this file if you wish to upgrade to newer
12
- * versions in the future.
13
- *
14
- * @category ET
15
- * @package ET_IpSecurity
16
- * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
17
- * @contacts support@etwebsolutions.com
18
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
- */
20
-
21
- class ET_IpSecurity_Model_Mysql4_Ipsecuritylog extends Mage_Core_Model_Mysql4_Abstract
22
- {
23
- public function _construct()
24
- {
25
- // Note that the logid refers to the key field in your database table.
26
- $this->_init('etipsecurity/ipsecuritylog', 'logid');
27
- }
28
  }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_IpSecurity
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
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_Mysql4_Ipsecuritylog extends Mage_Core_Model_Mysql4_Abstract
21
+ {
22
+ public function _construct()
23
+ {
24
+ // Note that the logid refers to the key field in your database table.
25
+ $this->_init('etipsecurity/ipsecuritylog', 'logid');
26
+ }
 
27
  }
app/code/community/ET/IpSecurity/Model/Mysql4/Ipsecuritylog/Collection.php CHANGED
@@ -1,28 +1,27 @@
1
- <?php
2
- /**
3
- * ET Web Solutions
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- *
9
- * DISCLAIMER
10
- *
11
- * Do not edit or add to this file if you wish to upgrade to newer
12
- * versions in the future.
13
- *
14
- * @category ET
15
- * @package ET_IpSecurity
16
- * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
17
- * @contacts support@etwebsolutions.com
18
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
- */
20
-
21
- class ET_IpSecurity_Model_Mysql4_Ipsecuritylog_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
22
- {
23
- public function _construct()
24
- {
25
- parent::_construct();
26
- $this->_init('etipsecurity/ipsecuritylog');
27
- }
28
  }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_IpSecurity
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
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_Mysql4_Ipsecuritylog_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
21
+ {
22
+ public function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->_init('etipsecurity/ipsecuritylog');
26
+ }
 
27
  }
app/code/community/ET/IpSecurity/Model/Observer.php CHANGED
@@ -1,10 +1,9 @@
1
  <?php
2
  /**
3
- * ET Web Solutions
4
- *
5
  * NOTICE OF LICENSE
6
  *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
 
8
  *
9
  * DISCLAIMER
10
  *
@@ -13,317 +12,581 @@
13
  *
14
  * @category ET
15
  * @package ET_IpSecurity
16
- * @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
17
  * @contacts support@etwebsolutions.com
18
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
  */
20
 
21
  class ET_IpSecurity_Model_Observer
22
  {
23
- private $redirect_page = null;
24
- private $redirect_blank = null;
25
- private $raw_allow_ip_data = null;
26
- private $raw_block_ip_data = null;
27
- private $raw_except_ip_data = null;
28
- private $event_email = "";
29
- private $email_template = 0;
30
- private $email_identity = null;
31
- private $storetype = null;
32
- private $last_found_ip = null;
33
- private $isFrontend = false;
34
- private $alwaysNotify = false;
35
-
36
-
37
- public function __construct()
38
- {
39
- }
40
-
41
- public function apply_ip_check_frontend($observer)
42
- {
43
- $this->redirect_page = $this->trim_slashes(Mage::getStoreConfig('etipsecurity/ipsecurityfront/redirect_page'));
44
- $this->redirect_blank = Mage::getStoreConfig('etipsecurity/ipsecurityfront/redirect_blank');
45
- $this->raw_allow_ip_data = Mage::getStoreConfig('etipsecurity/ipsecurityfront/allow');
46
- $this->raw_block_ip_data = Mage::getStoreConfig('etipsecurity/ipsecurityfront/block');
47
-
48
- $this->raw_except_ip_data = Mage::getStoreConfig('etipsecurity/ipsecuritymaintetance/except');
49
-
50
- $this->event_email = Mage::getStoreConfig('etipsecurity/ipsecurityfront/email_event');
51
- $this->email_template = Mage::getStoreConfig('etipsecurity/ipsecurityfront/email_template');
52
- $this->email_identity = Mage::getStoreConfig('etipsecurity/ipsecurityfront/email_identity');
53
- $this->storetype = Mage::helper("catalog")->__("Frontend");
54
- $this->isFrontend = true;
55
- $this->alwaysNotify = Mage::getStoreConfig('etipsecurity/ipsecurityfront/email_always');
56
- $this->apply_ip_check($observer);
57
- }
58
-
59
- public function apply_ip_check_admin($observer)
60
- {
61
- $this->redirect_page = $this->trim_slashes(Mage::getStoreConfig('etipsecurity/ipsecurityadmin/redirect_page'));
62
- $this->redirect_blank = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/redirect_blank');
63
- $this->raw_allow_ip_data = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/allow');
64
- $this->raw_block_ip_data = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/block');
65
- $this->event_email = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/email_event');
66
- $this->email_template = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/email_template');
67
- $this->email_identity = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/email_identity');
68
- $this->storetype = Mage::helper("core")->__("Admin");
69
- $this->isFrontend = false;
70
- $this->alwaysNotify = Mage::getStoreConfig('etipsecurity/ipsecurityfront/alwaysnotify');
71
- $this->apply_ip_check($observer);
72
- }
73
-
74
- public function apply_ip_check($observer)
75
- {
76
- $current_ip = $_SERVER['REMOTE_ADDR'];
77
- # start by allow all
78
- $allow = true;
79
- $allow_ips = null;
80
- $block_ips = null;
81
- $except_ips = null;
82
- $current_page = $this->trim_slashes(Mage::helper('core/url')->getCurrentUrl());
83
-
84
- // searching for CMS page storeId
85
- // if we don't do it - we have loop in redirect with setting Add Store Code to Urls = Yes (block access to admin redirects to admin)
86
- $stores = array();
87
- $pageStoreIds = array();
88
-
89
- foreach (Mage::app()->getStores() as $store)
90
- {
91
- $stores[] = $store->getId();
92
- $pageId = Mage::getModel('cms/page')->checkIdentifier($this->redirect_page,$store->getId());
93
- if($pageId===false) continue;
94
- $pageStoreIds = Mage::getResourceModel('cms/page')->lookupStoreIds($pageId);
95
- if (count($pageStoreIds)) // found page
96
- break;
97
- }
98
-
99
- if (!count($pageStoreIds)) // no found in any store
100
- $pageStoreIds[] = 0;
101
-
102
- foreach ($pageStoreIds as $pageStoreId)
103
- {
104
- if ($pageStoreId > 0)
105
- break;
106
- }
107
- if ($pageStoreId == 0)
108
- $pageStoreId = $stores[0]; // first available store
109
-
110
- $this->redirect_page = $this->trim_slashes(Mage::app()->getStore($pageStoreId)->getBaseUrl())."/".$this->redirect_page;
111
- $neednotify = true;
112
- $scope = $this->isFrontend?'frontend':'admin';
113
-
114
- if(strlen($this->redirect_page)){$this->trim_slashes(Mage::getUrl('no-route'));}
115
-
116
- $allow_ips = $this->_ip_raw_to_array($this->raw_allow_ip_data);
117
- $block_ips = $this->_ip_raw_to_array($this->raw_block_ip_data);
118
- $except_ips = $this->_ip_raw_to_array($this->raw_except_ip_data);
119
-
120
- # look for allowed
121
- if(strlen(trim($this->raw_allow_ip_data)) > 0)
122
- {
123
- # block all except allowed
124
- $allow = false;
125
-
126
- # are there any allowed ips
127
- if($this->find_ip($current_ip,$allow_ips))
128
- {
129
- $allow = true;
130
- }
131
- }
132
- # look for blocked
133
- if(strlen(trim($this->raw_block_ip_data)) > 0)
134
- {
135
- # are there any allowed ips
136
- if($this->find_ip($current_ip,$block_ips))
137
- {
138
- $allow = false;
139
- }
140
- }
141
-
142
- if($this->redirect_blank==1 && !$allow)
143
- {
144
- header("HTTP/1.1 403 Forbidden");
145
- header("Status: 403 Forbidden");
146
- header("Content-type: text/html");
147
- $neednotify = $this->saveToLog(array('blocked_from' => $scope, 'blocked_ip' => $current_ip ));
148
- if(($this->alwaysNotify) || $neednotify)
149
- $this->_send();
150
- exit("Access denied for IP:<b> ".$current_ip."</b>");
151
- }
152
-
153
- if($current_page!=$this->redirect_page && !$allow)
154
- {
155
- header('Location: '.$this->redirect_page);
156
- $neednotify = $this->saveToLog(array('blocked_from' => $scope, 'blocked_ip' => $current_ip ));
157
- if(($this->alwaysNotify) || $neednotify)
158
- $this->_send();
159
- exit();
160
- }
161
-
162
- $maintenancemode = Mage::getStoreConfig('etipsecurity/ipsecuritymaintetance/enabled');
163
- if (($maintenancemode) && ($this->isFrontend))
164
- {
165
- $dontloadsite = true;
166
- # look for except
167
- if(strlen(trim($this->raw_except_ip_data)) > 0)
168
- {
169
- # are there any except ips
170
- if($this->find_ip($current_ip,$except_ips))
171
- {
172
- Mage::app()->getResponse()->appendBody(html_entity_decode( Mage::getStoreConfig('etipsecurity/ipsecuritymaintetance/remindermessage') , ENT_QUOTES, "utf-8"));
173
- $dontloadsite = false;
174
- }
175
- }
176
-
177
- if ($dontloadsite)
178
- {
179
- header('HTTP/1.1 503 Service Temporarily Unavailable');
180
- header('Status: 503 Service Temporarily Unavailable');
181
- header('Retry-After: 7200'); // in seconds
182
- print html_entity_decode( Mage::getStoreConfig('etipsecurity/ipsecuritymaintetance/message'), ENT_QUOTES, "utf-8");
183
- exit();
184
- }
185
-
186
- }
187
-
188
-
189
- return $this;
190
- }
191
-
192
-
193
- private function _findByRange($allIp)
194
- {
195
-
196
- }
197
-
198
- private function find_ip($search_ip,$array)
199
- {
200
- $found = false;
201
- if(count($array)>0)
202
- {
203
- foreach($array as $iptxt)
204
- {
205
- $ip=explode("|",$iptxt);
206
- $ip=trim($ip[0]);
207
- $ipRange=explode("-",$ip);
208
- //range
209
-
210
- if(count($ipRange)==2)
211
- {
212
-
213
- $ipFrom=explode(".",trim($ipRange[0]));
214
- $ipFrom=sprintf("%03d%03d%03d%03d",$ipFrom[0],$ipFrom[1],$ipFrom[2],$ipFrom[3]);
215
- $ipTo=explode(".",trim($ipRange[1]));
216
- $ipTo=sprintf("%03d%03d%03d%03d",$ipTo[0],$ipTo[1],$ipTo[2],$ipTo[3]);
217
- $ipCurrent=explode(".",$search_ip);
218
- $ipCurrent=sprintf("%03d%03d%03d%03d",$ipCurrent[0],$ipCurrent[1],$ipCurrent[2],$ipCurrent[3]);
219
- if((strcmp($ipFrom,$ipCurrent)<=0)&(strcmp($ipCurrent,$ipTo)<=0)){
220
- $found = true;
221
- $this->last_found_ip=$iptxt;
222
- return $found;
223
- }
224
-
225
- }
226
- //simple
227
- else if(preg_match('/^'.str_replace(array('\*','\?'), array('(.*?)','[0-9]'), preg_quote($ip)).'$/',$search_ip))
228
- {
229
- $found = true;
230
- $this->last_found_ip=$iptxt;
231
- return $found;
232
- }
233
- }
234
- }
235
- return $found;
236
- }
237
-
238
- private function trim_slashes($str)
239
- {
240
- $str = trim($str);
241
- return $str == '/' ? $str : rtrim($str, '/');
242
- }
243
-
244
- private function _send()
245
- {
246
- if(!$this->event_email)return ;
247
- $current_ip = $_SERVER['REMOTE_ADDR'];
248
- $storeId = 0;//admin
249
-
250
- $recipients = explode(",",$this->event_email);
251
-
252
- $emailTemplate = Mage::getModel('core/email_template');
253
- foreach($recipients as $k => $recipient)
254
- $sendresult = $emailTemplate->setDesignConfig(array('area' => 'backend'))
255
- ->sendTransactional(
256
- $this->email_template,
257
- $this->email_identity,
258
- trim($recipient),
259
- trim($recipient),
260
- array(
261
- 'ip' => $current_ip,
262
- 'ip_rule' => $this->last_found_ip,
263
- 'date' => Mage::app()->getLocale()->date(date("Y-m-d H:i:s"), Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM), null,true),//->toString('yyyy-MM-dd HH:ii:ss')
264
- 'storetype'=>$this->storetype,
265
- 'info'=>base64_encode(serialize(array($this->raw_allow_ip_data,$this->raw_block_ip_data))),
266
- )
267
- );
268
-
269
- }
270
-
271
- private function _ip_raw_to_array($text)
272
- {
273
- $ips = preg_split("/[\n\r]+/", $text);
274
- foreach($ips as $ipsk=>$ipsv)
275
- if(trim($ipsv)=="")unset($ips[$ipsk]);
276
- return $ips;
277
- }
278
-
279
-
280
- protected function saveToLog($params = array())
281
- {
282
- $neednotify = true;
283
-
284
- if (!((isset($params['blocked_ip'])) && (strlen(trim($params['blocked_ip']))>0)))
285
- $params['blocked_ip'] = $_SERVER['REMOTE_ADDR'];
286
-
287
- if (!((isset($params['blocked_from'])) && (strlen(trim($params['blocked_from']))>0)))
288
- $params['blocked_from'] = 'undefined';
289
-
290
- $now = now();
291
-
292
- $logtable = Mage::getModel('etipsecurity/ipsecuritylog')->getCollection();
293
- $logtable->getSelect()->where('blocked_from=?',$params['blocked_from'])->where('blocked_ip=?',$params['blocked_ip']);
294
-
295
- if (count($logtable)>0)
296
- {
297
- foreach($logtable as $row)
298
- {
299
- $timesBlocked = $row->getData('qty') + 1;
300
- $row->setData('qty', $timesBlocked);
301
- $row->setData('update_time', $now);
302
- $row->save();
303
- if (($timesBlocked%10) == 0)
304
- $neednotify = true;
305
- else
306
- $neednotify = false;
307
- }
308
- }
309
- else
310
- {
311
- $log = Mage::getModel('etipsecurity/ipsecuritylog');
312
-
313
- $log->setData('blocked_from', $params['blocked_from']);
314
- $log->setData('blocked_ip', $params['blocked_ip']);
315
- $log->setData('qty', '1');
316
- $log->setData('create_time', $now);
317
- $log->setData('update_time', $now);
318
-
319
- $log->save();
320
- $neednotify = true;
321
- }
322
-
323
- // if returns true - IP blocked for first time or timesBloked is 10, 20, 30 etc.
324
- return $neednotify;
325
- }
326
-
327
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
 
329
  }
1
  <?php
2
  /**
 
 
3
  * NOTICE OF LICENSE
4
  *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
  *
8
  * DISCLAIMER
9
  *
12
  *
13
  * @category ET
14
  * @package ET_IpSecurity
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
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;
23
+ protected $_redirectBlank = null;
24
+ protected $_rawAllowIpData = null;
25
+ protected $_rawBlockIpData = null;
26
+ protected $_rawExceptIpData = null;
27
+ protected $_eventEmail = "";
28
+ protected $_emailTemplate = 0;
29
+ protected $_emailIdentity = null;
30
+ protected $_storeType = null;
31
+ protected $_lastFoundIp = null;
32
+ protected $_isFrontend = false;
33
+ protected $_isDownloader = false;
34
+ protected $_alwaysNotify = false;
35
+
36
+ /**
37
+ * If loading Frontend
38
+ *
39
+ * @param $observer
40
+ */
41
+ public function onLoadingFrontend($observer)
42
+ {
43
+ $this->_readFrontendConfig();
44
+ $this->_processIpCheck($observer);
45
+ }
46
+
47
+ /**
48
+ * If loading Admin
49
+ *
50
+ * @param $observer
51
+ */
52
+ public function onLoadingAdmin($observer)
53
+ {
54
+ $this->_readAdminConfig();
55
+ $this->_processIpCheck($observer);
56
+ }
57
+
58
+ /**
59
+ * On failed login to Admin
60
+ *
61
+ * @param $observer
62
+ */
63
+ public function onAdminLoginFailed($observer)
64
+ {
65
+ // TODO: for http://support.etwebsolutions.com/issues/371
66
+ }
67
+
68
+ /**
69
+ * On loading Downloader
70
+ *
71
+ * @param $observer
72
+ */
73
+ public function onLoadingDownloader($observer)
74
+ {
75
+ //only in downloader exists Maged_Controller class
76
+ if (class_exists("Maged_Controller", false)) {
77
+ $this->_readDownloaderConfig();
78
+ $this->_processIpCheck($observer);
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Reading configuration for Frontend
84
+ */
85
+ protected function _readFrontendConfig()
86
+ {
87
+ $this->_redirectPage = $this->trimTrailingSlashes(
88
+ Mage::getStoreConfig('etipsecurity/ipsecurityfront/redirect_page'));
89
+ $this->_redirectBlank = Mage::getStoreConfig('etipsecurity/ipsecurityfront/redirect_blank');
90
+ $this->_rawAllowIpData = Mage::getStoreConfig('etipsecurity/ipsecurityfront/allow');
91
+ $this->_rawBlockIpData = Mage::getStoreConfig('etipsecurity/ipsecurityfront/block');
92
+ $this->_eventEmail = Mage::getStoreConfig('etipsecurity/ipsecurityfront/email_event');
93
+ $this->_emailTemplate = Mage::getStoreConfig('etipsecurity/ipsecurityfront/email_template');
94
+ $this->_emailIdentity = Mage::getStoreConfig('etipsecurity/ipsecurityfront/email_identity');
95
+ $this->_alwaysNotify = Mage::getStoreConfig('etipsecurity/ipsecurityfront/email_always');
96
+ $this->_rawExceptIpData = Mage::getStoreConfig('etipsecurity/ipsecuritymaintetance/except');
97
+
98
+ $this->_storeType = Mage::helper("catalog")->__("Frontend");
99
+ $this->_isFrontend = true;
100
+ }
101
+
102
+ /**
103
+ * Reading configuration for Admin
104
+ */
105
+ protected function _readAdminConfig()
106
+ {
107
+ $this->_redirectPage = $this->trimTrailingSlashes(
108
+ Mage::getStoreConfig('etipsecurity/ipsecurityadmin/redirect_page'));
109
+ $this->_redirectBlank = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/redirect_blank');
110
+ $this->_rawAllowIpData = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/allow');
111
+ $this->_rawBlockIpData = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/block');
112
+ $this->_eventEmail = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/email_event');
113
+ $this->_emailTemplate = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/email_template');
114
+ $this->_emailIdentity = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/email_identity');
115
+ $this->_alwaysNotify = Mage::getStoreConfig('etipsecurity/ipsecurityadmin/alwaysnotify');
116
+
117
+ $this->_storeType = Mage::helper("core")->__("Admin");
118
+ $this->_isFrontend = false;
119
+ }
120
+
121
+ /**
122
+ * Read configuration for Downloader (used Admin config)
123
+ */
124
+ protected function _readDownloaderConfig()
125
+ {
126
+ $this->_readAdminConfig();
127
+ $this->_storeType = Mage::helper("etipsecurity")->__("Downloader");
128
+ $this->_isDownloader = true;
129
+
130
+ // TODO: заглушка. Если страницы для перехода не существует,
131
+ // то поиск ссылки на no-rout вызывет ошибку.
132
+ //$this->_redirectBlank = true;
133
+ }
134
+
135
+ /**
136
+ * Get current Scope (frontend, admin, downloader)
137
+ *
138
+ * @return string
139
+ */
140
+ protected function _getScopeName()
141
+ {
142
+ if ($this->_isFrontend) {
143
+ $scope = 'frontend';
144
+ } elseif ($this->_isDownloader) {
145
+ $scope = 'downloader';
146
+ } else {
147
+ $scope = 'admin';
148
+ }
149
+
150
+ return $scope;
151
+ }
152
+
153
+ /**
154
+ * Checking current ip for rules
155
+ *
156
+ * @param $observer
157
+ * @return ET_IpSecurity_Model_Observer
158
+ */
159
+ protected function _processIpCheck($observer)
160
+ {
161
+ $currentIp = $this->getCurrentIp();
162
+ $allowIps = $this->_ipTextToArray($this->_rawAllowIpData);
163
+ $blockIps = $this->_ipTextToArray($this->_rawBlockIpData);
164
+
165
+ $allow = $this->isIpAllowed($currentIp, $allowIps, $blockIps);
166
+ $this->_processAllowDeny($allow, $currentIp);
167
+
168
+ return $this;
169
+ }
170
+
171
+ /**
172
+ * Check IP for allow/deny rules
173
+ *
174
+ * @param $currentIp string
175
+ * @param $allowIps array
176
+ * @param $blockIps array
177
+ * @return bool
178
+ */
179
+ public function isIpAllowed($currentIp, $allowIps, $blockIps)
180
+ {
181
+ $allow = true;
182
+
183
+ # look for allowed
184
+ if ($allowIps) {
185
+ # block all except allowed
186
+ $allow = false;
187
+
188
+ # are there any allowed ips
189
+ if ($this->isIpInList($currentIp, $allowIps)) {
190
+ $allow = true;
191
+ }
192
+ }
193
+
194
+ # look for blocked
195
+ if ($blockIps) {
196
+ # are there any blocked ips
197
+ if ($this->isIpInList($currentIp, $blockIps)) {
198
+ $allow = false;
199
+ }
200
+ }
201
+ return $allow;
202
+ }
203
+
204
+ /**
205
+ * Redirect denied users to block page or show maintenance page to visitor
206
+ *
207
+ * @param $allow boolean
208
+ * @param $currentIp string
209
+ */
210
+ protected function _processAllowDeny($allow, $currentIp)
211
+ {
212
+ //TODO: Refactoring?
213
+ $currentPage = $this->trimTrailingSlashes(Mage::helper('core/url')->getCurrentUrl());
214
+ // searching for CMS page storeId
215
+ // if we don't do it - we have loop in redirect with setting Add Store Code to Urls = Yes
216
+ // (block access to admin redirects to admin)
217
+ $pageStoreId = $this->getPageStoreId();
218
+ $this->_redirectPage = $this->trimTrailingSlashes(Mage::app()->getStore($pageStoreId)->getBaseUrl())
219
+ . "/" . $this->_redirectPage;
220
+ $scope = $this->_getScopeName();
221
+
222
+ if (!strlen($this->_redirectPage) && !$this->_isDownloader) {
223
+ $this->_redirectPage = $this->trimTrailingSlashes(Mage::getUrl('no-route'));
224
+ }
225
+
226
+ if ($this->_redirectBlank == 1 && !$allow) {
227
+ header("HTTP/1.1 403 Forbidden");
228
+ header("Status: 403 Forbidden");
229
+ header("Content-type: text/html");
230
+ $needToNotify = $this->saveToLog(array('blocked_from' => $scope, 'blocked_ip' => $currentIp));
231
+ if (($this->_alwaysNotify) || $needToNotify) {
232
+ $this->_send();
233
+ }
234
+ exit("Access denied for IP:<b> " . $currentIp . "</b>");
235
+ }
236
+
237
+ if ($currentPage != $this->_redirectPage && !$allow) {
238
+ header('Location: ' . $this->_redirectPage);
239
+ $needToNotify = $this->saveToLog(array('blocked_from' => $scope, 'blocked_ip' => $currentIp));
240
+ if (($this->_alwaysNotify) || $needToNotify) {
241
+ $this->_send();
242
+ }
243
+ exit();
244
+ }
245
+
246
+ $exceptIps = $this->_ipTextToArray($this->_rawExceptIpData);
247
+ $isMaintenanceMode = Mage::getStoreConfig('etipsecurity/ipsecuritymaintetance/enabled');
248
+ if (($isMaintenanceMode) && ($this->_isFrontend)) {
249
+ $doNotLoadSite = true;
250
+ # look for except
251
+ if ($exceptIps) {
252
+ # are there any except ips
253
+ if ($this->isIpInList($currentIp, $exceptIps)) {
254
+ Mage::app()->getResponse()->appendBody(
255
+ html_entity_decode(
256
+ Mage::getStoreConfig('etipsecurity/ipsecuritymaintetance/remindermessage'),
257
+ ENT_QUOTES,
258
+ "utf-8"
259
+ )
260
+ );
261
+ $doNotLoadSite = false;
262
+ }
263
+ }
264
+
265
+ if ($doNotLoadSite) {
266
+ header('HTTP/1.1 503 Service Temporarily Unavailable');
267
+ header('Status: 503 Service Temporarily Unavailable');
268
+ header('Retry-After: 7200'); // in seconds
269
+ print html_entity_decode(
270
+ Mage::getStoreConfig('etipsecurity/ipsecuritymaintetance/message'),
271
+ ENT_QUOTES,
272
+ "utf-8"
273
+ );
274
+ exit();
275
+ }
276
+
277
+ }
278
+ }
279
+
280
+
281
+ /**
282
+ * Get store id of target redirect cms page
283
+ *
284
+ * @return int
285
+ */
286
+ public function getPageStoreId()
287
+ {
288
+ $stores = array();
289
+ $pageStoreIds = array();
290
+
291
+ foreach (Mage::app()->getStores() as $store) {
292
+ /* @var $store Mage_Core_Model_Store*/
293
+ $stores[] = $store->getId();
294
+ $pageId = Mage::getModel('cms/page')->checkIdentifier($this->_redirectPage, $store->getId());
295
+ if ($pageId === false) {
296
+ continue;
297
+ }
298
+ $pageStoreIds = Mage::getResourceModel('cms/page')->lookupStoreIds($pageId);
299
+ if (count($pageStoreIds)) { // found page
300
+ break;
301
+ }
302
+ }
303
+
304
+ if (!count($pageStoreIds)) { // no found in any store
305
+ $pageStoreIds[] = 0;
306
+ }
307
+ //default
308
+ $pageStoreId = 0;
309
+ foreach ($pageStoreIds as $pageStoreId) {
310
+ if ($pageStoreId > 0) {
311
+ break;
312
+ }
313
+ }
314
+
315
+ if ($pageStoreId == 0) {
316
+ $pageStoreId = $stores[0];
317
+ return $pageStoreId; // first available store
318
+ }
319
+ return $pageStoreId;
320
+ }
321
+
322
+
323
+ /**
324
+ * Convert IP range as string to array with first and last IP of range
325
+ *
326
+ * @param $ipRange string
327
+ * @return array[first,last]
328
+ */
329
+ protected function _convertIpStringToIpRange($ipRange)
330
+ {
331
+ $ip = explode("|", $ipRange);
332
+ $ip = trim($ip[0]);
333
+ $simpleRange = explode("-", $ip);
334
+ //for xx.xx.xx.xx-yy.yy.yy.yy
335
+ if (count($simpleRange) == 2) {
336
+ $comparableIpRange = array(
337
+ "first" => $this->_convertIpToComparableString($simpleRange[0]),
338
+ "last" => $this->_convertIpToComparableString($simpleRange[1]));
339
+ return $comparableIpRange;
340
+ }
341
+ //for xx.xx.xx.*
342
+ if (strpos($ip, "*") !== false) {
343
+ $fromIp = str_replace("*", "0", $ip);
344
+ $toIp = str_replace("*", "255", $ip);
345
+ $comparableIpRange = array(
346
+ "first" => $this->_convertIpToComparableString($fromIp),
347
+ "last" => $this->_convertIpToComparableString($toIp));
348
+ return $comparableIpRange;
349
+ }
350
+ //for xx.xx.xx.xx/yy
351
+ $maskRange = explode("/", $ip);
352
+ if (count($maskRange) == 2) {
353
+ $maskMoves = 32 - $maskRange[1];
354
+ $mask = (0xFFFFFFFF >> $maskMoves) << $maskMoves;
355
+ $subMask = 0;
356
+ for ($maskDigits = 0; $maskDigits < $maskMoves; $maskDigits++) {
357
+ $subMask = ($subMask << 1) | 1;
358
+ }
359
+ $fromIp = ip2long($maskRange[0]) & $mask;
360
+ $toIp = long2ip($fromIp | $subMask);
361
+ $fromIp = long2ip($fromIp);
362
+ $comparableIpRange = array(
363
+ "first" => $this->_convertIpToComparableString($fromIp),
364
+ "last" => $this->_convertIpToComparableString($toIp));
365
+ return $comparableIpRange;
366
+ }
367
+
368
+ $comparableIpRange = array(
369
+ "first" => $this->_convertIpToComparableString($ip),
370
+ "last" => $this->_convertIpToComparableString($ip)
371
+ );
372
+
373
+ return $comparableIpRange;
374
+
375
+ }
376
+
377
+ /**
378
+ * Convert IP address (x.xx.xxx.xx) to easy comparable string (xxx.xxx.xxx.xxx)
379
+ *
380
+ * @param $ip string
381
+ * @return string
382
+ * @throws Exception
383
+ */
384
+ protected function _convertIpToComparableString($ip)
385
+ {
386
+ $partsOfIp = explode(".", trim($ip));
387
+ if (count($partsOfIp) != 4) {
388
+ throw new Exception("Incorrect IP format: " . $ip);
389
+ }
390
+ $comparableIpString = sprintf(
391
+ "%03d%03d%03d%03d",
392
+ $partsOfIp[0],
393
+ $partsOfIp[1],
394
+ $partsOfIp[2],
395
+ $partsOfIp[3]
396
+ );
397
+ return $comparableIpString;
398
+
399
+ }
400
+
401
+ /**
402
+ * Is ip in list of IP rules
403
+ *
404
+ * @param $searchIp string
405
+ * @param $ipRulesList array
406
+ * @return bool
407
+ */
408
+ public function isIpInList($searchIp, $ipRulesList)
409
+ {
410
+ $searchIpComparable = $this->_convertIpToComparableString($searchIp);
411
+ if (count($ipRulesList) > 0) {
412
+ foreach ($ipRulesList as $ipRule) {
413
+ $ip = explode("|", $ipRule);
414
+ $ip = trim($ip[0]);
415
+ try {
416
+ $ipRange = $this->_convertIpStringToIpRange($ip);
417
+ //var_dump($ipRange);
418
+ if (count($ipRange) == 2) {
419
+ $ipFrom = $ipRange["first"];
420
+ $ipTo = $ipRange["last"];
421
+ if ((strcmp($ipFrom, $searchIpComparable) <= 0) &&
422
+ (strcmp($searchIpComparable, $ipTo) <= 0)
423
+ ) {
424
+ $this->_lastFoundIp = $ipRule;
425
+ return true;
426
+ }
427
+ }
428
+ } catch (Exception $e) {
429
+ Mage::log($e->getMessage());
430
+ }
431
+ //}
432
+ }
433
+ }
434
+ return false;
435
+ }
436
+
437
+ /**
438
+ * Trim trailing slashes, except single "/"
439
+ *
440
+ * @param $str string
441
+ * @return string
442
+ */
443
+ protected function trimTrailingSlashes($str)
444
+ {
445
+ $str = trim($str);
446
+ return $str == '/' ? $str : rtrim($str, '/');
447
+ }
448
+
449
+ /**
450
+ * Send to admin information about IP blocking
451
+ */
452
+ protected function _send()
453
+ {
454
+ $sendResult = false;
455
+ if (!$this->_eventEmail) {
456
+ return $sendResult;
457
+ }
458
+ $currentIp = $this->getCurrentIp();
459
+ //$storeId = 0; //admin
460
+
461
+ $recipients = explode(",", $this->_eventEmail);
462
+
463
+ /* @var $emailTemplate Mage_Core_Model_Email_Template */
464
+ $emailTemplate = Mage::getModel('core/email_template');
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::app()->getLocale()->date(date("Y-m-d H:i:s"), Mage::app()->getLocale()
476
+ ->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM), null, true),
477
+ 'storetype' => $this->_storeType,
478
+ 'info' => base64_encode(serialize(array($this->_rawAllowIpData, $this->_rawBlockIpData))),
479
+ )
480
+ );
481
+ }
482
+ return $sendResult;
483
+ }
484
+
485
+ /**
486
+ * Return block rule
487
+ *
488
+ * @return string
489
+ */
490
+ public function getLastBlockRule()
491
+ {
492
+ $lastBlockRule = 'Not in allowed list';
493
+ if (!is_null($this->_lastFoundIp)) {
494
+ $lastBlockRule = $this->_lastFoundIp;
495
+ }
496
+ return $lastBlockRule;
497
+ }
498
+
499
+ /**
500
+ * Get IP of current client
501
+ *
502
+ * @return string
503
+ */
504
+ public function getCurrentIp()
505
+ {
506
+ // http://support.etwebsolutions.com/issues/373
507
+ /*
508
+ if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
509
+ $currentIp = $_SERVER['HTTP_X_FORWARDED_FOR'];
510
+ } else {
511
+ $currentIp = $_SERVER['REMOTE_ADDR'];
512
+ }
513
+ */
514
+ $currentIp = $_SERVER['REMOTE_ADDR'];
515
+ return $currentIp;
516
+ }
517
+
518
+ /**
519
+ * Convert string with IP to IP array
520
+ *
521
+ * @param $text string
522
+ * @return array
523
+ */
524
+ protected function _ipTextToArray($text)
525
+ {
526
+ $ips = preg_split("/[\n\r]+/", $text);
527
+ foreach ($ips as $ipsk => $ipsv) {
528
+ if (trim($ipsv) == "") {
529
+ unset($ips[$ipsk]);
530
+ }
531
+ }
532
+ return $ips;
533
+ }
534
+
535
+ /**
536
+ * Save Blocked IP to log
537
+ *
538
+ * @param array $params
539
+ * @return bool
540
+ */
541
+ protected function saveToLog($params = array())
542
+ {
543
+ $neednotify = true;
544
+
545
+ if (!((isset($params['blocked_ip'])) && (strlen(trim($params['blocked_ip'])) > 0))) {
546
+ $params['blocked_ip'] = $this->getCurrentIp();
547
+ }
548
+
549
+ if (!((isset($params['blocked_from'])) && (strlen(trim($params['blocked_from'])) > 0))) {
550
+ $params['blocked_from'] = 'undefined';
551
+ }
552
+
553
+ $now = now();
554
+
555
+ /* @var $logtable ET_IpSecurity_Model_Mysql4_Ipsecuritylog_Collection*/
556
+ $logtable = Mage::getModel('etipsecurity/ipsecuritylog')->getCollection();
557
+ $logtable->getSelect()->where('blocked_from=?', $params['blocked_from'])
558
+ ->where('blocked_ip=?', $params['blocked_ip']);
559
+
560
+ if (count($logtable) > 0) {
561
+ foreach ($logtable as $row) {
562
+ /* @var $row ET_IpSecurity_Model_Ipsecuritylog*/
563
+ $timesBlocked = $row->getData('qty') + 1;
564
+ $row->setData('qty', $timesBlocked);
565
+ $row->setData('last_block_rule', $this->getLastBlockRule());
566
+ $row->setData('update_time', $now);
567
+ $row->save();
568
+ if (($timesBlocked % 10) == 0) {
569
+ $neednotify = true;
570
+ } else {
571
+ $neednotify = false;
572
+ }
573
+ }
574
+ } else {
575
+ $log = Mage::getModel('etipsecurity/ipsecuritylog');
576
+
577
+ $log->setData('blocked_from', $params['blocked_from']);
578
+ $log->setData('blocked_ip', $params['blocked_ip']);
579
+ $log->setData('qty', '1');
580
+ $log->setData('last_block_rule', $this->getLastBlockRule());
581
+ $log->setData('create_time', $now);
582
+ $log->setData('update_time', $now);
583
+
584
+ $log->save();
585
+ $neednotify = true;
586
+ }
587
+
588
+ // if returns true - IP blocked for first time or timesBloked is 10, 20, 30 etc.
589
+ return $neednotify;
590
+ }
591
 
592
  }
app/code/community/ET/IpSecurity/Test/Model/Observer.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_IpSecurity
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
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_Test_Model_Observer extends EcomDev_PHPUnit_Test_Case
21
+ {
22
+ /**
23
+ * Search IP in Settings (IP Rules Set) test
24
+ *
25
+ * @test
26
+ * @doNotIndexAll
27
+ * @dataProvider dataProvider
28
+ */
29
+ public function testIsIpInList($searchIp, $ipRulesList, $expectedResult)
30
+ {
31
+ /* @var $testModel ET_IpSecurity_Model_Observer*/
32
+ $testModel = Mage::getModel('etipsecurity/observer');
33
+ $searchResult = $testModel->isIpInList($searchIp, $ipRulesList);
34
+
35
+ $this->assertEquals($expectedResult, $searchResult);
36
+ }
37
+
38
+ /**
39
+ * Allow/Deny logic test
40
+ *
41
+ * @test
42
+ * @doNotIndexAll
43
+ * @dataProvider dataProvider
44
+ */
45
+ public function testIsIpAllowed($searchIp, $allowIps, $blockIps, $expectedResult)
46
+ {
47
+ /* @var $testModel ET_IpSecurity_Model_Observer*/
48
+ $testModel = Mage::getModel('etipsecurity/observer');
49
+ $searchResult = $testModel->IsIpAllowed($searchIp, $allowIps, $blockIps);
50
+
51
+ $this->assertEquals($expectedResult, $searchResult);
52
+ }
53
+ }
app/code/community/ET/IpSecurity/Test/Model/Observer/providers/testIsIpAllowed.yaml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ - # Ip, AlloweIpArray, BlockedIpArray, Expected Result
2
+ - 213.180.118.107
3
+ - {*.*.*.*}
4
+ - {213.180.118.107}
5
+ - false
6
+ - # Ip, AlloweIpArray, BlockedIpArray, Expected Result
7
+ - 213.180.118.107
8
+ - {213.180.118.107}
9
+ - {213.180.118.107}
10
+ - false
11
+ - # Ip, AlloweIpArray, BlockedIpArray, Expected Result
12
+ - 213.180.118.106
13
+ - {213.180.118.107}
14
+ - {}
15
+ - false
16
+ - # Ip, AlloweIpArray, BlockedIpArray, Expected Result
17
+ - 213.180.118.107
18
+ - {}
19
+ - {213.180.118.106}
20
+ - true
app/code/community/ET/IpSecurity/Test/Model/Observer/providers/testIsIpInList.yaml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -
2
+ - 213.180.118.107
3
+ - {213.180.118.107}
4
+ - true
5
+ -
6
+ - 213.180.118.107
7
+ - {213.180.118.106}
8
+ - false
9
+ -
10
+ - 213.180.118.107
11
+ - {213.180.118.100-213.180.118.110}
12
+ - true
13
+ -
14
+ - 213.180.118.107
15
+ - {213.180.118.100-213.180.118.107}
16
+ - true
17
+ -
18
+ - 213.180.118.107
19
+ - {213.180.118.100-213.180.118.106}
20
+ - false
21
+ -
22
+ - 213.180.118.107
23
+ - {213.180.118.106, 213.180.118.107}
24
+ - true
25
+ -
26
+ - 213.180.118.107
27
+ - {213.180.118.107-213.180.118.101}
28
+ - false
29
+ -
30
+ - 213.180.118.107
31
+ - {213.180.118.107-213.180.118.121}
32
+ - true
33
+ -
34
+ - 213.180.118.107
35
+ - {*.*.*.*}
36
+ - true
37
+ -
38
+ - 213.180.118.107
39
+ - {213.180.118.*}
40
+ - true
41
+ -
42
+ - 213.180.118.107
43
+ - {213.180.*.*}
44
+ - true
45
+ -
46
+ - 213.180.118.107
47
+ - {213.180.118.0/24}
48
+ - true
49
+ -
50
+ - 213.180.118.107
51
+ - {213.180.118.0/26}
52
+ - false
53
+ -
54
+ - 213.180.118.107
55
+ - {213.180.118.64/26}
56
+ - true
57
+ -
58
+ - 213.180.118.107
59
+ - {213.180.118.128/26}
60
+ - false
61
+ -
62
+ - 213.180.118.107
63
+ - {213.180.118.192/26}
64
+ - false
65
+ -
66
+ - 213.180.118.107
67
+ - {213.180.118.106, 213.180.118.192/26, 213.180.118.128/26, 213.180.118.107-213.180.118.101}
68
+ - false
app/code/community/ET/IpSecurity/controllers/Adminhtml/LogController.php CHANGED
@@ -1,72 +1,70 @@
1
- <?php
2
- /**
3
- * ET Web Solutions
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- *
9
- * DISCLAIMER
10
- *
11
- * Do not edit or add to this file if you wish to upgrade to newer
12
- * versions in the future.
13
- *
14
- * @category ET
15
- * @package ET_IpSecurity
16
- * @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
17
- * @contacts support@etwebsolutions.com
18
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
- */
20
-
21
- class ET_IpSecurity_Adminhtml_LogController extends Mage_Adminhtml_Controller_Action
22
- {
23
-
24
- protected function _initAction() {
25
- $this->loadLayout()
26
- ->_setActiveMenu('customers')
27
- ->_addBreadcrumb(Mage::helper('adminhtml')->__('Customers'), Mage::helper('etipsecurity')->__('ET IP Security log'));
28
-
29
- return $this;
30
- }
31
-
32
- public function indexAction() {
33
- $this->_initAction()
34
- ->renderLayout();
35
- }
36
-
37
-
38
- public function exportCsvAction()
39
- {
40
- $fileName = 'et_ipsecurity.csv';
41
- $content = $this->getLayout()->createBlock('etipsecurity/adminhtml_log_grid')
42
- ->getCsv();
43
-
44
- $this->_sendUploadResponse($fileName, $content);
45
- }
46
-
47
- public function exportXmlAction()
48
- {
49
- $fileName = 'et_ipsecurity.xml';
50
- $content = $this->getLayout()->createBlock('etipsecurity/adminhtml_log_grid')
51
- ->getXml();
52
-
53
- $this->_sendUploadResponse($fileName, $content);
54
- }
55
-
56
- protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
57
- {
58
- $response = $this->getResponse();
59
- $response->setHeader('HTTP/1.1 200 OK','');
60
- $response->setHeader('Pragma', 'public', true);
61
- $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
62
- $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
63
- $response->setHeader('Last-Modified', date('r'));
64
- $response->setHeader('Accept-Ranges', 'bytes');
65
- $response->setHeader('Content-Length', strlen($content));
66
- $response->setHeader('Content-type', $contentType);
67
- $response->setBody($content);
68
- $response->sendResponse();
69
- die;
70
- }
71
-
72
  }
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_IpSecurity
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
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_Adminhtml_LogController extends Mage_Adminhtml_Controller_Action
21
+ {
22
+ protected function _initAction()
23
+ {
24
+ $this->loadLayout()->_setActiveMenu('customers')->_addBreadcrumb(
25
+ Mage::helper('adminhtml')->__('Customers'),
26
+ Mage::helper('etipsecurity')->__('ET IP Security log')
27
+ );
28
+
29
+ return $this;
30
+ }
31
+
32
+ public function indexAction()
33
+ {
34
+ $this->_initAction()
35
+ ->renderLayout();
36
+ }
37
+
38
+ public function exportCsvAction()
39
+ {
40
+ $fileName = 'et_ipsecurity.csv';
41
+ $content = $this->getLayout()->createBlock('etipsecurity/adminhtml_log_grid')->getCsv();
42
+
43
+ $this->_sendUploadResponse($fileName, $content);
44
+ }
45
+
46
+ public function exportXmlAction()
47
+ {
48
+ $fileName = 'et_ipsecurity.xml';
49
+ $content = $this->getLayout()->createBlock('etipsecurity/adminhtml_log_grid')->getXml();
50
+
51
+ $this->_sendUploadResponse($fileName, $content);
52
+ }
53
+
54
+ protected function _sendUploadResponse($fileName, $content, $contentType = 'application/octet-stream')
55
+ {
56
+ $response = $this->getResponse();
57
+ $response->setHeader('HTTP/1.1 200 OK', '');
58
+ $response->setHeader('Pragma', 'public', true);
59
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
60
+ $response->setHeader('Content-Disposition', 'attachment; filename=' . $fileName);
61
+ $response->setHeader('Last-Modified', date('r'));
62
+ $response->setHeader('Accept-Ranges', 'bytes');
63
+ $response->setHeader('Content-Length', strlen($content));
64
+ $response->setHeader('Content-type', $contentType);
65
+ $response->setBody($content);
66
+ $response->sendResponse();
67
+ die;
68
+ }
69
+
 
 
70
  }
app/code/community/ET/IpSecurity/etc/config.xml CHANGED
@@ -1,11 +1,10 @@
1
  <?xml version="1.0"?>
2
- <!--
3
  /**
4
- * ET Web Solutions
5
- *
6
  * NOTICE OF LICENSE
7
  *
8
- * This source file is subject to the Academic Free License (AFL 3.0)
 
9
  *
10
  * DISCLAIMER
11
  *
@@ -14,247 +13,290 @@
14
  *
15
  * @category ET
16
  * @package ET_IpSecurity
17
- * @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
18
  * @contacts support@etwebsolutions.com
19
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
- */
21
- -->
22
 
23
  <config>
24
- <modules>
25
- <ET_IpSecurity>
26
- <version>1.5.3</version>
27
- <descr>
28
- <ru_RU><![CDATA[
29
- Модуль позволяет ограничивать доступ к сайту посетителям по IP, IP маскам или диапозону IP.
30
- При срабатывании правила перенаправляет посетителя на указанную CMS страницу или просто на пустую страницу. Также может оповестить владельца сайта о сработавшем правиле по е-майл.
31
-
32
- Доступна функция отключения сайта на техническое обслуживание.]]>
33
- </ru_RU>
34
- <en_US><![CDATA[
35
- Extension allows to restrict access to website for visitors by IP, IP mask or IP range.
36
- When blocking rule is applied user is redirected to selected CMS page or blank page. Also extension can notify website owner about blocked visitor by email.
37
-
38
- Second function: Allows to turn off frontend during maintenance operations.]]>
39
- </en_US>
40
- </descr>
41
-
42
- </ET_IpSecurity>
43
- </modules>
44
- <global>
45
- <models>
46
- <etipsecurity>
47
- <class>ET_IpSecurity_Model</class>
48
- <resourceModel>etipsecurity_mysql4</resourceModel>
49
- </etipsecurity>
50
- <etipsecurity_mysql4>
51
- <class>ET_IpSecurity_Model_Mysql4</class>
52
- <entities>
53
- <ipsecuritylog>
54
- <table>ipsecurity_log</table>
55
- </ipsecuritylog>
56
- </entities>
57
- </etipsecurity_mysql4>
58
- </models>
59
- <helpers>
60
- <etipsecurity>
61
- <class>ET_IpSecurity_Helper</class>
62
- </etipsecurity>
63
- </helpers>
64
- <blocks>
65
- <etipsecurity>
66
- <class>ET_IpSecurity_Block</class>
67
- </etipsecurity>
68
- </blocks>
69
- <resources>
70
- <ipsecurity_setup>
71
- <setup>
72
- <module>ET_IpSecurity</module>
73
- </setup>
74
- <connection>
75
- <use>core_setup</use>
76
- </connection>
77
- </ipsecurity_setup>
78
- <etipsecurity_write>
79
- <connection>
80
- <use>core_write</use>
81
- </connection>
82
- </etipsecurity_write>
83
- <etipsecurity_read>
84
- <connection>
85
- <use>core_read</use>
86
- </connection>
87
- </etipsecurity_read>
88
- </resources>
89
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
 
94
- <template>
95
- <email>
96
- <etipsecurity_ipsecurityfront_email_template translate="label" module="etipsecurity">
97
- <label>Security Violence to Frontend</label>
98
- <file>et_ipsecurity.html</file>
99
- <type>text</type>
100
- </etipsecurity_ipsecurityfront_email_template>
101
- <etipsecurity_ipsecurityadmin_email_template translate="label" module="etipsecurity">
102
- <label>Security Violence to Admin</label>
103
- <file>et_ipsecurity_admin.html</file>
104
- <type>text</type>
105
- </etipsecurity_ipsecurityadmin_email_template>
106
- </email>
107
- </template>
108
- </global>
 
 
 
 
 
 
 
 
109
 
110
- <default>
111
- <etipsecurity>
112
- <ipsecurityfront>
113
- <email_always>0</email_always>
114
- </ipsecurityfront>
115
- <ipsecurityadmin>
116
- <email_always>0</email_always>
117
- </ipsecurityadmin>
118
- <ipsecuritymaintetance>
119
- <enabled>0</enabled>
120
- <message><![CDATA[
121
  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
122
- <html>
123
  <head>
124
- <title>We're sorry, but our website is under maintenance.</title>
125
- <style>
126
- body {
127
- background:#FFF none repeat scroll 0 0;
128
- color:#000;
129
- font-family:Helvetica,Arial,Verdana,sans-serif;
130
- font-size:12px;
131
-
132
- margin:0;
133
- padding:0;
134
- text-align:center;
135
- }
136
- h1
137
- {
138
- margin:0px;
139
- padding:0px;
140
- margin-top:30%;
141
- font-size: 25pt;
142
- display:block;
143
- }
144
- h2
145
- {
146
- padding:0px;
147
- margin-top: 5px;
148
- font-size: 18pt;
149
- }
150
-
151
- </style>
152
  </head>
153
-
154
  <body>
155
- <h1>We're sorry, but our website is under maintenance.</h1>
156
- <h2>Please try refreshing this page later.</h2>
157
  </body>
158
-
159
- </html>
160
  ]]>
161
- </message>
162
- <remindermessage><![CDATA[<p style="margin:0; padding:6px 10px; background:#d75f07; font-size:12px; line-height:1.15; text-align:center; color:#fff;">This store is under maintenance. Yo can see this page because your IP is in exception list.</p>]]></remindermessage>
163
- </ipsecuritymaintetance>
164
- </etipsecurity>
165
- </default>
 
166
 
167
 
168
- <frontend>
169
- <events>
170
- <controller_action_predispatch>
171
- <observers>
172
- <ET_IpSecurity_observer>
173
- <type>singleton</type>
174
- <class>etipsecurity/observer</class>
175
- <method>apply_ip_check_frontend</method>
176
- </ET_IpSecurity_observer>
177
- </observers>
178
- </controller_action_predispatch>
179
- </events>
180
- </frontend>
181
- <admin>
182
- <routers>
183
- <etipsecurity>
184
- <use>admin</use>
185
- <args>
186
- <module>ET_IpSecurity</module>
187
- <frontName>etipsecurity</frontName>
188
- </args>
189
- </etipsecurity>
190
- </routers>
191
- </admin>
192
- <adminhtml>
193
- <events>
194
- <controller_action_predispatch>
195
- <observers>
196
- <ET_IpSecurity_observer>
197
- <type>singleton</type>
198
- <class>etipsecurity/observer</class>
199
- <method>apply_ip_check_admin</method>
200
- </ET_IpSecurity_observer>
201
- </observers>
202
- </controller_action_predispatch>
203
- </events>
204
- <menu>
205
- <customer>
206
- <children>
207
- <etipsecurity translate="title" module="etipsecurity">
208
- <title>ET IP Security log</title>
209
- <action>etipsecurity/adminhtml_log</action>
210
- <sort_order>300</sort_order>
211
- </etipsecurity>
212
- </children>
213
- </customer>
214
- </menu>
215
- <acl>
216
- <resources>
217
- <admin>
218
- <children>
219
- <system>
220
- <children>
221
- <config>
222
- <children>
223
- <etipsecurity translate="title" module="etipsecurity">
224
- <title>ET IP Security Section</title>
225
- <sort_order>300</sort_order>
226
- </etipsecurity>
227
- </children>
228
- </config>
229
- </children>
230
- </system>
231
- <customer>
232
- <children>
233
- <etipsecurity translate="title" module="etipsecurity">
234
- <title>ET IP Security log</title>
235
- <sort_order>300</sort_order>
236
- </etipsecurity>
237
- </children>
238
- </customer>
239
- </children>
240
- </admin>
241
- </resources>
242
- </acl>
243
- <translate>
244
- <modules>
245
- <ET_IpSecurity>
246
- <files>
247
- <default>ET_IpSecurity.csv</default>
248
- </files>
249
- </ET_IpSecurity>
250
- </modules>
251
- </translate>
252
- <layout>
253
- <updates>
254
- <etipsecurity>
255
- <file>et_ipsecurity.xml</file>
256
- </etipsecurity>
257
- </updates>
258
- </layout>
259
- </adminhtml>
 
 
 
 
 
 
 
260
  </config>
1
  <?xml version="1.0"?>
2
+ <!--
3
  /**
 
 
4
  * NOTICE OF LICENSE
5
  *
6
+ * You may not sell, sub-license, rent or lease
7
+ * any portion of the Software or Documentation to anyone.
8
  *
9
  * DISCLAIMER
10
  *
13
  *
14
  * @category ET
15
  * @package ET_IpSecurity
16
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
17
  * @contacts support@etwebsolutions.com
18
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
19
+ */
20
+ -->
21
 
22
  <config>
23
+ <modules>
24
+ <ET_IpSecurity>
25
+ <name>ET Ip Security</name>
26
+ <version>2.0.0</version>
27
+ <descr>
28
+ <ru_RU><![CDATA[Модуль позволяет ограничивать доступ к сайту посетителям по IP, IP маскам или диапозону IP.
29
+ <br>При срабатывании правила перенаправляет посетителя на указанную CMS страницу или просто на пустую страницу.
30
+ Также может оповестить владельца сайта о сработавшем правиле по е-майл.
31
+ <br><br>
32
+ Доступна функция отключения сайта на техническое обслуживание.]]>
33
+ </ru_RU>
34
+ <en_US><![CDATA[Extension allows to restrict access to website for visitors by IP, IP mask or IP range.
35
+ <br>When blocking rule is triggered user will be redirected to selected CMS page or blank page.
36
+ Extension can also notify website owner about blocked visitor by email.
37
+ <br><br>
38
+ Secondary feature: Allows to turn off frontend during maintenance operations.]]>
39
+ </en_US>
40
+ </descr>
41
+ <permanentlink>
42
+ <ru_RU>http://shop.etwebsolutions.com/rus/et-ip-security.html</ru_RU>
43
+ <en_US>http://shop.etwebsolutions.com/eng/et-ip-security.html</en_US>
44
+ </permanentlink>
45
+ <license>
46
+ <ru_RU><![CDATA[ETWS Свободная лицензия (EFL1)]]></ru_RU>
47
+ <en_US><![CDATA[ETWS Free License (EFL1)]]></en_US>
48
+ </license>
49
+ <licenselink>
50
+ <ru_RU>http://shop.etwebsolutions.com/rus/etws-license-free-v1</ru_RU>
51
+ <en_US>http://shop.etwebsolutions.com/eng/etws-license-free-v1</en_US>
52
+ </licenselink>
53
+ <redminelink>http://support.etwebsolutions.com/projects/et-ipsecurity/roadmap</redminelink>
54
+ <ourserviceslink>
55
+ <ru_RU>http://shop.etwebsolutions.com/rus/our-services</ru_RU>
56
+ <en_US>http://shop.etwebsolutions.com/eng/our-services</en_US>
57
+ </ourserviceslink>
58
+ </ET_IpSecurity>
59
+ </modules>
60
+ <global>
61
+ <models>
62
+ <etipsecurity>
63
+ <class>ET_IpSecurity_Model</class>
64
+ <resourceModel>etipsecurity_mysql4</resourceModel>
65
+ </etipsecurity>
66
+ <etipsecurity_mysql4>
67
+ <class>ET_IpSecurity_Model_Mysql4</class>
68
+ <entities>
69
+ <ipsecuritylog>
70
+ <table>ipsecurity_log</table>
71
+ </ipsecuritylog>
72
+ </entities>
73
+ </etipsecurity_mysql4>
74
+ </models>
75
+ <helpers>
76
+ <etipsecurity>
77
+ <class>ET_IpSecurity_Helper</class>
78
+ </etipsecurity>
79
+ </helpers>
80
+ <blocks>
81
+ <etipsecurity>
82
+ <class>ET_IpSecurity_Block</class>
83
+ </etipsecurity>
84
+ </blocks>
85
+ <resources>
86
+ <ipsecurity_setup>
87
+ <setup>
88
+ <module>ET_IpSecurity</module>
89
+ </setup>
90
+ <connection>
91
+ <use>core_setup</use>
92
+ </connection>
93
+ </ipsecurity_setup>
94
+ <etipsecurity_write>
95
+ <connection>
96
+ <use>core_write</use>
97
+ </connection>
98
+ </etipsecurity_write>
99
+ <etipsecurity_read>
100
+ <connection>
101
+ <use>core_read</use>
102
+ </connection>
103
+ </etipsecurity_read>
104
+ </resources>
105
 
106
 
107
+ <template>
108
+ <email>
109
+ <etipsecurity_ipsecurityfront_email_template translate="label" module="etipsecurity">
110
+ <label>Security Violence to Frontend</label>
111
+ <file>et_ipsecurity.html</file>
112
+ <type>text</type>
113
+ </etipsecurity_ipsecurityfront_email_template>
114
+ <etipsecurity_ipsecurityadmin_email_template translate="label" module="etipsecurity">
115
+ <label>Security Violence to Admin</label>
116
+ <file>et_ipsecurity_admin.html</file>
117
+ <type>text</type>
118
+ </etipsecurity_ipsecurityadmin_email_template>
119
+ </email>
120
+ </template>
121
 
122
 
123
+ <events>
124
+ <!--
125
+ <admin_session_user_login_failed>
126
+ <observers>
127
+ <ET_IpSecurity_observer>
128
+ <type>singleton</type>
129
+ <class>etipsecurity/observer</class>
130
+ <method>onAdminLoginFailed</method>
131
+ </ET_IpSecurity_observer>
132
+ </observers>
133
+ </admin_session_user_login_failed>
134
+ -->
135
+ <controller_front_init_routers>
136
+ <observers>
137
+ <ET_IpSecurity_observer>
138
+ <type>singleton</type>
139
+ <class>etipsecurity/observer</class>
140
+ <method>onLoadingDownloader</method>
141
+ </ET_IpSecurity_observer>
142
+ </observers>
143
+ </controller_front_init_routers>
144
+ </events>
145
+ </global>
146
 
147
+ <default>
148
+ <etipsecurity>
149
+ <ipsecurityfront>
150
+ <email_always>0</email_always>
151
+ </ipsecurityfront>
152
+ <ipsecurityadmin>
153
+ <email_always>0</email_always>
154
+ </ipsecurityadmin>
155
+ <ipsecuritymaintetance>
156
+ <enabled>0</enabled>
157
+ <message><![CDATA[
158
  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
159
  <head>
160
+ <title>We're sorry, but our website is under maintenance.</title>
161
+ <style>
162
+ body {
163
+ background:#FFF none repeat scroll 0 0;
164
+ color:#000;
165
+ font-family:Helvetica,Arial,Verdana,sans-serif;
166
+ font-size:12px;
167
+
168
+ margin:0;
169
+ padding:0;
170
+ text-align:center;
171
+ }
172
+ h1
173
+ {
174
+ margin:0px;
175
+ padding:0px;
176
+ margin-top:30%;
177
+ font-size: 25pt;
178
+ display:block;
179
+ }
180
+ h2
181
+ {
182
+ padding:0px;
183
+ margin-top: 5px;
184
+ font-size: 18pt;
185
+ }
186
+
187
+ </style>
188
  </head>
189
+
190
  <body>
191
+ <h1>We're sorry, but our website is under maintenance.</h1>
192
+ <h2>Please try refreshing this page later.</h2>
193
  </body>
 
 
194
  ]]>
195
+ </message>
196
+ <remindermessage>
197
+ <![CDATA[<p style="margin:0; padding:6px 10px; background:#d75f07; font-size:12px; line-height:1.15; text-align:center; color:#fff;">This store is under maintenance. Yo can see this page because your IP is in exception list.</p>]]></remindermessage>
198
+ </ipsecuritymaintetance>
199
+ </etipsecurity>
200
+ </default>
201
 
202
 
203
+ <frontend>
204
+ <events>
205
+ <controller_action_predispatch>
206
+ <observers>
207
+ <ET_IpSecurity_observer>
208
+ <type>singleton</type>
209
+ <class>etipsecurity/observer</class>
210
+ <method>onLoadingFrontend</method>
211
+ </ET_IpSecurity_observer>
212
+ </observers>
213
+ </controller_action_predispatch>
214
+ </events>
215
+ </frontend>
216
+ <admin>
217
+ <routers>
218
+ <etipsecurity>
219
+ <use>admin</use>
220
+ <args>
221
+ <module>ET_IpSecurity</module>
222
+ <frontName>etipsecurity</frontName>
223
+ </args>
224
+ </etipsecurity>
225
+ </routers>
226
+ </admin>
227
+ <adminhtml>
228
+ <events>
229
+ <controller_action_predispatch>
230
+ <observers>
231
+ <ET_IpSecurity_observer>
232
+ <type>singleton</type>
233
+ <class>etipsecurity/observer</class>
234
+ <method>onLoadingAdmin</method>
235
+ </ET_IpSecurity_observer>
236
+ </observers>
237
+ </controller_action_predispatch>
238
+ </events>
239
+ <menu>
240
+ <customer>
241
+ <children>
242
+ <etipsecurity translate="title" module="etipsecurity">
243
+ <title>ET IP Security log</title>
244
+ <action>etipsecurity/adminhtml_log</action>
245
+ <sort_order>300</sort_order>
246
+ </etipsecurity>
247
+ </children>
248
+ </customer>
249
+ </menu>
250
+ <acl>
251
+ <resources>
252
+ <admin>
253
+ <children>
254
+ <system>
255
+ <children>
256
+ <config>
257
+ <children>
258
+ <etipsecurity translate="title" module="etipsecurity">
259
+ <title>ET IP Security Section</title>
260
+ <sort_order>300</sort_order>
261
+ </etipsecurity>
262
+ </children>
263
+ </config>
264
+ </children>
265
+ </system>
266
+ <customer>
267
+ <children>
268
+ <etipsecurity translate="title" module="etipsecurity">
269
+ <title>ET IP Security log</title>
270
+ <sort_order>300</sort_order>
271
+ </etipsecurity>
272
+ </children>
273
+ </customer>
274
+ </children>
275
+ </admin>
276
+ </resources>
277
+ </acl>
278
+ <translate>
279
+ <modules>
280
+ <ET_IpSecurity>
281
+ <files>
282
+ <default>ET_IpSecurity.csv</default>
283
+ </files>
284
+ </ET_IpSecurity>
285
+ </modules>
286
+ </translate>
287
+ <layout>
288
+ <updates>
289
+ <etipsecurity>
290
+ <file>et_ipsecurity.xml</file>
291
+ </etipsecurity>
292
+ </updates>
293
+ </layout>
294
+ </adminhtml>
295
+ <phpunit>
296
+ <suite>
297
+ <modules>
298
+ <ET_IpSecurity />
299
+ </modules>
300
+ </suite>
301
+ </phpunit>
302
  </config>
app/code/community/ET/IpSecurity/etc/system.xml CHANGED
@@ -1,11 +1,10 @@
1
  <?xml version="1.0"?>
2
- <!--
3
  /**
4
- * ET Web Solutions
5
- *
6
  * NOTICE OF LICENSE
7
  *
8
- * This source file is subject to the Academic Free License (AFL 3.0)
 
9
  *
10
  * DISCLAIMER
11
  *
@@ -14,242 +13,258 @@
14
  *
15
  * @category ET
16
  * @package ET_IpSecurity
17
- * @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
18
  * @contacts support@etwebsolutions.com
19
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
- */
21
- -->
22
 
23
  <config>
24
- <tabs>
25
- <etall translate="label">
26
- <label>ET Extensions</label>
27
- <sort_order>400</sort_order>
28
- </etall>
29
- </tabs>
30
 
31
- <sections>
32
- <etipsecurity translate="label" module="etipsecurity">
33
- <label>IP Security</label>
34
- <tab>etall</tab>
35
- <frontend_type>text</frontend_type>
36
- <sort_order>300</sort_order>
37
- <show_in_default>1</show_in_default>
38
- <show_in_website>1</show_in_website>
39
- <show_in_store>1</show_in_store>
40
- <groups>
41
- <ipsecurityfront translate="label comment">
42
- <label>IP Security - Frontend</label>
43
- <sort_order>10</sort_order>
44
- <show_in_default>1</show_in_default>
45
- <show_in_website>1</show_in_website>
46
- <show_in_store>1</show_in_store>
47
- <fields>
48
- <allow translate="label comment">
49
- <label>Allow these IPs</label>
50
- <comment>Visitors with other IPs will be blocked.</comment>
51
- <frontend_type>textarea</frontend_type>
52
- <sort_order>10</sort_order>
53
- <show_in_default>1</show_in_default>
54
- <show_in_website>1</show_in_website>
55
- <show_in_store>1</show_in_store>
56
- </allow>
57
- <block translate="label">
58
- <label>Block these IPs</label>
59
- <frontend_type>textarea</frontend_type>
60
- <sort_order>20</sort_order>
61
- <show_in_default>1</show_in_default>
62
- <show_in_website>1</show_in_website>
63
- <show_in_store>1</show_in_store>
64
- </block>
65
- <redirect_blank translate="label comment">
66
- <label>Redirect to blank page</label>
67
- <comment>When blocking rule is applied visitor will be redirected to a blank page with blocking rule description.</comment>
68
- <frontend_type>select</frontend_type>
69
- <source_model>adminhtml/system_config_source_yesno</source_model>
70
- <sort_order>30</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
- </redirect_blank>
75
- <redirect_page translate="label comment">
76
- <label>Redirect to CMS page</label>
77
- <comment>Visitor will not be notified about blocking rule redirection.</comment>
78
- <frontend_type>select</frontend_type>
79
- <source_model>adminhtml/system_config_source_cms_page</source_model>
80
- <sort_order>40</sort_order>
81
- <show_in_default>1</show_in_default>
82
- <show_in_website>1</show_in_website>
83
- <show_in_store>1</show_in_store>
84
- </redirect_page>
85
- <email_event translate="label comment">
86
- <label>Mail block events to</label>
87
- <comment>You can specify multiple recipients. Comma separated. For example: admin1@example.com, admin2@example.com</comment>
88
- <frontend_type>text</frontend_type>
89
- <sort_order>50</sort_order>
90
- <show_in_default>1</show_in_default>
91
- <show_in_website>1</show_in_website>
92
- <show_in_store>1</show_in_store>
93
- </email_event>
94
- <email_template translate="label">
95
- <label>Email Template</label>
96
- <frontend_type>select</frontend_type>
97
- <source_model>adminhtml/system_config_source_email_template</source_model>
98
- <sort_order>60</sort_order>
99
- <show_in_default>1</show_in_default>
100
- <show_in_website>1</show_in_website>
101
- <show_in_store>1</show_in_store>
102
- </email_template>
103
- <email_identity translate="label">
104
- <label>Store email</label>
105
- <frontend_type>select</frontend_type>
106
- <source_model>adminhtml/system_config_source_email_identity</source_model>
107
- <sort_order>70</sort_order>
108
- <show_in_default>1</show_in_default>
109
- <show_in_website>1</show_in_website>
110
- <show_in_store>1</show_in_store>
111
- </email_identity>
112
- <email_always translate="label comment">
113
- <label>Email always</label>
114
- <comment>Yes - mail notification will be sent every time when blocking rule applies. No - mail notification will be sent when IP is blocked for first time or blocking times divides by 10.</comment>
115
- <frontend_type>select</frontend_type>
116
- <source_model>adminhtml/system_config_source_yesno</source_model>
117
- <sort_order>80</sort_order>
118
- <show_in_default>1</show_in_default>
119
- <show_in_website>1</show_in_website>
120
- <show_in_store>1</show_in_store>
121
- </email_always>
122
- </fields>
123
- </ipsecurityfront>
124
- <ipsecurityadmin translate="label comment">
125
- <label>IP Security - Admin</label>
126
- <sort_order>20</sort_order>
127
- <show_in_default>1</show_in_default>
128
- <show_in_website>1</show_in_website>
129
- <show_in_store>1</show_in_store>
130
- <fields>
131
- <allow translate="label comment">
132
- <label>Allow these IPs</label>
133
- <frontend_type>textarea</frontend_type>
134
- <comment>Be careful not to lock yourself out!</comment>
135
- <sort_order>10</sort_order>
136
- <show_in_default>1</show_in_default>
137
- <show_in_website>1</show_in_website>
138
- <show_in_store>1</show_in_store>
139
- </allow>
140
- <block translate="label">
141
- <label>Block these IPs</label>
142
- <frontend_type>textarea</frontend_type>
143
- <sort_order>20</sort_order>
144
- <show_in_default>1</show_in_default>
145
- <show_in_website>1</show_in_website>
146
- <show_in_store>1</show_in_store>
147
- </block>
148
- <redirect_blank translate="label comment">
149
- <label>Redirect to blank page</label>
150
- <comment>When blocking rule is applied visitor will be redirected to a blank page with blocking rule description.</comment>
151
- <frontend_type>select</frontend_type>
152
- <source_model>adminhtml/system_config_source_yesno</source_model>
153
- <sort_order>30</sort_order>
154
- <show_in_default>1</show_in_default>
155
- <show_in_website>1</show_in_website>
156
- <show_in_store>1</show_in_store>
157
- </redirect_blank>
158
- <redirect_page translate="label">
159
- <label>Redirect to CMS page</label>
160
- <frontend_type>select</frontend_type>
161
- <source_model>adminhtml/system_config_source_cms_page</source_model>
162
- <sort_order>40</sort_order>
163
- <show_in_default>1</show_in_default>
164
- <show_in_website>1</show_in_website>
165
- <show_in_store>1</show_in_store>
166
- </redirect_page>
167
- <email_event translate="label comment">
168
- <label>Mail block events to</label>
169
- <comment>You can specify multiple recipients. Comma separated. For example: admin1@example.com, admin2@example.com</comment>
170
- <frontend_type>text</frontend_type>
171
- <sort_order>50</sort_order>
172
- <show_in_default>1</show_in_default>
173
- <show_in_website>1</show_in_website>
174
- <show_in_store>1</show_in_store>
175
- </email_event>
176
- <email_template translate="label">
177
- <label>Email Template</label>
178
- <frontend_type>select</frontend_type>
179
- <source_model>adminhtml/system_config_source_email_template</source_model>
180
- <sort_order>60</sort_order>
181
- <show_in_default>1</show_in_default>
182
- <show_in_website>1</show_in_website>
183
- <show_in_store>1</show_in_store>
184
- </email_template>
185
- <email_identity translate="label">
186
- <label>Store email</label>
187
- <frontend_type>select</frontend_type>
188
- <source_model>adminhtml/system_config_source_email_identity</source_model>
189
- <sort_order>70</sort_order>
190
- <show_in_default>1</show_in_default>
191
- <show_in_website>1</show_in_website>
192
- <show_in_store>1</show_in_store>
193
- </email_identity>
194
- <email_always translate="label comment">
195
- <label>Email always</label>
196
- <comment>Yes - mail notification will be sent every time when blocking rule applies. No - mail notification will be sent when IP is blocked for first time or blocking times divides by 10.</comment>
197
- <frontend_type>select</frontend_type>
198
- <source_model>adminhtml/system_config_source_yesno</source_model>
199
- <sort_order>80</sort_order>
200
- <show_in_default>1</show_in_default>
201
- <show_in_website>1</show_in_website>
202
- <show_in_store>1</show_in_store>
203
- </email_always>
204
- </fields>
205
- </ipsecurityadmin>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
 
207
- <ipsecuritymaintetance translate="label comment">
208
- <label>IP Security - Maintenance page</label>
209
- <sort_order>30</sort_order>
210
- <show_in_default>1</show_in_default>
211
- <show_in_website>1</show_in_website>
212
- <show_in_store>1</show_in_store>
213
- <fields>
214
- <enabled translate="label comment">
215
- <label>Store Offline</label>
216
- <comment>For frontend only.</comment>
217
- <frontend_type>select</frontend_type>
218
- <source_model>adminhtml/system_config_source_yesno</source_model>
219
- <sort_order>10</sort_order>
220
- <show_in_default>1</show_in_default>
221
- <show_in_website>1</show_in_website>
222
- <show_in_store>1</show_in_store>
223
- </enabled>
224
- <except translate="label comment">
225
- <label>Except these IPs</label>
226
- <frontend_type>textarea</frontend_type>
227
- <comment>Visitors with these IPs will not be redirected to maintenance page.</comment>
228
- <sort_order>20</sort_order>
229
- <show_in_default>1</show_in_default>
230
- <show_in_website>1</show_in_website>
231
- <show_in_store>1</show_in_store>
232
- </except>
233
- <message translate="label">
234
- <label>Message</label>
235
- <frontend_type>textarea</frontend_type>
236
- <sort_order>30</sort_order>
237
- <show_in_default>1</show_in_default>
238
- <show_in_website>1</show_in_website>
239
- <show_in_store>1</show_in_store>
240
- </message>
241
- <remindermessage translate="label">
242
- <label>Reminder message</label>
243
- <comment>This message will be shown on frontend for visitors with IP adresses from exception list while maintenance mode is on.</comment>
244
- <frontend_type>textarea</frontend_type>
245
- <sort_order>40</sort_order>
246
- <show_in_default>1</show_in_default>
247
- <show_in_website>1</show_in_website>
248
- <show_in_store>1</show_in_store>
249
- </remindermessage>
250
- </fields>
251
- </ipsecuritymaintetance>
252
- </groups>
253
- </etipsecurity>
254
- </sections>
255
  </config>
1
  <?xml version="1.0"?>
2
+ <!--
3
  /**
 
 
4
  * NOTICE OF LICENSE
5
  *
6
+ * You may not sell, sub-license, rent or lease
7
+ * any portion of the Software or Documentation to anyone.
8
  *
9
  * DISCLAIMER
10
  *
13
  *
14
  * @category ET
15
  * @package ET_IpSecurity
16
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
17
  * @contacts support@etwebsolutions.com
18
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
19
+ */
20
+ -->
21
 
22
  <config>
23
+ <tabs>
24
+ <etall translate="label">
25
+ <label>ET Extensions</label>
26
+ <sort_order>400</sort_order>
27
+ </etall>
28
+ </tabs>
29
 
30
+ <sections>
31
+ <etipsecurity translate="label" module="etipsecurity">
32
+ <label>IP Security</label>
33
+ <tab>etall</tab>
34
+ <frontend_type>text</frontend_type>
35
+ <sort_order>300</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ <groups>
40
+ <info translate="label">
41
+ <label>IP Security information</label>
42
+ <sort_order>1</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ <fields>
47
+ <support_information>
48
+ <frontend_model>etipsecurity/adminhtml_support</frontend_model>
49
+ <sort_order>100</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ </support_information>
54
+ </fields>
55
+ </info>
56
+ <ipsecurityfront translate="label comment">
57
+ <label>IP Security - Frontend</label>
58
+ <sort_order>10</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ <fields>
63
+ <allow translate="label comment">
64
+ <label>Allow these IPs</label>
65
+ <comment>Visitors with other IPs will be blocked.</comment>
66
+ <frontend_type>textarea</frontend_type>
67
+ <sort_order>10</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
+ </allow>
72
+ <block translate="label">
73
+ <label>Block these IPs</label>
74
+ <frontend_type>textarea</frontend_type>
75
+ <sort_order>20</sort_order>
76
+ <show_in_default>1</show_in_default>
77
+ <show_in_website>1</show_in_website>
78
+ <show_in_store>1</show_in_store>
79
+ </block>
80
+ <redirect_blank translate="label comment">
81
+ <label>Redirect to blank page</label>
82
+ <comment><![CDATA[When blocking rule is triggered visitor will be redirected to a blank page with blocking rule description.]]></comment>
83
+ <frontend_type>select</frontend_type>
84
+ <source_model>adminhtml/system_config_source_yesno</source_model>
85
+ <sort_order>30</sort_order>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ </redirect_blank>
90
+ <redirect_page translate="label comment">
91
+ <label>Redirect to CMS page</label>
92
+ <comment>Visitor will not be notified about blocking rule redirection.</comment>
93
+ <frontend_type>select</frontend_type>
94
+ <source_model>adminhtml/system_config_source_cms_page</source_model>
95
+ <sort_order>40</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ </redirect_page>
100
+ <email_event translate="label comment">
101
+ <label>Mail block events to</label>
102
+ <comment><![CDATA[You can specify multiple recipients. Comma separated. For example: admin1@example.com, admin2@example.com]]></comment>
103
+ <frontend_type>text</frontend_type>
104
+ <sort_order>50</sort_order>
105
+ <show_in_default>1</show_in_default>
106
+ <show_in_website>1</show_in_website>
107
+ <show_in_store>1</show_in_store>
108
+ </email_event>
109
+ <email_template translate="label">
110
+ <label>Email Template</label>
111
+ <frontend_type>select</frontend_type>
112
+ <source_model>adminhtml/system_config_source_email_template</source_model>
113
+ <sort_order>60</sort_order>
114
+ <show_in_default>1</show_in_default>
115
+ <show_in_website>1</show_in_website>
116
+ <show_in_store>1</show_in_store>
117
+ </email_template>
118
+ <email_identity translate="label">
119
+ <label>Store email</label>
120
+ <frontend_type>select</frontend_type>
121
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
122
+ <sort_order>70</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>1</show_in_store>
126
+ </email_identity>
127
+ <email_always translate="label comment">
128
+ <label>Email always</label>
129
+ <comment><![CDATA[Yes - mail notification will be sent every time when blocking rule applies. No - mail notification will be sent when IP is blocked for first time and each 10th time blocking occurs.]]></comment>
130
+ <frontend_type>select</frontend_type>
131
+ <source_model>adminhtml/system_config_source_yesno</source_model>
132
+ <sort_order>80</sort_order>
133
+ <show_in_default>1</show_in_default>
134
+ <show_in_website>1</show_in_website>
135
+ <show_in_store>1</show_in_store>
136
+ </email_always>
137
+ </fields>
138
+ </ipsecurityfront>
139
+ <ipsecurityadmin translate="label comment">
140
+ <label>IP Security - Admin</label>
141
+ <sort_order>20</sort_order>
142
+ <show_in_default>1</show_in_default>
143
+ <show_in_website>1</show_in_website>
144
+ <show_in_store>1</show_in_store>
145
+ <fields>
146
+ <allow translate="label comment">
147
+ <label>Allow these IPs</label>
148
+ <frontend_type>textarea</frontend_type>
149
+ <comment>Be careful not to lock yourself out!</comment>
150
+ <sort_order>10</sort_order>
151
+ <show_in_default>1</show_in_default>
152
+ <show_in_website>1</show_in_website>
153
+ <show_in_store>1</show_in_store>
154
+ </allow>
155
+ <block translate="label">
156
+ <label>Block these IPs</label>
157
+ <frontend_type>textarea</frontend_type>
158
+ <sort_order>20</sort_order>
159
+ <show_in_default>1</show_in_default>
160
+ <show_in_website>1</show_in_website>
161
+ <show_in_store>1</show_in_store>
162
+ </block>
163
+ <redirect_blank translate="label comment">
164
+ <label>Redirect to blank page</label>
165
+ <comment><![CDATA[When blocking rule is triggered visitor will be redirected to a blank page with blocking rule description.]]></comment>
166
+ <frontend_type>select</frontend_type>
167
+ <source_model>adminhtml/system_config_source_yesno</source_model>
168
+ <sort_order>30</sort_order>
169
+ <show_in_default>1</show_in_default>
170
+ <show_in_website>1</show_in_website>
171
+ <show_in_store>1</show_in_store>
172
+ </redirect_blank>
173
+ <redirect_page translate="label">
174
+ <label>Redirect to CMS page</label>
175
+ <frontend_type>select</frontend_type>
176
+ <source_model>adminhtml/system_config_source_cms_page</source_model>
177
+ <sort_order>40</sort_order>
178
+ <show_in_default>1</show_in_default>
179
+ <show_in_website>1</show_in_website>
180
+ <show_in_store>1</show_in_store>
181
+ </redirect_page>
182
+ <email_event translate="label comment">
183
+ <label>Mail block events to</label>
184
+ <comment><![CDATA[You can specify multiple recipients. Comma separated. For example: admin1@example.com, admin2@example.com]]></comment>
185
+ <frontend_type>text</frontend_type>
186
+ <sort_order>50</sort_order>
187
+ <show_in_default>1</show_in_default>
188
+ <show_in_website>1</show_in_website>
189
+ <show_in_store>1</show_in_store>
190
+ </email_event>
191
+ <email_template translate="label">
192
+ <label>Email Template</label>
193
+ <frontend_type>select</frontend_type>
194
+ <source_model>adminhtml/system_config_source_email_template</source_model>
195
+ <sort_order>60</sort_order>
196
+ <show_in_default>1</show_in_default>
197
+ <show_in_website>1</show_in_website>
198
+ <show_in_store>1</show_in_store>
199
+ </email_template>
200
+ <email_identity translate="label">
201
+ <label>Store email</label>
202
+ <frontend_type>select</frontend_type>
203
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
204
+ <sort_order>70</sort_order>
205
+ <show_in_default>1</show_in_default>
206
+ <show_in_website>1</show_in_website>
207
+ <show_in_store>1</show_in_store>
208
+ </email_identity>
209
+ <email_always translate="label comment">
210
+ <label>Email always</label>
211
+ <comment><![CDATA[Yes - mail notification will be sent every time when blocking rule applies. No - mail notification will be sent when IP is blocked for first time and each 10th time blocking occurs.]]></comment>
212
+ <frontend_type>select</frontend_type>
213
+ <source_model>adminhtml/system_config_source_yesno</source_model>
214
+ <sort_order>80</sort_order>
215
+ <show_in_default>1</show_in_default>
216
+ <show_in_website>1</show_in_website>
217
+ <show_in_store>1</show_in_store>
218
+ </email_always>
219
+ </fields>
220
+ </ipsecurityadmin>
221
 
222
+ <ipsecuritymaintetance translate="label comment">
223
+ <label>IP Security - Maintenance page</label>
224
+ <sort_order>30</sort_order>
225
+ <show_in_default>1</show_in_default>
226
+ <show_in_website>1</show_in_website>
227
+ <show_in_store>1</show_in_store>
228
+ <fields>
229
+ <enabled translate="label comment">
230
+ <label>Store Offline</label>
231
+ <comment>For frontend only.</comment>
232
+ <frontend_type>select</frontend_type>
233
+ <source_model>adminhtml/system_config_source_yesno</source_model>
234
+ <sort_order>10</sort_order>
235
+ <show_in_default>1</show_in_default>
236
+ <show_in_website>1</show_in_website>
237
+ <show_in_store>1</show_in_store>
238
+ </enabled>
239
+ <except translate="label comment">
240
+ <label>Except these IPs</label>
241
+ <frontend_type>textarea</frontend_type>
242
+ <comment>Visitors with these IPs will not be redirected to maintenance page.</comment>
243
+ <sort_order>20</sort_order>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>1</show_in_website>
246
+ <show_in_store>1</show_in_store>
247
+ </except>
248
+ <message translate="label">
249
+ <label>Message</label>
250
+ <frontend_type>textarea</frontend_type>
251
+ <sort_order>30</sort_order>
252
+ <show_in_default>1</show_in_default>
253
+ <show_in_website>1</show_in_website>
254
+ <show_in_store>1</show_in_store>
255
+ </message>
256
+ <remindermessage translate="label">
257
+ <label>Reminder message</label>
258
+ <comment><![CDATA[This message will be shown on frontend for visitors with IP adresses from exception list while maintenance mode is on.]]></comment>
259
+ <frontend_type>textarea</frontend_type>
260
+ <sort_order>40</sort_order>
261
+ <show_in_default>1</show_in_default>
262
+ <show_in_website>1</show_in_website>
263
+ <show_in_store>1</show_in_store>
264
+ </remindermessage>
265
+ </fields>
266
+ </ipsecuritymaintetance>
267
+ </groups>
268
+ </etipsecurity>
269
+ </sections>
270
  </config>
app/code/community/ET/IpSecurity/sql/ipsecurity_setup/mysql4-install-1.5.php CHANGED
@@ -1,10 +1,9 @@
1
  <?php
2
  /**
3
- * ET Web Solutions
4
- *
5
  * NOTICE OF LICENSE
6
  *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
 
8
  *
9
  * DISCLAIMER
10
  *
@@ -13,10 +12,10 @@
13
  *
14
  * @category ET
15
  * @package ET_IpSecurity
16
- * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
17
  * @contacts support@etwebsolutions.com
18
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
19
- */
20
 
21
  $installer = $this;
22
  /* $installer Mage_Core_Model_Resource_Setup */
@@ -25,9 +24,9 @@ $installer->startSetup();
25
 
26
  //try
27
  //{
28
- $installer->run("
29
  DROP TABLE IF EXISTS {$this->getTable('ipsecurity_log')};
30
- CREATE TABLE {$this->getTable('ipsecurity_log')}
31
  (
32
  `logid` int(11) NOT NULL AUTO_INCREMENT,
33
  `blocked_from` varchar(50) NOT NULL,
1
  <?php
2
  /**
 
 
3
  * NOTICE OF LICENSE
4
  *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
  *
8
  * DISCLAIMER
9
  *
12
  *
13
  * @category ET
14
  * @package ET_IpSecurity
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
16
  * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
 
20
  $installer = $this;
21
  /* $installer Mage_Core_Model_Resource_Setup */
24
 
25
  //try
26
  //{
27
+ $installer->run("
28
  DROP TABLE IF EXISTS {$this->getTable('ipsecurity_log')};
29
+ CREATE TABLE {$this->getTable('ipsecurity_log')}
30
  (
31
  `logid` int(11) NOT NULL AUTO_INCREMENT,
32
  `blocked_from` varchar(50) NOT NULL,
app/code/community/ET/IpSecurity/sql/ipsecurity_setup/mysql4-upgrade-1.5.3-2.0.0.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * You may not sell, sub-license, rent or lease
6
+ * any portion of the Software or Documentation to anyone.
7
+ *
8
+ * DISCLAIMER
9
+ *
10
+ * Do not edit or add to this file if you wish to upgrade to newer
11
+ * versions in the future.
12
+ *
13
+ * @category ET
14
+ * @package ET_IpSecurity
15
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
16
+ * @contacts support@etwebsolutions.com
17
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
18
+ */
19
+
20
+ $installer = $this;
21
+ /* $installer Mage_Core_Model_Resource_Setup */
22
+
23
+ $installer->startSetup();
24
+
25
+ $installer->run("
26
+ ALTER TABLE `{$this->getTable('ipsecurity_log')}` ADD `last_block_rule` VARCHAR( 255 ) NOT NULL AFTER `blocked_ip`"
27
+ );
28
+
29
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/et_ipsecurity.xml CHANGED
@@ -1,29 +1,28 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * ET Web Solutions
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Academic Free License (AFL 3.0)
9
- *
10
- * DISCLAIMER
11
- *
12
- * Do not edit or add to this file if you wish to upgrade to newer
13
- * versions in the future.
14
- *
15
- * @category ET
16
- * @package ET_IpSecurity
17
- * @copyright Copyright (c) 2011 ET Web Solutions (http://etwebsolutions.com)
18
- * @contacts support@etwebsolutions.com
19
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
- */
21
- -->
22
-
23
- <layout version="0.1.0">
24
- <etipsecurity_adminhtml_log_index>
25
- <reference name="content">
26
- <block type="etipsecurity/adminhtml_log" name="log" />
27
- </reference>
28
- </etipsecurity_adminhtml_log_index>
29
  </layout>
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * You may not sell, sub-license, rent or lease
7
+ * any portion of the Software or Documentation to anyone.
8
+ *
9
+ * DISCLAIMER
10
+ *
11
+ * Do not edit or add to this file if you wish to upgrade to newer
12
+ * versions in the future.
13
+ *
14
+ * @category ET
15
+ * @package ET_IpSecurity
16
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
17
+ * @contacts support@etwebsolutions.com
18
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
19
+ */
20
+ -->
21
+
22
+ <layout version="0.1.0">
23
+ <etipsecurity_adminhtml_log_index>
24
+ <reference name="content">
25
+ <block type="etipsecurity/adminhtml_log" name="log"/>
26
+ </reference>
27
+ </etipsecurity_adminhtml_log_index>
 
28
  </layout>
app/etc/modules/ET_IpSecurity.xml CHANGED
@@ -1,11 +1,10 @@
1
  <?xml version="1.0"?>
2
- <!--
3
  /**
4
- * ET Web Solutions
5
- *
6
  * NOTICE OF LICENSE
7
  *
8
- * This source file is subject to the Academic Free License (AFL 3.0)
 
9
  *
10
  * DISCLAIMER
11
  *
@@ -14,17 +13,17 @@
14
  *
15
  * @category ET
16
  * @package ET_IpSecurity
17
- * @copyright Copyright (c) 2010 ET Web Solutions (http://etwebsolutions.com)
18
  * @contacts support@etwebsolutions.com
19
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
20
- */
21
  -->
22
 
23
  <config>
24
- <modules>
25
- <ET_IpSecurity>
26
- <active>true</active>
27
- <codePool>community</codePool>
28
- </ET_IpSecurity>
29
- </modules>
30
  </config>
1
  <?xml version="1.0"?>
2
+ <!--
3
  /**
 
 
4
  * NOTICE OF LICENSE
5
  *
6
+ * You may not sell, sub-license, rent or lease
7
+ * any portion of the Software or Documentation to anyone.
8
  *
9
  * DISCLAIMER
10
  *
13
  *
14
  * @category ET
15
  * @package ET_IpSecurity
16
+ * @copyright Copyright (c) 2012 ET Web Solutions (http://etwebsolutions.com)
17
  * @contacts support@etwebsolutions.com
18
+ * @license http://shop.etwebsolutions.com/etws-license-free-v1/ ETWS Free License (EFL1)
19
+ */
20
  -->
21
 
22
  <config>
23
+ <modules>
24
+ <ET_IpSecurity>
25
+ <active>true</active>
26
+ <codePool>community</codePool>
27
+ </ET_IpSecurity>
28
+ </modules>
29
  </config>
app/locale/en_US/ET_IpSecurity.csv CHANGED
@@ -1,33 +1,33 @@
1
- "Security Violence to Frontend","Security Violence to Frontend"
2
- "Security Violence to Admin","Security Violence to Admin"
3
- "IP Security - Frontend","IP Security - Frontend"
4
- "IP Security - Admin","IP Security - Admin"
5
- "Allow these IPs","Allow this IPs"
6
- "Visitors with other IPs will be blocked.","Visitors with other IPs will be blocked."
7
- "Block these IPs","Block this IPs"
8
- "Redirect to blank page","Redirect to blank page"
9
- "When blocking rule is applied visitor will be redirected to a blank page with blocking rule description.","When blocking rule applies then visitor will be redirected to a blank page with blocking rule description."
10
- "Redirect to CMS page","Redirect to CMS page"
11
- "Mail block events to","Mail block events to"
12
- "You can specify multiple recipients. Comma separated. For example: admin1@example.com, admin2@example.com","You can specify multiple recipients. Comma separated. For example: admin1@example.com, admin2@example.com"
13
- "Email Template","Email Template"
14
- "Store email","Store email"
15
- "Be careful not to lock yourself out!","Be careful not to lock yourself out!"
16
- "Visitor will not be notified about blocking rule redirection.","Visitor will not be notified about blocking rule redirection."
17
- "IP Security - Maintenance page","IP Security - Maintenance page"
18
- "Store Offline","Store Offline"
19
- "Except these IPs","Except these IPs"
20
- "Visitors with these IPs will not be redirected to maintenance page.","Visitors with these IPs will not be redirected to maintenance page."
21
- "Message","Message"
22
- "Reminder message","Reminder message"
23
- "This message will be shown on frontend for visitors with IP adresses from exception list while maintenance mode is on.","This message will be shown on frontend for visitors with IP adresses from exception list while maintenance mode is on."
24
- "For frontend only.","For frontend only."
25
- "Email always","Email always"
26
- "Yes - mail notification will be sent every time when blocking rule applies. No - mail notification will be sent when IP is blocked for first time or blocking times divides by 10.","Yes - mail notification will be sent every time when blocking rule applies. No - mail notification will be sent when IP is blocked for first time or blocking times divides by 10."
27
- "ET IP Security log","ET IP Security log"
28
- "ET IP Security log table","ET IP Security log table"
29
- "Blocked IP","Blocked IP"
30
- "Qty blocked","Qty blocked"
31
- "First block","First block"
32
- "Last block","Last block"
33
- "Blocked from","Blocked from"
1
+ "Security Violence to Frontend","Security Violence to Frontend"
2
+ "Security Violence to Admin","Security Violence to Admin"
3
+ "IP Security - Frontend","IP Security - Frontend"
4
+ "IP Security - Admin","IP Security - Admin"
5
+ "Allow these IPs","Allow this IPs"
6
+ "Visitors with other IPs will be blocked.","Visitors with other IPs will be blocked."
7
+ "Block these IPs","Block this IPs"
8
+ "Redirect to blank page","Redirect to blank page"
9
+ "When blocking rule is triggered visitor will be redirected to a blank page with blocking rule description.","When blocking rule applies then visitor will be redirected to a blank page with blocking rule description."
10
+ "Redirect to CMS page","Redirect to CMS page"
11
+ "Mail block events to","Mail block events to"
12
+ "You can specify multiple recipients. Comma separated. For example: admin1@example.com, admin2@example.com","You can specify multiple recipients. Comma separated. For example: admin1@example.com, admin2@example.com"
13
+ "Email Template","Email Template"
14
+ "Store email","Store email"
15
+ "Be careful not to lock yourself out!","Be careful not to lock yourself out!"
16
+ "Visitor will not be notified about blocking rule redirection.","Visitor will not be notified about blocking rule redirection."
17
+ "IP Security - Maintenance page","IP Security - Maintenance page"
18
+ "Store Offline","Store Offline"
19
+ "Except these IPs","Except these IPs"
20
+ "Visitors with these IPs will not be redirected to maintenance page.","Visitors with these IPs will not be redirected to maintenance page."
21
+ "Message","Message"
22
+ "Reminder message","Reminder message"
23
+ "This message will be shown on frontend for visitors with IP adresses from exception list while maintenance mode is on.","This message will be shown on frontend for visitors with IP adresses from exception list while maintenance mode is on."
24
+ "For frontend only.","For frontend only."
25
+ "Email always","Email always"
26
+ "Yes - mail notification will be sent every time when blocking rule applies. No - mail notification will be sent when IP is blocked for first time and each 10th time blocking occurs.","Yes - mail notification will be sent every time when blocking rule applies. No - mail notification will be sent when IP is blocked for first time and each 10th time blocking occurs."
27
+ "ET IP Security log","ET IP Security log"
28
+ "ET IP Security log table","ET IP Security log table"
29
+ "Blocked IP","Blocked IP"
30
+ "Qty blocked","Qty blocked"
31
+ "First block","First block"
32
+ "Last block","Last block"
33
+ "Blocked from","Blocked from"
app/locale/ru_RU/ET_IpSecurity.csv CHANGED
@@ -1,33 +1,47 @@
1
- "Security Violence to Frontend","Правило блокировки. Пользовательская часть"
2
- "Security Violence to Admin","Правило блокировки. Панель администрирования"
3
- "IP Security - Frontend","IP Security - Пользовательская часть"
4
- "IP Security - Admin","IP Security - Панель администрирования"
5
- "Allow these IPs","Разрешённые IP"
6
- "Visitors with other IPs will be blocked.","Посетители с другими IP адресами будут заблокированы."
7
- "Block these IPs","Заблокированные IP"
8
- "Redirect to blank page","Перенаправить на пустую страницу"
9
- "When blocking rule is applied visitor will be redirected to a blank page with blocking rule description.","При сработавшем правиле блокировки посетитель будет перенаправлен на пустую страницу с указанием причины блокировки."
10
- "Redirect to CMS page","Перенаправить на CMS страницу"
11
- "Mail block events to","Оповестить при блокировке"
12
- "You can specify multiple recipients. Comma separated. For example: admin1@example.com, admin2@example.com","Можно указывать несколько получателей. Разделитель запятая. Например: admin1@example.com,admin2@example.com"
13
- "Email Template","Email. Шаблон"
14
- "Store email","Email. Отправитель"
15
- "Be careful not to lock yourself out!","Будьте осторожны: не заблокируйте себя!"
16
- "Visitor will not be notified about blocking rule redirection.","Посетитель не будет предупреждён о срабатывании правила блокировки."
17
- "IP Security - Maintenance page","IP Security - Техническое обслуживание"
18
- "Store Offline","Технические работы"
19
- "Except these IPs","IP - исключения"
20
- "Visitors with these IPs will not be redirected to maintenance page.","Посетители с этими IP адресами не будут перенаправлены на страницу с сообщением о техническом обслуживании."
21
- "Message","Сообщение о тех. обслуживании"
22
- "Reminder message","Напоминание"
23
- "This message will be shown on frontend for visitors with IP adresses from exception list while maintenance mode is on.","Это сообщение будет показываться в пользовательской части для посетителей с IP адресами из списка исключений во время технического обслуживания."
24
- "For frontend only.","Только для пользовательской части."
25
- "Email always","Оповещать всегда"
26
- "Yes - mail notification will be sent every time when blocking rule applies. No - mail notification will be sent when IP is blocked for first time or blocking times divides by 10.","Да - оповещение будет отсылаться при каждой блокировке. Нет - оповещение будет отослано, если IP заблокирован первый раз или количество блокировок кратно 10."
27
- "ET IP Security log","ET IP Security журнал"
28
- "ET IP Security log table","ET IP Security журнал блокировок"
29
- "Blocked IP","Блокированный IP"
30
- "Qty blocked","Блокировано раз"
31
- "First block","Первая блокировка"
32
- "Last block","Последняя блокировка"
33
- "Blocked from","Заблокировано в"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "IP Security information","Информация о модуле IP Security"
2
+ "Security Violence to Frontend","Правило блокировки. Пользовательская часть"
3
+ "Security Violence to Admin","Правило блокировки. Панель администрирования"
4
+ "IP Security - Frontend","IP Security - Пользовательская часть"
5
+ "IP Security - Admin","IP Security - Панель администрирования"
6
+ "Allow these IPs","Разрешённые IP"
7
+ "Visitors with other IPs will be blocked.","Посетители с другими IP адресами будут заблокированы."
8
+ "Block these IPs","Заблокированные IP"
9
+ "Redirect to blank page","Перенаправить на пустую страницу"
10
+ "When blocking rule is triggered visitor will be redirected to a blank page with blocking rule description.","При сработавшем правиле блокировки посетитель будет перенаправлен на пустую страницу с указанием причины блокировки."
11
+ "Redirect to CMS page","Перенаправить на CMS страницу"
12
+ "Mail block events to","Оповестить при блокировке"
13
+ "You can specify multiple recipients. Comma separated. For example: admin1@example.com, admin2@example.com","Можно указывать несколько получателей. Разделитель запятая. Например: admin1@example.com,admin2@example.com"
14
+ "Email Template","Email. Шаблон"
15
+ "Store email","Email. Отправитель"
16
+ "Be careful not to lock yourself out!","Будьте осторожны: не заблокируйте себя!"
17
+ "Visitor will not be notified about blocking rule redirection.","Посетитель не будет предупреждён о срабатывании правила блокировки."
18
+ "IP Security - Maintenance page","IP Security - Техническое обслуживание"
19
+ "Store Offline","Технические работы"
20
+ "Except these IPs","IP - исключения"
21
+ "Visitors with these IPs will not be redirected to maintenance page.","Посетители с этими IP адресами не будут перенаправлены на страницу с сообщением о техническом обслуживании."
22
+ "Message","Сообщение о тех. обслуживании"
23
+ "Reminder message","Напоминание"
24
+ "This message will be shown on frontend for visitors with IP adresses from exception list while maintenance mode is on.","Это сообщение будет показываться в пользовательской части для посетителей с IP адресами из списка исключений во время технического обслуживания."
25
+ "For frontend only.","Только для пользовательской части."
26
+ "Email always","Оповещать всегда"
27
+ "Yes - mail notification will be sent every time when blocking rule applies. No - mail notification will be sent when IP is blocked for first time and each 10th time blocking occurs.","Да - оповещение будет отсылаться при каждой блокировке. Нет - оповещение будет отослано, если IP заблокирован первый раз или количество блокировок кратно 10."
28
+ "ET IP Security log","ET IP Security журнал"
29
+ "ET IP Security log table","ET IP Security журнал блокировок"
30
+ "Blocked IP","Блокированный IP"
31
+ "Qty blocked","Блокировано раз"
32
+ "First block","Первая блокировка"
33
+ "Last block","Последняя блокировка"
34
+ "Blocked from","Заблокировано в"
35
+ "Last block rule","Последнее сработашее правило"
36
+ "Not in allowed list","Нет в разрешённых"
37
+
38
+ "Extension:","Модуль:"
39
+ "<strong>%s</strong> (version %s)","<strong>%s</strong> (версия %s)"
40
+ "License:","Лицензия:"
41
+ "Short Description:","Краткое описание:"
42
+ "Documentation:","Документация:"
43
+ "Support:","Поддержка:"
44
+ "Advertisement:","Реклама:"
45
+ "You can see description of extension features and answers to the frequently asked questions on <a href=""%s"" target=""_balnk"">our website</a>.","Описание позможностей модуля и ответы на часто задаваемые вопросы смотрите на <a href=""%s"" target=""_balnk"">нашем сайте</a>."
46
+ "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>."
47
+ "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 connected 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."
package.xml CHANGED
@@ -1,21 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ET_IpSecurity</name>
4
- <version>1.5.3</version>
5
  <stability>stable</stability>
6
- <license uri="http://opensource.org/licenses/afl-3.0.php">AFL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Extension allows to restrict access to website for visitors by IP, IP mask or IP range. Also allows to turn off frontend during maintenance operations.</summary>
10
- <description>Extension allows to restrict access to website for visitors by IP, IP mask or IP range.
11
- When blocking rule is applied user is redirected to selected CMS page or blank page. Also extension can notify website owner about blocked visitor by email.
12
-
13
- Second function: Allows to turn off frontend during maintenance operations.</description>
14
  <notes>stable release</notes>
15
- <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>
16
- <date>2011-06-07</date>
17
- <time>05:39:17</time>
18
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="et_ipsecurity.xml" hash="3e677b0e6fffcfb90d1d03dd7bc8daa8"/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="template"><dir name="email"><file name="et_ipsecurity.html" hash="2b67f7f1bc21e003da6246fe76462af4"/><file name="et_ipsecurity_admin.html" hash="2b67f7f1bc21e003da6246fe76462af4"/></dir></dir><file name="ET_IpSecurity.csv" hash="26e22ba736a937422cfc1755670e71a8"/></dir><dir name="ru_RU"><dir name="template"><dir name="email"><file name="et_ipsecurity.html" hash="a6f731a6903375bfc06edc6a31d67865"/><file name="et_ipsecurity_admin.html" hash="5961f9ae7d71f843d96d70c18c223222"/></dir></dir><file name="ET_IpSecurity.csv" hash="7f1e9f9b92e96f45fc45b13d0ca4e5e6"/></dir></target><target name="magecommunity"><dir name="ET"><dir name="IpSecurity"><dir name="Block"><dir name="Adminhtml"><dir name="Log"><file name="Grid.php" hash="baef872daeaa6a195b4bab090244b16f"/></dir><file name="Log.php" hash="17f11639de5af08019be9577fd01e733"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="LogController.php" hash="cfc12c6a05fcb0486bb9f3b4c2eae4d0"/></dir></dir><dir name="etc"><file name="config.xml" hash="7899e48569aa5d629179c9b1f192b1a6"/><file name="system.xml" hash="462b9b4d2e802a63cdeaca5448b6bc47"/></dir><dir name="Helper"><file name="Data.php" hash="08c557cd26157c317c1049d5f1366eab"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Ipsecuritylog"><file name="Collection.php" hash="929fd786020e26b87f900caf0f2996f1"/></dir><file name="Ipsecuritylog.php" hash="4ec2037e5a52eaa4278ddd7ad2929dfc"/></dir><file name="Ipsecuritylog.php" hash="bb8a6ad3b612c46ef8b2fa36d2fac709"/><file name="Observer.php" hash="54243c67cd6b36e5b2fe9a5addaacfd7"/></dir><dir name="sql"><dir name="ipsecurity_setup"><file name="mysql4-install-1.5.php" hash="c2524c78dbb7db294d53983ca588c5bb"/></dir></dir></dir><file name="ET_IpSecurity_ChangeLog.txt" hash="78b7fbe5ad986b7c39a28e7b72ed9927"/><file name="ET_IpSecurity_Description.txt" hash="fc3b3f0f66c6cd3964c564212f809d0a"/><file name="ET_IpSecurity_LICENSE.txt" hash="b799504264c23c11a941473d7a3e3ab7"/></dir></target><target name="mageetc"><dir name="modules"><file name="ET_IpSecurity.xml" hash="d191fe14ed772c4515519e1445af2229"/></dir></target></contents>
19
  <compatible/>
20
- <dependencies/>
21
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>ET_IpSecurity</name>
4
+ <version>2.0.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>
8
  <extends/>
9
+ <summary>Extension gives you ability to restrict access to your website by IP address or to close your shop for maintenance.</summary>
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>niro</user><email>support@etwebsolutions.com</email></author><author><name>Andrej</name><user>zlojd</user><email>support@etwebsolutions.com</email></author></authors>
13
+ <date>2012-12-17</date>
14
+ <time>13:06:09</time>
15
+ <contents><target name="magecommunity"><dir name="ET"><dir name="IpSecurity"><dir name="Block"><dir name="Adminhtml"><dir name="Log"><file name="Grid.php" hash="2fb7a3f5f89954ed59c6fba4547d6633"/><dir name="Renderer"><file name="Translaterule.php" hash="ca65f7951033aa9012d28e2d57aef2a5"/></dir></dir><file name="Log.php" hash="71e986aa8d17ca38fbbebf293aaadb7c"/><file name="Support.php" hash="57cc4e0664b13b538d6a39037e5b4b0c"/></dir></dir><dir name="Helper"><file name="Data.php" hash="c8f5c392b7723725fe78ca9d4b7e20a0"/></dir><dir name="Model"><file name="Ipsecuritylog.php" hash="73e41e474f5bde2b994f097de68a2d3b"/><dir name="Mysql4"><dir name="Ipsecuritylog"><file name="Collection.php" hash="d052dd9e02c801d4343dcc847e48a7b2"/></dir><file name="Ipsecuritylog.php" hash="bbefc57c3bea478057e6038f6882843c"/></dir><file name="Observer.php" hash="822783ad398dfb95314f2533c95914ed"/></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="a7035def8a7c807bdd2b354a75d4324e"/><file name="system.xml" hash="1ba8b1ee4f1dde8b70d8618863bff7c4"/></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"><file name="ET_IpSecurity.csv" hash="bc1383ebfd0d3e3fe48dbc2b4b7860cf"/><dir name="template"><dir name="email"><file name="et_ipsecurity.html" hash="a6f731a6903375bfc06edc6a31d67865"/><file name="et_ipsecurity_admin.html" hash="5961f9ae7d71f843d96d70c18c223222"/></dir></dir></dir><dir name="en_US"><file name="ET_IpSecurity.csv" hash="7f9caec31be429a5851a67357eb44848"/><dir name="template"><dir name="email"><file name="et_ipsecurity.html" hash="2b67f7f1bc21e003da6246fe76462af4"/><file name="et_ipsecurity_admin.html" hash="2b67f7f1bc21e003da6246fe76462af4"/></dir></dir></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><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>