Version Notes
V1.2.0 // API authentication fix
Download this release
Release Info
Developer | Magento Core Team |
Extension | BotDefender_by_Lokad |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.2.0
app/code/community/Wyomind/Botdefender/Helper/Data.php
CHANGED
@@ -10,7 +10,7 @@ class Wyomind_Botdefender_Helper_Data extends Mage_Core_Helper_Data {
|
|
10 |
public $_BAD_REQUEST = "BAD REQUEST";
|
11 |
public $_CONNECTION_SUCCEEDED = "Installation complete.";
|
12 |
public $_BOTDEFENDER_API = "https://bdapi.lokad.com/rest/stub/";
|
13 |
-
|
14 |
public $_error = false;
|
15 |
|
16 |
function apiCall($productPriceId = false, $price = 0) {
|
@@ -31,8 +31,9 @@ class Wyomind_Botdefender_Helper_Data extends Mage_Core_Helper_Data {
|
|
31 |
$service_url = $this->_BOTDEFENDER_API;
|
32 |
if ($productPriceId)
|
33 |
$service_url .=$productPriceId . "/" . $price;
|
34 |
-
else
|
35 |
-
$
|
|
|
36 |
|
37 |
$curl = curl_init($service_url);
|
38 |
curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
|
@@ -78,7 +79,7 @@ class Wyomind_Botdefender_Helper_Data extends Mage_Core_Helper_Data {
|
|
78 |
}
|
79 |
}
|
80 |
|
81 |
-
public function getMessage($status) {
|
82 |
|
83 |
switch ($status) {
|
84 |
case "-5": return $this->_AUTHENTIFICATION_ERROR;
|
@@ -94,7 +95,10 @@ class Wyomind_Botdefender_Helper_Data extends Mage_Core_Helper_Data {
|
|
94 |
case "0": return $this->_BAD_REQUEST;
|
95 |
break;
|
96 |
default :
|
97 |
-
|
|
|
|
|
|
|
98 |
}
|
99 |
}
|
100 |
|
@@ -106,22 +110,25 @@ class Wyomind_Botdefender_Helper_Data extends Mage_Core_Helper_Data {
|
|
106 |
function getData($htmlOutput, $_id, $_storeId, $_price_id) {
|
107 |
if (Mage::getStoreConfig("botdefender/settings/enabled")) {
|
108 |
$_botDefenderId = $_id . "_" . $_storeId . "_" . $_price_id;
|
109 |
-
preg_match("/([0-9
|
110 |
$curl_response = $this->apiCall($_botDefenderId, $matches[0]);
|
111 |
$ips = array_filter(explode(",", Mage::getStoreConfig("botdefender/settings/ips")), array("Wyomind_Botdefender_Helper_Data", "cleanArray"));
|
112 |
-
|
113 |
//debug enabled and ips match
|
114 |
if (!count($ips) || in_array(Mage::helper('core/http')->getRemoteAddr(), $ips))
|
115 |
if (Mage::getStoreConfig("botdefender/settings/debug", $_storeId))
|
116 |
-
|
117 |
// if error return skip the api response
|
118 |
if ($this->_error) {
|
119 |
//log error
|
|
|
120 |
if (Mage::getStoreConfig("botdefender/settings/log"))
|
121 |
Mage::log("\n>>" . $this->_BOTDEFENDER_API . "\n*ID: " . $_botDefenderId . "\n*Price: " . $matches[0] . "\n*status: " . $curl_response . "\n*message: " . $this->getMessage($curl_response) . "\n\n", null, "BotDefender.log");
|
122 |
return $htmlOutput;
|
123 |
}
|
124 |
-
|
|
|
|
|
125 |
}
|
126 |
else
|
127 |
return $htmlOutput;
|
10 |
public $_BAD_REQUEST = "BAD REQUEST";
|
11 |
public $_CONNECTION_SUCCEEDED = "Installation complete.";
|
12 |
public $_BOTDEFENDER_API = "https://bdapi.lokad.com/rest/stub/";
|
13 |
+
public $_BOTDEFENDER_URL = "https://botdefender.lokad.com/";
|
14 |
public $_error = false;
|
15 |
|
16 |
function apiCall($productPriceId = false, $price = 0) {
|
31 |
$service_url = $this->_BOTDEFENDER_API;
|
32 |
if ($productPriceId)
|
33 |
$service_url .=$productPriceId . "/" . $price;
|
34 |
+
else {
|
35 |
+
$service_url .= "botdefendertest/0.00";
|
36 |
+
}
|
37 |
|
38 |
$curl = curl_init($service_url);
|
39 |
curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
|
79 |
}
|
80 |
}
|
81 |
|
82 |
+
public function getMessage($status, $testCnx = false) {
|
83 |
|
84 |
switch ($status) {
|
85 |
case "-5": return $this->_AUTHENTIFICATION_ERROR;
|
95 |
case "0": return $this->_BAD_REQUEST;
|
96 |
break;
|
97 |
default :
|
98 |
+
if (!$testCnx)
|
99 |
+
return $status;
|
100 |
+
else
|
101 |
+
return $this->_CONNECTION_SUCCEEDED;
|
102 |
}
|
103 |
}
|
104 |
|
110 |
function getData($htmlOutput, $_id, $_storeId, $_price_id) {
|
111 |
if (Mage::getStoreConfig("botdefender/settings/enabled")) {
|
112 |
$_botDefenderId = $_id . "_" . $_storeId . "_" . $_price_id;
|
113 |
+
preg_match("/([0-9]|\.|\,){1,16}/", $htmlOutput, $matches);
|
114 |
$curl_response = $this->apiCall($_botDefenderId, $matches[0]);
|
115 |
$ips = array_filter(explode(",", Mage::getStoreConfig("botdefender/settings/ips")), array("Wyomind_Botdefender_Helper_Data", "cleanArray"));
|
116 |
+
$debug=null;
|
117 |
//debug enabled and ips match
|
118 |
if (!count($ips) || in_array(Mage::helper('core/http')->getRemoteAddr(), $ips))
|
119 |
if (Mage::getStoreConfig("botdefender/settings/debug", $_storeId))
|
120 |
+
$debug= "<div style='border:1px dotted red; color:red;padding:10px;'><b>BotDefender</b> <br>" . $this->_BOTDEFENDER_API . "" . $_botDefenderId . "/" . $matches[0] . " <br> Response : " . $this->getMessage($curl_response) . "</div>";
|
121 |
// if error return skip the api response
|
122 |
if ($this->_error) {
|
123 |
//log error
|
124 |
+
|
125 |
if (Mage::getStoreConfig("botdefender/settings/log"))
|
126 |
Mage::log("\n>>" . $this->_BOTDEFENDER_API . "\n*ID: " . $_botDefenderId . "\n*Price: " . $matches[0] . "\n*status: " . $curl_response . "\n*message: " . $this->getMessage($curl_response) . "\n\n", null, "BotDefender.log");
|
127 |
return $htmlOutput;
|
128 |
}
|
129 |
+
|
130 |
+
return $debug.str_replace($matches[0], $curl_response, $htmlOutput);
|
131 |
+
|
132 |
}
|
133 |
else
|
134 |
return $htmlOutput;
|
app/code/community/Wyomind/Botdefender/etc/config.xml
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
<config>
|
4 |
<modules>
|
5 |
<Wyomind_Botdefender>
|
6 |
-
<version>1.
|
7 |
</Wyomind_Botdefender>
|
8 |
</modules>
|
9 |
<default>
|
3 |
<config>
|
4 |
<modules>
|
5 |
<Wyomind_Botdefender>
|
6 |
+
<version>1.2.0</version>
|
7 |
</Wyomind_Botdefender>
|
8 |
</modules>
|
9 |
<default>
|
lib/Varien/Data/Form/Element/Botdefender.php
CHANGED
@@ -20,7 +20,7 @@ class Varien_Data_Form_Element_Botdefender extends Varien_Data_Form_Element_Abst
|
|
20 |
|
21 |
|
22 |
$apiCall = Mage::helper("botdefender")->apiCall();
|
23 |
-
$message = Mage::helper('botdefender')->getMessage($apiCall);
|
24 |
|
25 |
|
26 |
$html .= '<a id="' . $this->getHtmlId() . '" href="' . Mage::helper("botdefender")->_BOTDEFENDER_URL . '" target="_blank">' . $message . "</a>\n";
|
20 |
|
21 |
|
22 |
$apiCall = Mage::helper("botdefender")->apiCall();
|
23 |
+
$message = Mage::helper('botdefender')->getMessage($apiCall,true);
|
24 |
|
25 |
|
26 |
$html .= '<a id="' . $this->getHtmlId() . '" href="' . Mage::helper("botdefender")->_BOTDEFENDER_URL . '" target="_blank">' . $message . "</a>\n";
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>BotDefender_by_Lokad</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.wyomind.com/terms-and-conditions.html">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -11,11 +11,11 @@ Stop being outpriced every time you make a move. Best suited for retailers.</sum
|
|
11 |
<description><h2 class="thin">Stop competitors from getting your prices</h2>
|
12 |
<span style="font-size:140%">stop being outpriced</span> customer acquisition costs are higher than ever. Why should you lose a costly customer acquisition just because your competitor always aligns itself $1 below your price?<br><br><span style="font-size:140%">stop price wars</span> if your competitors react in near real-time to your prices, then anytime you lower a price, they will lower their price as well. Let competitors pick other opponents to run their price wars.<br><br><span style="font-size:140%">drive competition crazy</span> reverse-engineering BotDefender takes 1000 more time than setting it up. Keep competition distracted for months, while you make decisive moves on your core business.<br><br><span style="font-size:140%">it's free, no catch</span> the Express Plan is free and does not expire. No hidden costs or catch involved. We have a paid plan with extra features but the Express Plan is fully functional.<br><br><h2 class="thin">Obfuscation (Enterprise Plan)</h2>
|
13 |
Obfuscation is a more advanced protection method only made available in the Enterprise Plan. The snippet returned by BotDefender is an intricate price of HTML and JavaScript designed to be very hard to decipher, no matter if it's the raw HTML or the DOM (Domain Object Model) that are analyzed.<br><br>Advantages of obfuscation over tar pitting are:<br><br><ul><li><b>Zero overhead</b> caused by an extra HTTP request to be made by the end-user. The snippet is self-contained and does not require any external resources to be rendered as the price.</li><li><b>Zero liability</b> as the snippet is self-contained; it does not matter whether the BotDefender servers are up or down: the mechanism keeps working without any dependency on BotDefender.</li><li><b>Zero leakage</b> when obfuscation is used Lokad <i>cannot</i> collect any information about your web traffic. As far data leakage is concerned, it can't be made more secure than that.<br></li></ul><br>Lokad recommends obfuscation for high-traffic websites.</description>
|
14 |
-
<notes>V1.
|
15 |
<authors><author><name>Wyomind</name><user>auto-converted</user><email>contact@wyomind.com</email></author></authors>
|
16 |
-
<date>2013-11-
|
17 |
-
<time>
|
18 |
-
<contents><target name="magecommunity"><dir name="Wyomind"><dir name="Botdefender"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="1e70daf7287709d6c33cec793a561d8b"/></dir></dir><dir name="Helper"><file name="Data.php" hash="
|
19 |
<compatible/>
|
20 |
<dependencies/>
|
21 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>BotDefender_by_Lokad</name>
|
4 |
+
<version>1.2.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.wyomind.com/terms-and-conditions.html">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
11 |
<description><h2 class="thin">Stop competitors from getting your prices</h2>
|
12 |
<span style="font-size:140%">stop being outpriced</span> customer acquisition costs are higher than ever. Why should you lose a costly customer acquisition just because your competitor always aligns itself $1 below your price?<br><br><span style="font-size:140%">stop price wars</span> if your competitors react in near real-time to your prices, then anytime you lower a price, they will lower their price as well. Let competitors pick other opponents to run their price wars.<br><br><span style="font-size:140%">drive competition crazy</span> reverse-engineering BotDefender takes 1000 more time than setting it up. Keep competition distracted for months, while you make decisive moves on your core business.<br><br><span style="font-size:140%">it's free, no catch</span> the Express Plan is free and does not expire. No hidden costs or catch involved. We have a paid plan with extra features but the Express Plan is fully functional.<br><br><h2 class="thin">Obfuscation (Enterprise Plan)</h2>
|
13 |
Obfuscation is a more advanced protection method only made available in the Enterprise Plan. The snippet returned by BotDefender is an intricate price of HTML and JavaScript designed to be very hard to decipher, no matter if it's the raw HTML or the DOM (Domain Object Model) that are analyzed.<br><br>Advantages of obfuscation over tar pitting are:<br><br><ul><li><b>Zero overhead</b> caused by an extra HTTP request to be made by the end-user. The snippet is self-contained and does not require any external resources to be rendered as the price.</li><li><b>Zero liability</b> as the snippet is self-contained; it does not matter whether the BotDefender servers are up or down: the mechanism keeps working without any dependency on BotDefender.</li><li><b>Zero leakage</b> when obfuscation is used Lokad <i>cannot</i> collect any information about your web traffic. As far data leakage is concerned, it can't be made more secure than that.<br></li></ul><br>Lokad recommends obfuscation for high-traffic websites.</description>
|
14 |
+
<notes>V1.2.0 // API authentication fix</notes>
|
15 |
<authors><author><name>Wyomind</name><user>auto-converted</user><email>contact@wyomind.com</email></author></authors>
|
16 |
+
<date>2013-11-20</date>
|
17 |
+
<time>13:02:34</time>
|
18 |
+
<contents><target name="magecommunity"><dir name="Wyomind"><dir name="Botdefender"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="1e70daf7287709d6c33cec793a561d8b"/></dir></dir><dir name="Helper"><file name="Data.php" hash="e46311866ae2b12131dc933e4f394e46"/></dir><dir name="Model"><dir name="Resource"><file name="Setup.php" hash="31e494bb0f0d0e6c56ab1df0a5930efb"/></dir><file name="Observer.php" hash="3ecd42c88e337b0861c614b5201dc3ae"/></dir><dir name="Varien"><dir name="Data"><dir name="Form"><dir name="Element"><file name="Installation.php" hash="9cb39374d4788934f028c23c8be38f92"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="15478a2b20d74116036b1dc1d128bedd"/><file name="system.xml" hash="ab0166b8f6d1e8f25c7601ddc2091eb5"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wyomind_Botdefender.xml" hash="6961224077915480f64d4c30c6a1e3fa"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="botdefender.xml" hash="e75f14ad7cb6a185f472831cf40a17be"/></dir><dir name="template"><dir name="botdefender"><dir name="bundle"><dir name="catalog"><dir name="product"><dir name="view"><file name="price.phtml" hash="bf7e73a0038d1aadbf31da8820523ce9"/></dir><file name="price.phtml" hash="893eed0a24df8c168b83250447e5ed83"/></dir></dir></dir><dir name="catalog"><dir name="product"><file name="price.phtml" hash="99ad8fa9ddbdbedfb2626ab33abe69b9"/></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="botdefender.xml" hash="db56f289d4ba772caaff40d4968c1edf"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="lib"><dir name="Varien"><dir name="Data"><dir name="Form"><dir name="Element"><file name="Botdefender.php" hash="03bf9c9f7bfddded751dbdb024bf384c"/></dir></dir></dir></dir></dir></target></contents>
|
19 |
<compatible/>
|
20 |
<dependencies/>
|
21 |
</package>
|