[-] MO : pagesnotfound module fixed #PSCFV-5949

This commit is contained in:
Damien Metzger
2012-12-14 15:51:45 +01:00
parent 4b9e70a092
commit 623300419d
+5 -2
View File
@@ -35,7 +35,7 @@ class Pagesnotfound extends Module
{ {
$this->name = 'pagesnotfound'; $this->name = 'pagesnotfound';
$this->tab = 'analytics_stats'; $this->tab = 'analytics_stats';
$this->version = 1.0; $this->version = 1.1;
$this->author = 'PrestaShop'; $this->author = 'PrestaShop';
$this->need_instance = 0; $this->need_instance = 0;
@@ -167,14 +167,17 @@ class Pagesnotfound extends Module
$_SERVER['REQUEST_URI'] = $_SERVER['REDIRECT_URL']; $_SERVER['REQUEST_URI'] = $_SERVER['REDIRECT_URL'];
if (!Validate::isUrl($request_uri = $_SERVER['REQUEST_URI']) || strstr($_SERVER['REQUEST_URI'], '-admin404')) if (!Validate::isUrl($request_uri = $_SERVER['REQUEST_URI']) || strstr($_SERVER['REQUEST_URI'], '-admin404'))
return; return;
if (strstr($_SERVER['PHP_SELF'], '404.php') && !strstr($_SERVER['REQUEST_URI'], '404.php'))
if (get_class(Context::getContext()->controller) == 'PageNotFoundController')
{ {
$http_referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; $http_referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
if (empty($http_referer) || Validate::isAbsoluteUrl($http_referer)) if (empty($http_referer) || Validate::isAbsoluteUrl($http_referer))
{
Db::getInstance()->execute(' Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'pagenotfound` (`request_uri`, `http_referer`, `date_add`, `id_shop`, `id_shop_group`) INSERT INTO `'._DB_PREFIX_.'pagenotfound` (`request_uri`, `http_referer`, `date_add`, `id_shop`, `id_shop_group`)
VALUES (\''.pSQL($request_uri).'\', \''.pSQL($http_referer).'\', NOW(), '.(int)$this->context->shop->id.', '.(int)$this->context->shop->id_shop_group.') VALUES (\''.pSQL($request_uri).'\', \''.pSQL($http_referer).'\', NOW(), '.(int)$this->context->shop->id.', '.(int)$this->context->shop->id_shop_group.')
'); ');
}
} }
} }
} }