Version Notes
stable release
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | ET_IpSecurity |
| Version | 2.0.1 |
| Comparing to | |
| See all releases | |
Code changes from version 2.0.0 to 2.0.1
app/code/community/ET/IpSecurity/Block/Adminhtml/Support.php
CHANGED
|
@@ -23,7 +23,7 @@ class ET_IpSecurity_Block_Adminhtml_Support
|
|
| 23 |
{
|
| 24 |
/**
|
| 25 |
* Support tab
|
| 26 |
-
* version
|
| 27 |
*/
|
| 28 |
public function render(Varien_Data_Form_Element_Abstract $element)
|
| 29 |
{
|
|
@@ -35,15 +35,24 @@ class ET_IpSecurity_Block_Adminhtml_Support
|
|
| 35 |
$moduleShortDescription = $this->_getConfigValue($moduleNameId, 'descr');
|
| 36 |
$moduleLicense = $this->_getConfigValue($moduleNameId, 'license');
|
| 37 |
|
| 38 |
-
$linkParameters = '
|
| 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; }
|
|
@@ -54,46 +63,46 @@ class ET_IpSecurity_Block_Adminhtml_Support
|
|
| 54 |
<tr>
|
| 55 |
<td class="developer-label">' . $helper->__('Extension:') . '</td>
|
| 56 |
<td class="developer-text">' . $helper->__(
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
</tr>
|
| 62 |
<tr>
|
| 63 |
<td class="developer-label">' . $helper->__('License:') . '</td>
|
| 64 |
<td class="developer-text">' . $helper->__(
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
</tr>
|
| 70 |
<tr>
|
| 71 |
<td class="developer-label">' . $helper->__('Short Description:') . '</td>
|
| 72 |
-
<td class="developer-text">'
|
| 73 |
</tr>
|
| 74 |
<tr>
|
| 75 |
<td class="developer-label">' . $helper->__('Documentation:') . '</td>
|
| 76 |
<td class="developer-text">' . $helper->__(
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
</tr>
|
| 81 |
<tr>
|
| 82 |
<td class="developer-label line">' . $helper->__('Support:') . '</td>
|
| 83 |
<td class="developer-text line">' . $helper->__(
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
</tr>
|
| 91 |
<tr>
|
| 92 |
-
<td class="developer-label line"
|
| 93 |
<td class="developer-text line">' . $helper->__(
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
</tr>
|
| 98 |
</table>';
|
| 99 |
|
|
@@ -119,4 +128,61 @@ class ET_IpSecurity_Block_Adminhtml_Support
|
|
| 119 |
}
|
| 120 |
}
|
| 121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
}
|
| 23 |
{
|
| 24 |
/**
|
| 25 |
* Support tab
|
| 26 |
+
* version 2.0.0
|
| 27 |
*/
|
| 28 |
public function render(Varien_Data_Form_Element_Abstract $element)
|
| 29 |
{
|
| 35 |
$moduleShortDescription = $this->_getConfigValue($moduleNameId, 'descr');
|
| 36 |
$moduleLicense = $this->_getConfigValue($moduleNameId, 'license');
|
| 37 |
|
| 38 |
+
$linkParameters = '';
|
| 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 |
+
$magentoVersion = Mage::getVersion();
|
| 45 |
+
$magentoPlatform = $this->_getPlatform();
|
| 46 |
+
$logoLink = 'https://shop.etwebsolutions.com/logotypes/' .
|
| 47 |
+
$magentoPlatform . '/' .
|
| 48 |
+
$magentoVersion . '/' .
|
| 49 |
+
$moduleNameId . '/' .
|
| 50 |
+
$moduleVersion . '/' .
|
| 51 |
+
'logo.png';
|
| 52 |
+
|
| 53 |
$html =
|
| 54 |
'<style>
|
| 55 |
+
.line {border-top: 1px solid #c6c6c6; padding-top: 10px;}
|
| 56 |
.developer-label {color: #000000; font-weight:bold; width: 150px;}
|
| 57 |
.developer-text { padding-bottom: 15px;}
|
| 58 |
.developer {width: 600px; }
|
| 63 |
<tr>
|
| 64 |
<td class="developer-label">' . $helper->__('Extension:') . '</td>
|
| 65 |
<td class="developer-text">' . $helper->__(
|
| 66 |
+
'<strong>%s</strong> (version %s)',
|
| 67 |
+
$moduleName,
|
| 68 |
+
$moduleVersion
|
| 69 |
+
) . '</td>
|
| 70 |
</tr>
|
| 71 |
<tr>
|
| 72 |
<td class="developer-label">' . $helper->__('License:') . '</td>
|
| 73 |
<td class="developer-text">' . $helper->__(
|
| 74 |
+
'<a href="%s" target="_blank">%s</a>',
|
| 75 |
+
$moduleLicenseLink,
|
| 76 |
+
$moduleLicense
|
| 77 |
+
) . '</td>
|
| 78 |
</tr>
|
| 79 |
<tr>
|
| 80 |
<td class="developer-label">' . $helper->__('Short Description:') . '</td>
|
| 81 |
+
<td class="developer-text">' . $moduleShortDescription . '</td>
|
| 82 |
</tr>
|
| 83 |
<tr>
|
| 84 |
<td class="developer-label">' . $helper->__('Documentation:') . '</td>
|
| 85 |
<td class="developer-text">' . $helper->__(
|
| 86 |
+
'You can see description of extension features and answers to the ' .
|
| 87 |
+
'frequently asked questions on <a href="%s" target="_blank">our website</a>.',
|
| 88 |
+
$moduleLink) . '</td>
|
| 89 |
</tr>
|
| 90 |
<tr>
|
| 91 |
<td class="developer-label line">' . $helper->__('Support:') . '</td>
|
| 92 |
<td class="developer-text line">' . $helper->__(
|
| 93 |
+
'Extension support is available through <a href="%s" target="_blank">issue tracking system' .
|
| 94 |
+
'</a>.<br>You can see information freely, but you will have to sign up to open a ticket.<br>' .
|
| 95 |
+
'<br>Please, report all bugs and feature requests that are related to this extension.<br>' .
|
| 96 |
+
'<br>If by some reason you can not submit a question, bug report or feature request to our ' .
|
| 97 |
+
'ticket system, you can write us an email - support@etwebsolutions.com.',
|
| 98 |
+
$moduleSupportLink) . '</td>
|
| 99 |
</tr>
|
| 100 |
<tr>
|
| 101 |
+
<td class="developer-label line"><img src="' . $logoLink . '" width="100px" height="34px"> </td>
|
| 102 |
<td class="developer-text line">' . $helper->__(
|
| 103 |
+
'You can hire our team to customize the extension. E-mail us on sales@etwebsolutions.com.<br>' .
|
| 104 |
+
'<br>You can see a list of provided services on <a href="%s" target="_blank">our website</a>.',
|
| 105 |
+
$servicesLink) . '</td>
|
| 106 |
</tr>
|
| 107 |
</table>';
|
| 108 |
|
| 128 |
}
|
| 129 |
}
|
| 130 |
|
| 131 |
+
const PLATFORM_CE = 'ce';
|
| 132 |
+
const PLATFORM_PE = 'pe';
|
| 133 |
+
const PLATFORM_EE = 'ee';
|
| 134 |
+
const PLATFORM_GO = 'go';
|
| 135 |
+
const PLATFORM_UNKNOWN = 'unknown';
|
| 136 |
+
|
| 137 |
+
protected static $_platformCode = self::PLATFORM_UNKNOWN;
|
| 138 |
+
|
| 139 |
+
/**
|
| 140 |
+
* Get edition code
|
| 141 |
+
* @return string
|
| 142 |
+
*/
|
| 143 |
+
protected function _getPlatform()
|
| 144 |
+
{
|
| 145 |
+
if (self::$_platformCode == self::PLATFORM_UNKNOWN) {
|
| 146 |
+
// from Magento CE version 1.7. we can get platform from Mage class
|
| 147 |
+
if (property_exists('Mage', '_currentEdition')) {
|
| 148 |
+
switch (Mage::getEdition()) {
|
| 149 |
+
case Mage::EDITION_COMMUNITY:
|
| 150 |
+
self::$_platformCode = self::PLATFORM_CE;
|
| 151 |
+
break;
|
| 152 |
+
case Mage::EDITION_PROFESSIONAL:
|
| 153 |
+
self::$_platformCode = self::PLATFORM_PE;
|
| 154 |
+
break;
|
| 155 |
+
case Mage::EDITION_ENTERPRISE:
|
| 156 |
+
self::$_platformCode = self::PLATFORM_EE;
|
| 157 |
+
break;
|
| 158 |
+
case Mage::EDITION_ENTERPRISE:
|
| 159 |
+
self::$_platformCode = self::PLATFORM_EE;
|
| 160 |
+
break;
|
| 161 |
+
default:
|
| 162 |
+
self::$_platformCode = self::PLATFORM_UNKNOWN;
|
| 163 |
+
}
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
// if platform still unknown
|
| 167 |
+
if (self::$_platformCode == self::PLATFORM_UNKNOWN) {
|
| 168 |
+
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
|
| 169 |
+
$isEnterprise = array_key_exists('Enterprise_Enterprise', $modulesArray);
|
| 170 |
+
|
| 171 |
+
$isProfessional = false; // TODO: how determine?
|
| 172 |
+
$isGo = false; // TODO: how?
|
| 173 |
+
|
| 174 |
+
if ($isEnterprise) {
|
| 175 |
+
self::$_platformCode = self::PLATFORM_EE;
|
| 176 |
+
} elseif ($isProfessional) {
|
| 177 |
+
self::$_platformCode = self::PLATFORM_PE;
|
| 178 |
+
} elseif ($isGo) {
|
| 179 |
+
self::$_platformCode = self::PLATFORM_GO;
|
| 180 |
+
} else {
|
| 181 |
+
self::$_platformCode = self::PLATFORM_CE;
|
| 182 |
+
}
|
| 183 |
+
}
|
| 184 |
+
}
|
| 185 |
+
return self::$_platformCode;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
}
|
app/code/community/ET/IpSecurity/Model/Observer.php
CHANGED
|
@@ -234,7 +234,7 @@ class ET_IpSecurity_Model_Observer
|
|
| 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) {
|
|
@@ -289,7 +289,7 @@ class ET_IpSecurity_Model_Observer
|
|
| 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) {
|
|
@@ -552,14 +552,14 @@ class ET_IpSecurity_Model_Observer
|
|
| 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());
|
| 234 |
exit("Access denied for IP:<b> " . $currentIp . "</b>");
|
| 235 |
}
|
| 236 |
|
| 237 |
+
if ($this->trimTrailingSlashes($currentPage) != $this->trimTrailingSlashes($this->_redirectPage) && !$allow) {
|
| 238 |
header('Location: ' . $this->_redirectPage);
|
| 239 |
$needToNotify = $this->saveToLog(array('blocked_from' => $scope, 'blocked_ip' => $currentIp));
|
| 240 |
if (($this->_alwaysNotify) || $needToNotify) {
|
| 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) {
|
| 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());
|
app/code/community/ET/IpSecurity/etc/config.xml
CHANGED
|
@@ -23,7 +23,7 @@
|
|
| 23 |
<modules>
|
| 24 |
<ET_IpSecurity>
|
| 25 |
<name>ET Ip Security</name>
|
| 26 |
-
<version>2.0.
|
| 27 |
<descr>
|
| 28 |
<ru_RU><