ddos protection by cloudflare blocks extensions in opencart admin code example
Example: ddos protection by cloudflare blocks extensions in opencart admin
/* This is an opencart issue, specifically with the annoying promotional advert
that pops up above the extensions when you load them up.
To fix this:
1) Go to this file: admin/controller/extension/extension/promotion.php
2) add this code:
*/
return '';
/*
after this code:
*/
public function index() {
/*
This will return nothing, instead of an advert... which is what you want
The end result should look something like this:
*/
<?php
class ControllerExtensionExtensionPromotion extends Controller {
public function index() {
// return nothing, early, to avoid cloudflair issue!
return '';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, OPENCART_SERVER . 'index.php?route=api/promotion&type=' . substr($this->request->get['route'], strrpos($this->request->get['route'], '/') + 1));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
$response = curl_exec($curl);
curl_close($curl);
if ($response) {
return $response;
} else {
return '';
}
}
}