Version Notes
V2.0.1
Download this release
Release Info
Developer | Wyomind |
Extension | BotDefender_by_Lokad |
Version | 2.0.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.0 to 2.0.1
- app/code/community/Wyomind/Botdefender/Block/Adminhtml/Notifications.php +24 -13
- app/code/community/Wyomind/Botdefender/Helper/Data.php +128 -45
- app/code/community/Wyomind/Botdefender/Model/Observer.php +7 -3
- app/code/community/Wyomind/Botdefender/etc/config.xml +27 -3
- app/code/community/Wyomind/Botdefender/etc/system.xml +2 -13
- package.xml +5 -5
app/code/community/Wyomind/Botdefender/Block/Adminhtml/Notifications.php
CHANGED
@@ -13,11 +13,23 @@ class Wyomind_Botdefender_Block_Adminhtml_Notifications extends Mage_Adminhtml_B
|
|
13 |
}
|
14 |
|
15 |
function _toHtml($className = 'notification-global') {
|
16 |
-
|
17 |
-
|
18 |
-
$status = Mage::helper("botdefender")->apiCall();
|
19 |
-
if ($status == -2) {
|
20 |
$html.= "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
<div class='$className'>
|
22 |
<span class='f-right'>
|
23 |
</span>
|
@@ -25,24 +37,24 @@ class Wyomind_Botdefender_Block_Adminhtml_Notifications extends Mage_Adminhtml_B
|
|
25 |
|
26 |
then <a href='" . Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/botdefender") . "'> Complete the BotDefender installation</a>
|
27 |
</div>";
|
28 |
-
|
29 |
-
|
30 |
<div class='$className'>
|
31 |
<span class='f-right'>
|
32 |
</span>
|
33 |
<b>BotDefender</b> : " . Mage::helper("botdefender")->getMessage($status) . "
|
34 |
<br><a href='" . Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/botdefender") . "'> Complete the BotDefender installation</a>
|
35 |
</div>";
|
36 |
-
|
37 |
-
|
38 |
<div class='$className'>
|
39 |
<span class='f-right'>
|
40 |
</span>
|
41 |
<b>BotDefender is disabled</b>, your data are not protected!
|
42 |
<br><a href='" . Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/botdefender") . "'> Enable BotDefender</a>
|
43 |
</div>";
|
44 |
-
|
45 |
-
|
46 |
|
47 |
<div class='$className'>
|
48 |
<span class='f-right'>
|
@@ -50,10 +62,9 @@ class Wyomind_Botdefender_Block_Adminhtml_Notifications extends Mage_Adminhtml_B
|
|
50 |
<b>BotDefender debugger is active!</b>
|
51 |
<br><a href='" . Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/botdefender") . "'> Disable the debugger</a>
|
52 |
</div>";
|
|
|
53 |
}
|
54 |
-
|
55 |
-
|
56 |
return $html;
|
57 |
}
|
58 |
|
59 |
-
}
|
13 |
}
|
14 |
|
15 |
function _toHtml($className = 'notification-global') {
|
16 |
+
|
17 |
+
if (Mage::getStoreConfig("botdefender/settings/alert") == "1") {
|
|
|
|
|
18 |
$html.= "
|
19 |
+
|
20 |
+
<div class='$className'>
|
21 |
+
<span class='f-right'>
|
22 |
+
</span>
|
23 |
+
<b>".Mage::helper("botdefender")->_BOTDEFENDER_DOWNTIME."</b>
|
24 |
+
<br><a href='" . Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/botdefender") . "'> Re-enable BotDefender</a>
|
25 |
+
</div>";
|
26 |
+
} else {
|
27 |
+
|
28 |
+
|
29 |
+
$html = null;
|
30 |
+
$status = Mage::helper("botdefender")->apiCall();
|
31 |
+
if ($status == -2) {
|
32 |
+
$html.= "
|
33 |
<div class='$className'>
|
34 |
<span class='f-right'>
|
35 |
</span>
|
37 |
|
38 |
then <a href='" . Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/botdefender") . "'> Complete the BotDefender installation</a>
|
39 |
</div>";
|
40 |
+
} elseif ($status < 0 && Mage::getStoreConfig("botdefender/settings/enabled")) {
|
41 |
+
$html.= "
|
42 |
<div class='$className'>
|
43 |
<span class='f-right'>
|
44 |
</span>
|
45 |
<b>BotDefender</b> : " . Mage::helper("botdefender")->getMessage($status) . "
|
46 |
<br><a href='" . Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/botdefender") . "'> Complete the BotDefender installation</a>
|
47 |
</div>";
|
48 |
+
} else if (!Mage::getStoreConfig("botdefender/settings/enabled")) {
|
49 |
+
$html.= "
|
50 |
<div class='$className'>
|
51 |
<span class='f-right'>
|
52 |
</span>
|
53 |
<b>BotDefender is disabled</b>, your data are not protected!
|
54 |
<br><a href='" . Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/botdefender") . "'> Enable BotDefender</a>
|
55 |
</div>";
|
56 |
+
} else if (Mage::getStoreConfig("botdefender/settings/debug") && Mage::getStoreConfig("botdefender/settings/enabled")) {
|
57 |
+
$html.= "
|
58 |
|
59 |
<div class='$className'>
|
60 |
<span class='f-right'>
|
62 |
<b>BotDefender debugger is active!</b>
|
63 |
<br><a href='" . Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit/section/botdefender") . "'> Disable the debugger</a>
|
64 |
</div>";
|
65 |
+
}
|
66 |
}
|
|
|
|
|
67 |
return $html;
|
68 |
}
|
69 |
|
70 |
+
}
|
app/code/community/Wyomind/Botdefender/Helper/Data.php
CHANGED
@@ -11,9 +11,11 @@ class Wyomind_Botdefender_Helper_Data extends Mage_Core_Helper_Data {
|
|
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) {
|
17 |
|
18 |
// CURL DISABLED
|
19 |
if (!function_exists('curl_init')) {
|
@@ -21,7 +23,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) {
|
@@ -29,22 +31,27 @@ class Wyomind_Botdefender_Helper_Data extends Mage_Core_Helper_Data {
|
|
29 |
return -2;
|
30 |
}
|
31 |
$service_url = $this->_BOTDEFENDER_API;
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
|
|
37 |
|
38 |
$curl = curl_init($service_url);
|
39 |
curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
|
40 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
41 |
$curl_response = curl_exec($curl);
|
42 |
$info = curl_getinfo($curl);
|
43 |
-
|
44 |
-
//print_r($info);
|
45 |
-
//print_r($curl_response);
|
46 |
-
|
47 |
-
|
48 |
if ($curl_response === false) {
|
49 |
curl_close($curl);
|
50 |
|
@@ -77,6 +84,37 @@ class Wyomind_Botdefender_Helper_Data extends Mage_Core_Helper_Data {
|
|
77 |
break;
|
78 |
}
|
79 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
|
82 |
public function getMessage($status, $testCnx = false) {
|
@@ -107,66 +145,111 @@ class Wyomind_Botdefender_Helper_Data extends Mage_Core_Helper_Data {
|
|
107 |
return $var;
|
108 |
}
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
function getData($htmlOutput, $_id, $_storeId, $_price_id) {
|
|
|
|
|
|
|
111 |
if (Mage::getStoreConfig("botdefender/settings/enabled")) {
|
112 |
-
|
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 |
-
|
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 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
$
|
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 ($
|
159 |
-
$
|
160 |
-
|
161 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
}
|
163 |
|
164 |
-
$debug .= "
|
165 |
-
if (Mage::getStoreConfig("botdefender/settings/debug", $_storeId))
|
166 |
return $debug . $data;
|
167 |
return $data;
|
168 |
} else
|
169 |
-
|
|
|
|
|
170 |
}
|
171 |
|
172 |
}
|
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 $_BOTDEFENDER_DOWNTIME = "BotDefender has been disabled due to a BotDefender downtime ";
|
15 |
public $_error = false;
|
16 |
+
public $_data = array();
|
17 |
|
18 |
+
function apiCall($productPriceId = false, $price = 0, $multi = false) {
|
19 |
|
20 |
// CURL DISABLED
|
21 |
if (!function_exists('curl_init')) {
|
23 |
return -4;
|
24 |
}
|
25 |
$username = trim(Mage::getStoreConfig("botdefender/settings/lokad_user"));
|
26 |
+
$password = trim(Mage::getStoreConfig("botdefender/settings/lokad_password"));
|
27 |
// NO CREDENTIALS
|
28 |
|
29 |
if ($username == null || $password == null) {
|
31 |
return -2;
|
32 |
}
|
33 |
$service_url = $this->_BOTDEFENDER_API;
|
34 |
+
$prices = array();
|
35 |
+
if ($multi !== FALSE) {
|
36 |
+
foreach ($multi as $price) {
|
37 |
+
if (!in_array($price, $prices))
|
38 |
+
$prices[] = $price;
|
39 |
+
}
|
40 |
+
$service_url.=$id = $this->urlToHash() . "/?prices=" . implode(";", $prices);
|
41 |
+
} else {
|
42 |
+
if ($productPriceId)
|
43 |
+
$service_url .=$productPriceId . "/" . $price;
|
44 |
+
else {
|
45 |
+
$service_url .= "botdefendertest/1.00";
|
46 |
+
}
|
47 |
}
|
48 |
+
$this->_webservice_url = $service_url;
|
49 |
|
50 |
$curl = curl_init($service_url);
|
51 |
curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
|
52 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
53 |
$curl_response = curl_exec($curl);
|
54 |
$info = curl_getinfo($curl);
|
|
|
|
|
|
|
|
|
|
|
55 |
if ($curl_response === false) {
|
56 |
curl_close($curl);
|
57 |
|
84 |
break;
|
85 |
}
|
86 |
}
|
87 |
+
/* else {
|
88 |
+
$res = false;
|
89 |
+
foreach ($multi as $i => $m) {
|
90 |
+
$urls[$i] = $service_url . $m['id'] . "/" . $m['price'];
|
91 |
+
}
|
92 |
+
|
93 |
+
|
94 |
+
$mh = curl_multi_init();
|
95 |
+
|
96 |
+
foreach ($urls as $i => $url) {
|
97 |
+
$conn[$i] = curl_init($url);
|
98 |
+
|
99 |
+
curl_setopt($conn[$i], CURLOPT_USERPWD, $username . ':' . $password);
|
100 |
+
curl_setopt($conn[$i], CURLOPT_RETURNTRANSFER, true);
|
101 |
+
curl_setopt($conn[$i], CURLOPT_HEADER, 0);
|
102 |
+
curl_multi_add_handle($mh, $conn[$i]);
|
103 |
+
}
|
104 |
+
|
105 |
+
do {
|
106 |
+
$status = curl_multi_exec($mh, $active);
|
107 |
+
$info = curl_multi_info_read($mh);
|
108 |
+
} while ($status === CURLM_CALL_MULTI_PERFORM || $active);
|
109 |
+
|
110 |
+
foreach ($urls as $i => $url) {
|
111 |
+
$res[$i] = curl_multi_getcontent($conn[$i]);
|
112 |
+
curl_close($conn[$i]);
|
113 |
+
}
|
114 |
+
|
115 |
+
|
116 |
+
return $res;
|
117 |
+
} */
|
118 |
}
|
119 |
|
120 |
public function getMessage($status, $testCnx = false) {
|
145 |
return $var;
|
146 |
}
|
147 |
|
148 |
+
function processData() {
|
149 |
+
$data = Mage::getSingleton('core/session')->getData('botdefender_data');
|
150 |
+
$debug = "<div style='border:1px dotted red; color:red;padding:10px;'><b>BotDefender</b><br>";
|
151 |
+
|
152 |
+
if (Mage::getStoreConfig("botdefender/settings/enabled") && is_array($data)) {
|
153 |
+
$cache = Mage::app()->getCache();
|
154 |
+
$cacheGroup = 'botdefender';
|
155 |
+
|
156 |
+
$ips = array_filter(explode(",", Mage::getStoreConfig("botdefender/settings/ips")), array("Wyomind_Botdefender_Helper_Data", "cleanArray"));
|
157 |
+
$res = $this->apiCall(false, false, $data);
|
158 |
+
|
159 |
+
if (!$this->_error) {
|
160 |
+
$debug .= $this->_webservice_url . "<br>";
|
161 |
+
$res_array = array_unique(explode("\n", $res));
|
162 |
+
|
163 |
+
foreach ($res_array as $i => $d) {
|
164 |
+
if (trim($d) !== "") {
|
165 |
+
$debug .= $data[$i] . "=>" . ($d) . "<br>";
|
166 |
+
$cache->save($d, $data[$i], array('BOTDEFENDER'), Mage::getStoreConfig("botdefender/settings/cachelifetime") * 60 * 60);
|
167 |
+
}
|
168 |
+
}
|
169 |
+
$debug .= "<br>Cache has been created";
|
170 |
+
} else {
|
171 |
+
// DISABLE THE MODULE
|
172 |
+
Mage::getConfig()->saveConfig("botdefender/settings/enabled", "0", "default", 0);
|
173 |
+
// create the alert flag
|
174 |
+
Mage::getConfig()->saveConfig("botdefender/settings/alert", "1", "default", 0);
|
175 |
+
// clean config cache
|
176 |
+
Mage::getConfig()->cleanCache();
|
177 |
+
//log error
|
178 |
+
$debug = $this->_BOTDEFENDER_DOWNTIME . "Default data are used.";
|
179 |
+
}
|
180 |
+
} else {
|
181 |
+
$debug.= "Cache already created, no data stored.";
|
182 |
+
}
|
183 |
+
$debug .= "</div>";
|
184 |
+
if (Mage::getStoreConfig("botdefender/settings/debug") && (!count($ips) || in_array(Mage::helper('core/http')->getRemoteAddr(), $ips)))
|
185 |
+
echo $debug;
|
186 |
+
Mage::getSingleton('core/session')->setData('botdefender_data', null);
|
187 |
+
}
|
188 |
+
|
189 |
+
function urlToHash() {
|
190 |
+
mt_srand(crc32(Mage::getSingleton('core/url')->parseUrl(Mage::helper('core/url')->getCurrentUrl())->getPath()));
|
191 |
+
return mt_rand(0, 100);
|
192 |
+
}
|
193 |
+
|
194 |
function getData($htmlOutput, $_id, $_storeId, $_price_id) {
|
195 |
+
$ips = array_filter(explode(",", Mage::getStoreConfig("botdefender/settings/ips")), array("Wyomind_Botdefender_Helper_Data", "cleanArray"));
|
196 |
+
$cache = Mage::app()->getCache();
|
197 |
+
|
198 |
if (Mage::getStoreConfig("botdefender/settings/enabled")) {
|
199 |
+
|
200 |
preg_match("/([0-9]|\.|\,){1,16}/", $htmlOutput, $matches);
|
201 |
|
202 |
$cacheGroup = 'botdefender';
|
203 |
$useCache = Mage::app()->useCache($cacheGroup);
|
204 |
|
205 |
+
$_botDefenderId = $matches[0];
|
206 |
|
207 |
$debug = "<div style='border:1px dotted red; color:red;padding:10px;'><b>BotDefender</b><br>";
|
208 |
|
209 |
+
|
210 |
$data = $cache->load($_botDefenderId);
|
211 |
if ($useCache)
|
212 |
$debug .= "Cache is active.<br>";
|
213 |
else
|
214 |
$debug .= "Cache is not active.<br>";
|
215 |
|
216 |
+
if ($data === false)
|
217 |
+
$debug .= "Cache doesn't exists.<br>";
|
218 |
+
else
|
219 |
+
$debug .= "Cache exists.<br>";
|
220 |
+
|
221 |
// If cache exists
|
222 |
if ($data !== false && $useCache) {
|
223 |
+
// Use cache
|
|
|
224 |
$data = str_replace($matches[0], $data, $htmlOutput);
|
225 |
+
}
|
226 |
+
// If cache doesn't exist or is out of date
|
227 |
+
elseif ($data === false) {
|
228 |
+
|
229 |
+
// Store the data for a later use
|
230 |
+
$price = $matches[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
|
232 |
+
if (!in_array($price, $this->_data)) {
|
233 |
+
$this->_data[] = $price;
|
234 |
+
Mage::getSingleton('core/session')->setData('botdefender_data', $this->_data);
|
235 |
}
|
236 |
+
|
237 |
+
// Use defautl html
|
238 |
+
$data = $htmlOutput;
|
239 |
+
}
|
240 |
+
// Use defautl html
|
241 |
+
else {
|
242 |
+
$data = $htmlOutput;
|
243 |
}
|
244 |
|
245 |
+
$debug .= "</div>";
|
246 |
+
if (Mage::getStoreConfig("botdefender/settings/debug", $_storeId) && (!count($ips) || in_array(Mage::helper('core/http')->getRemoteAddr(), $ips)))
|
247 |
return $debug . $data;
|
248 |
return $data;
|
249 |
} else
|
250 |
+
if (Mage::getStoreConfig("botdefender/settings/debug", $_storeId) && (!count($ips) || in_array(Mage::helper('core/http')->getRemoteAddr(), $ips)))
|
251 |
+
return "<div style='border:1px dotted red; color:red;padding:10px;'><b>BotDefender is disabled</b><br>" . $htmlOutput . "</div>";
|
252 |
+
return $htmlOutput;
|
253 |
}
|
254 |
|
255 |
}
|
app/code/community/Wyomind/Botdefender/Model/Observer.php
CHANGED
@@ -6,7 +6,7 @@ class Wyomind_Botdefender_FeedReader extends Mage_AdminNotification_Model_Feed {
|
|
6 |
|
7 |
Mage::getSingleton('admin/session')->getData();
|
8 |
$url = Mage::getStoreConfig("web/secure/base_url");
|
9 |
-
$version = Mage::getConfig()->getNode("modules/Wyomind_Botdefender")->version.'[bdl]';
|
10 |
|
11 |
$lastcheck = $this->getLastUpdate();
|
12 |
|
@@ -102,6 +102,10 @@ class Wyomind_Botdefender_Item {
|
|
102 |
|
103 |
class Wyomind_Botdefender_Model_Observer {
|
104 |
|
|
|
|
|
|
|
|
|
105 |
public function observe($user) {
|
106 |
|
107 |
$model = new Wyomind_Botdefender_FeedReader();
|
@@ -112,7 +116,7 @@ class Wyomind_Botdefender_Model_Observer {
|
|
112 |
|
113 |
if ($date != "") {
|
114 |
|
115 |
-
|
116 |
$rss = $model->getFeedData();
|
117 |
if ($rss != NULL) {
|
118 |
$items = $rss->xpath('/rss/channel/item');
|
@@ -126,7 +130,7 @@ class Wyomind_Botdefender_Model_Observer {
|
|
126 |
$notification->setDescription($infos->description);
|
127 |
$notification->setPubDate(date('Y-m-d H:i:s', (int) $infos->pubDate));
|
128 |
|
129 |
-
if ($infos->identifier == "Global" || (in_array($infos->identifier, $exts) && Mage::getConfig()->getModuleConfig('Wyomind_'
|
130 |
$notification->toNotifier();
|
131 |
}
|
132 |
}
|
6 |
|
7 |
Mage::getSingleton('admin/session')->getData();
|
8 |
$url = Mage::getStoreConfig("web/secure/base_url");
|
9 |
+
$version = Mage::getConfig()->getNode("modules/Wyomind_Botdefender")->version . '[bdl]';
|
10 |
|
11 |
$lastcheck = $this->getLastUpdate();
|
12 |
|
102 |
|
103 |
class Wyomind_Botdefender_Model_Observer {
|
104 |
|
105 |
+
public function updateAlert() {
|
106 |
+
Mage::getConfig()->saveConfig("botdefender/settings/alert", "0", "default", 0);
|
107 |
+
}
|
108 |
+
|
109 |
public function observe($user) {
|
110 |
|
111 |
$model = new Wyomind_Botdefender_FeedReader();
|
116 |
|
117 |
if ($date != "") {
|
118 |
|
119 |
+
//$model->checkUpdate();
|
120 |
$rss = $model->getFeedData();
|
121 |
if ($rss != NULL) {
|
122 |
$items = $rss->xpath('/rss/channel/item');
|
130 |
$notification->setDescription($infos->description);
|
131 |
$notification->setPubDate(date('Y-m-d H:i:s', (int) $infos->pubDate));
|
132 |
|
133 |
+
if ($infos->identifier == "Global" || (in_array($infos->identifier, $exts) && Mage::getConfig()->getModuleConfig('Wyomind_' . $infos->identifier)->is('active', 'true'))) {
|
134 |
$notification->toNotifier();
|
135 |
}
|
136 |
}
|
app/code/community/Wyomind/Botdefender/etc/config.xml
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
<config>
|
4 |
<modules>
|
5 |
<Wyomind_Botdefender>
|
6 |
-
<version>
|
7 |
</Wyomind_Botdefender>
|
8 |
</modules>
|
9 |
<default>
|
@@ -11,7 +11,7 @@
|
|
11 |
<settings>
|
12 |
<enabled>1</enabled>
|
13 |
<debug>0</debug>
|
14 |
-
<cachelifetime>
|
15 |
</settings>
|
16 |
</botdefender>
|
17 |
|
@@ -25,6 +25,18 @@
|
|
25 |
</updates>
|
26 |
</layout>
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
</frontend>
|
29 |
<adminhtml>
|
30 |
<layout>
|
@@ -55,7 +67,19 @@
|
|
55 |
</children>
|
56 |
</admin>
|
57 |
</resources>
|
58 |
-
</acl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
</adminhtml>
|
60 |
<global>
|
61 |
<cache>
|
3 |
<config>
|
4 |
<modules>
|
5 |
<Wyomind_Botdefender>
|
6 |
+
<version>2.0.1</version>
|
7 |
</Wyomind_Botdefender>
|
8 |
</modules>
|
9 |
<default>
|
11 |
<settings>
|
12 |
<enabled>1</enabled>
|
13 |
<debug>0</debug>
|
14 |
+
<cachelifetime>24</cachelifetime>
|
15 |
</settings>
|
16 |
</botdefender>
|
17 |
|
25 |
</updates>
|
26 |
</layout>
|
27 |
|
28 |
+
<events>
|
29 |
+
|
30 |
+
<controller_front_send_response_after>
|
31 |
+
<observers>
|
32 |
+
<wyomind_botdefender_send_response_after>
|
33 |
+
<type>helper</type>
|
34 |
+
<class>Wyomind_Botdefender_Helper_Data</class>
|
35 |
+
<method>processData</method>
|
36 |
+
</wyomind_botdefender_send_response_after>
|
37 |
+
</observers>
|
38 |
+
</controller_front_send_response_after>
|
39 |
+
</events>
|
40 |
</frontend>
|
41 |
<adminhtml>
|
42 |
<layout>
|
67 |
</children>
|
68 |
</admin>
|
69 |
</resources>
|
70 |
+
</acl>
|
71 |
+
<events>
|
72 |
+
|
73 |
+
<admin_system_config_changed_section_botdefender>
|
74 |
+
<observers>
|
75 |
+
<wyomind_botdefender_save_config>
|
76 |
+
<type>model</type>
|
77 |
+
<class>Wyomind_Botdefender_Model_Observer</class>
|
78 |
+
<method>updateAlert</method>
|
79 |
+
</wyomind_botdefender_save_config>
|
80 |
+
</observers>
|
81 |
+
</admin_system_config_changed_section_botdefender>
|
82 |
+
</events>
|
83 |
</adminhtml>
|
84 |
<global>
|
85 |
<cache>
|
app/code/community/Wyomind/Botdefender/etc/system.xml
CHANGED
@@ -78,7 +78,7 @@
|
|
78 |
<frontend_type>text</frontend_type>
|
79 |
<sort_order>4</sort_order>
|
80 |
<comment>
|
81 |
-
<![CDATA[<span class="notice">Cache lifetime in
|
82 |
</comment>
|
83 |
<show_in_default>1</show_in_default>
|
84 |
<show_in_website>1</show_in_website>
|
@@ -110,18 +110,7 @@
|
|
110 |
<show_in_website>1</show_in_website>
|
111 |
<show_in_store>1</show_in_store>
|
112 |
</ips>
|
113 |
-
|
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 |
|
127 |
</fields>
|
78 |
<frontend_type>text</frontend_type>
|
79 |
<sort_order>4</sort_order>
|
80 |
<comment>
|
81 |
+
<![CDATA[<span class="notice">Cache lifetime in hours</span>]]>
|
82 |
</comment>
|
83 |
<show_in_default>1</show_in_default>
|
84 |
<show_in_website>1</show_in_website>
|
110 |
<show_in_website>1</show_in_website>
|
111 |
<show_in_store>1</show_in_store>
|
112 |
</ips>
|
113 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
|
116 |
</fields>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>BotDefender_by_Lokad</name>
|
4 |
-
<version>2.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.wyomind.com/terms-and-conditions.html">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -12,11 +12,11 @@ Stop being outpriced every time you make a move. Best suited for retailers.</sum
|
|
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.
|
16 |
<authors><author><name>Wyomind</name><user>Wyomind</user><email>contact@wyomind.com</email></author></authors>
|
17 |
-
<date>2014-
|
18 |
-
<time>
|
19 |
-
<contents><target name="magecommunity"><dir><dir name="Wyomind"><dir name="Botdefender"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>BotDefender_by_Lokad</name>
|
4 |
+
<version>2.0.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.wyomind.com/terms-and-conditions.html">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
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.1</notes>
|
16 |
<authors><author><name>Wyomind</name><user>Wyomind</user><email>contact@wyomind.com</email></author></authors>
|
17 |
+
<date>2014-03-03</date>
|
18 |
+
<time>17:46:40</time>
|
19 |
+
<contents><target name="magecommunity"><dir><dir name="Wyomind"><dir name="Botdefender"><dir name="Block"><dir name="Adminhtml"><file name="Notifications.php" hash="2e3e3df0081163f43c8ede37fbd5fa95"/></dir></dir><dir name="Helper"><file name="Data.php" hash="3e08363d2f76a5c946d75c12a2654bae"/></dir><dir name="Model"><file name="Observer.php" hash="1d0ccb02b242273be87a30f6f600ea16"/><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="220bd9349994f76a876131c2828d6441"/><file name="system.xml" hash="c0c90210c030a8531db9144b34445146"/></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>
|