Version Notes
V2.0.0
Download this release
Release Info
Developer | Wyomind |
Extension | BotDefender_by_Lokad |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.1 to 2.0.0
app/code/community/Wyomind/Botdefender/Helper/Data.php
CHANGED
@@ -21,7 +21,7 @@ class Wyomind_Botdefender_Helper_Data extends Mage_Core_Helper_Data {
|
|
21 |
return -4;
|
22 |
}
|
23 |
$username = trim(Mage::getStoreConfig("botdefender/settings/lokad_user"));
|
24 |
-
$password = trim(Mage::getStoreConfig("botdefender/settings/
|
25 |
// NO CREDENTIALS
|
26 |
|
27 |
if ($username == null || $password == null) {
|
@@ -32,7 +32,7 @@ class Wyomind_Botdefender_Helper_Data extends Mage_Core_Helper_Data {
|
|
32 |
if ($productPriceId)
|
33 |
$service_url .=$productPriceId . "/" . $price;
|
34 |
else {
|
35 |
-
$service_url .= "botdefendertest/
|
36 |
}
|
37 |
|
38 |
$curl = curl_init($service_url);
|
@@ -42,7 +42,7 @@ class Wyomind_Botdefender_Helper_Data extends Mage_Core_Helper_Data {
|
|
42 |
$info = curl_getinfo($curl);
|
43 |
|
44 |
//print_r($info);
|
45 |
-
//
|
46 |
|
47 |
|
48 |
if ($curl_response === false) {
|
@@ -111,27 +111,62 @@ class Wyomind_Botdefender_Helper_Data extends Mage_Core_Helper_Data {
|
|
111 |
if (Mage::getStoreConfig("botdefender/settings/enabled")) {
|
112 |
$_botDefenderId = $_id . "_" . $_storeId . "_" . $_price_id;
|
113 |
preg_match("/([0-9]|\.|\,){1,16}/", $htmlOutput, $matches);
|
114 |
-
|
115 |
-
$
|
116 |
-
$
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
|
|
134 |
return $htmlOutput;
|
135 |
}
|
136 |
|
137 |
-
}
|
21 |
return -4;
|
22 |
}
|
23 |
$username = trim(Mage::getStoreConfig("botdefender/settings/lokad_user"));
|
24 |
+
$password = trim(Mage::getStoreConfig("botdefender/settings/lokad_password__"));
|
25 |
// NO CREDENTIALS
|
26 |
|
27 |
if ($username == null || $password == null) {
|
32 |
if ($productPriceId)
|
33 |
$service_url .=$productPriceId . "/" . $price;
|
34 |
else {
|
35 |
+
$service_url .= "botdefendertest/1.00";
|
36 |
}
|
37 |
|
38 |
$curl = curl_init($service_url);
|
42 |
$info = curl_getinfo($curl);
|
43 |
|
44 |
//print_r($info);
|
45 |
+
//print_r($curl_response);
|
46 |
|
47 |
|
48 |
if ($curl_response === false) {
|
111 |
if (Mage::getStoreConfig("botdefender/settings/enabled")) {
|
112 |
$_botDefenderId = $_id . "_" . $_storeId . "_" . $_price_id;
|
113 |
preg_match("/([0-9]|\.|\,){1,16}/", $htmlOutput, $matches);
|
114 |
+
|
115 |
+
$cacheGroup = 'botdefender';
|
116 |
+
$useCache = Mage::app()->useCache($cacheGroup);
|
117 |
+
|
118 |
+
|
119 |
+
$debug = "<div style='border:1px dotted red; color:red;padding:10px;'><b>BotDefender</b><br>";
|
120 |
+
|
121 |
+
$cache = Mage::app()->getCache();
|
122 |
+
$data = $cache->load($_botDefenderId);
|
123 |
+
if ($useCache)
|
124 |
+
$debug .= "Cache is active.<br>";
|
125 |
+
else
|
126 |
+
$debug .= "Cache is not active.<br>";
|
127 |
+
|
128 |
+
// If cache exists
|
129 |
+
if ($data !== false && $useCache) {
|
130 |
+
|
131 |
+
$debug .= "Cache exists.<br>";
|
132 |
+
$data = str_replace($matches[0], $data, $htmlOutput);
|
133 |
+
// If cache doesn't exixst or is out of date
|
134 |
+
} elseif ($data === false) {
|
135 |
+
|
136 |
+
if ($useCache)
|
137 |
+
$debug .= "Cache doesn't exists.<br>";
|
138 |
+
$curl_response = $this->apiCall($_botDefenderId, $matches[0]);
|
139 |
+
$ips = array_filter(explode(",", Mage::getStoreConfig("botdefender/settings/ips")), array("Wyomind_Botdefender_Helper_Data", "cleanArray"));
|
140 |
+
|
141 |
+
//debug enabled and ips match
|
142 |
+
if (!count($ips) || in_array(Mage::helper('core/http')->getRemoteAddr(), $ips))
|
143 |
+
$debug .= $this->_BOTDEFENDER_API . "" . $_botDefenderId . "/" . $matches[0] . " <br> Response : " . $this->getMessage($curl_response);
|
144 |
+
// if error return skip the api response& disable pulugin
|
145 |
+
if ($this->_error) {
|
146 |
+
// DISABLE THE MODULE
|
147 |
+
Mage::getConfig()->saveConfig("botdefender/settings/enabled", false, "default", 0);
|
148 |
+
Mage::getConfig()->cleanCache();
|
149 |
+
//log error
|
150 |
+
$debug .= "Default data are used.";
|
151 |
+
if (Mage::getStoreConfig("botdefender/settings/log"))
|
152 |
+
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");
|
153 |
+
$data = $htmlOutput;
|
154 |
+
} else {
|
155 |
+
$data = str_replace($matches[0], $curl_response, $htmlOutput);
|
156 |
+
}
|
157 |
+
|
158 |
+
if ($useCache) {
|
159 |
+
$debug .= "Cache has been created";
|
160 |
+
$cache->save($curl_response, $_botDefenderId, array('BOTDEFENDER'), Mage::getStoreConfig("botdefender/settings/cachelifetime") * 24 * 60 * 60);
|
161 |
+
}
|
162 |
}
|
163 |
+
|
164 |
+
$debug .= "<div>";
|
165 |
+
if (Mage::getStoreConfig("botdefender/settings/debug", $_storeId))
|
166 |
+
return $debug . $data;
|
167 |
+
return $data;
|
168 |
+
} else
|
169 |
return $htmlOutput;
|
170 |
}
|
171 |
|
172 |
+
}
|
app/code/community/Wyomind/Botdefender/etc/config.xml
CHANGED
@@ -11,6 +11,7 @@
|
|
11 |
<settings>
|
12 |
<enabled>1</enabled>
|
13 |
<debug>0</debug>
|
|
|
14 |
</settings>
|
15 |
</botdefender>
|
16 |
|
@@ -57,11 +58,20 @@
|
|
57 |
</acl>
|
58 |
</adminhtml>
|
59 |
<global>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
<events>
|
61 |
<admin_user_authenticate_after>
|
62 |
<observers>
|
63 |
<wyomind_botdefender_observer>
|
64 |
-
|
65 |
<class>Wyomind_Botdefender_Model_Observer</class>
|
66 |
<method>observe</method>
|
67 |
</wyomind_botdefender_observer>
|
11 |
<settings>
|
12 |
<enabled>1</enabled>
|
13 |
<debug>0</debug>
|
14 |
+
<cachelifetime>7</cachelifetime>
|
15 |
</settings>
|
16 |
</botdefender>
|
17 |
|
58 |
</acl>
|
59 |
</adminhtml>
|
60 |
<global>
|
61 |
+
<cache>
|
62 |
+
<types>
|
63 |
+
<botdefender module="botdefender" translate="BotDefender">
|
64 |
+
<label>BotDefender</label>
|
65 |
+
<description>BotDefender JS code snippets.</description>
|
66 |
+
<tags>botdefender</tags>
|
67 |
+
</botdefender>
|
68 |
+
</types>
|
69 |
+
</cache>
|
70 |
<events>
|
71 |
<admin_user_authenticate_after>
|
72 |
<observers>
|
73 |
<wyomind_botdefender_observer>
|
74 |
+
<type>singleton</type>
|
75 |
<class>Wyomind_Botdefender_Model_Observer</class>
|
76 |
<method>observe</method>
|
77 |
</wyomind_botdefender_observer>
|
app/code/community/Wyomind/Botdefender/etc/system.xml
CHANGED
@@ -47,8 +47,8 @@
|
|
47 |
|
48 |
</comment>
|
49 |
<show_in_default>1</show_in_default>
|
50 |
-
<show_in_website>
|
51 |
-
<show_in_store>
|
52 |
</enabled>
|
53 |
<lokad_user translate="label comment">
|
54 |
<label>BotDefender username</label>
|
@@ -72,17 +72,29 @@
|
|
72 |
<show_in_website>0</show_in_website>
|
73 |
<show_in_store>0</show_in_store>
|
74 |
</lokad_password>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
<debug translate="label comment">
|
76 |
<label>Debug mode enabled</label>
|
77 |
<frontend_type>select</frontend_type>
|
78 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
79 |
-
<sort_order>
|
80 |
<comment>
|
81 |
<![CDATA[<span class="notice" style="color:red;">Do not use in production</span>]]>
|
82 |
</comment>
|
83 |
<show_in_default>1</show_in_default>
|
84 |
-
<show_in_website>
|
85 |
-
<show_in_store>
|
86 |
</debug>
|
87 |
<ips translate="label comment">
|
88 |
<label>Allowed IPs (comma separated)</label>
|
@@ -90,25 +102,25 @@
|
|
90 |
<depends>
|
91 |
<debug>1</debug>
|
92 |
</depends>
|
93 |
-
<sort_order>
|
94 |
<comment>
|
95 |
<![CDATA[<span class="notice" style="color:red;">Leave empty for access from any location</span>]]>
|
96 |
</comment>
|
97 |
<show_in_default>1</show_in_default>
|
98 |
-
<show_in_website>
|
99 |
-
<show_in_store>
|
100 |
</ips>
|
101 |
<log translate="label comment">
|
102 |
<label>Enable log file</label>
|
103 |
<frontend_type>select</frontend_type>
|
104 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
105 |
-
<sort_order>
|
106 |
<comment>
|
107 |
<![CDATA[<span class="notice" style="color:red;">Log file available under var/log/BotDefender.log if general log settings are enabled</span>]]>
|
108 |
</comment>
|
109 |
<show_in_default>1</show_in_default>
|
110 |
-
<show_in_website>
|
111 |
-
<show_in_store>
|
112 |
</log>
|
113 |
|
114 |
|
47 |
|
48 |
</comment>
|
49 |
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>0</show_in_website>
|
51 |
+
<show_in_store>0</show_in_store>
|
52 |
</enabled>
|
53 |
<lokad_user translate="label comment">
|
54 |
<label>BotDefender username</label>
|
72 |
<show_in_website>0</show_in_website>
|
73 |
<show_in_store>0</show_in_store>
|
74 |
</lokad_password>
|
75 |
+
|
76 |
+
<cachelifetime translate="label comment">
|
77 |
+
<label>Cache lifetime</label>
|
78 |
+
<frontend_type>text</frontend_type>
|
79 |
+
<sort_order>4</sort_order>
|
80 |
+
<comment>
|
81 |
+
<![CDATA[<span class="notice">Cache lifetime in days</span>]]>
|
82 |
+
</comment>
|
83 |
+
<show_in_default>1</show_in_default>
|
84 |
+
<show_in_website>1</show_in_website>
|
85 |
+
<show_in_store>1</show_in_store>
|
86 |
+
</cachelifetime>
|
87 |
<debug translate="label comment">
|
88 |
<label>Debug mode enabled</label>
|
89 |
<frontend_type>select</frontend_type>
|
90 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
91 |
+
<sort_order>5</sort_order>
|
92 |
<comment>
|
93 |
<![CDATA[<span class="notice" style="color:red;">Do not use in production</span>]]>
|
94 |
</comment>
|
95 |
<show_in_default>1</show_in_default>
|
96 |
+
<show_in_website>1</show_in_website>
|
97 |
+
<show_in_store>1</show_in_store>
|
98 |
</debug>
|
99 |
<ips translate="label comment">
|
100 |
<label>Allowed IPs (comma separated)</label>
|
102 |
<depends>
|
103 |
<debug>1</debug>
|
104 |
</depends>
|
105 |
+
<sort_order>6</sort_order>
|
106 |
<comment>
|
107 |
<![CDATA[<span class="notice" style="color:red;">Leave empty for access from any location</span>]]>
|
108 |
</comment>
|
109 |
<show_in_default>1</show_in_default>
|
110 |
+
<show_in_website>1</show_in_website>
|
111 |
+
<show_in_store>1</show_in_store>
|
112 |
</ips>
|
113 |
<log translate="label comment">
|
114 |
<label>Enable log file</label>
|
115 |
<frontend_type>select</frontend_type>
|
116 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
117 |
+
<sort_order>7</sort_order>
|
118 |
<comment>
|
119 |
<![CDATA[<span class="notice" style="color:red;">Log file available under var/log/BotDefender.log if general log settings are enabled</span>]]>
|
120 |
</comment>
|
121 |
<show_in_default>1</show_in_default>
|
122 |
+
<show_in_website>1</show_in_website>
|
123 |
+
<show_in_store>1</show_in_store>
|
124 |
</log>
|
125 |
|
126 |
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>BotDefender_by_Lokad</name>
|
4 |
-
<version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.wyomind.com/terms-and-conditions.html">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -10,12 +10,13 @@
|
|
10 |
Stop being outpriced every time you make a move. Best suited for retailers.</summary>
|
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
|
14 |
-
|
15 |
-
<
|
16 |
-
<
|
17 |
-
<
|
18 |
-
<
|
|
|
19 |
<compatible/>
|
20 |
-
<dependencies
|
21 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>BotDefender_by_Lokad</name>
|
4 |
+
<version>2.0.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>
|
10 |
Stop being outpriced every time you make a move. Best suited for retailers.</summary>
|
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.
|
14 |
+
</description>
|
15 |
+
<notes>V2.0.0</notes>
|
16 |
+
<authors><author><name>Wyomind</name><user>Wyomind</user><email>contact@wyomind.com</email></author></authors>
|
17 |
+
<date>2014-02-05</date>
|
18 |
+
<time>15:23:50</time>
|
19 |
+
<contents><target name="magecommunity"><dir><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="7d2fbe8cd8bc32b61f638df484ded7c2"/></dir><dir name="Model"><file name="Observer.php" hash="3ecd42c88e337b0861c614b5201dc3ae"/><dir name="Resource"><file name="Setup.php" hash="31e494bb0f0d0e6c56ab1df0a5930efb"/></dir></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="975154a35780414a4feb9b06ef6948c2"/><file name="system.xml" hash="6417063879e9091aace556731725d148"/></dir></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><dir name="bundle"><dir name="catalog"><dir name="product"><file name="price.phtml" hash="893eed0a24df8c168b83250447e5ed83"/><dir name="view"><file name="price.phtml" hash="bf7e73a0038d1aadbf31da8820523ce9"/></dir></dir></dir></dir><dir name="catalog"><dir name="product"><file name="price.phtml" hash="99ad8fa9ddbdbedfb2626ab33abe69b9"/></dir></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>
|
20 |
<compatible/>
|
21 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|