Compare commits

...

2 Commits

Author SHA1 Message Date
Michael RICOIS
3fd3c44b4a Remove code - you can't send multiple cookie domain 2018-03-14 15:04:48 +01:00
Michael RICOIS
b2c8ce4248 Isolate env 2018-03-14 11:14:54 +01:00
2 changed files with 21 additions and 16 deletions

View File

@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@ -83,22 +83,29 @@ class CookieCore
{
$r = '!(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?(?:\:(\d*))?([^#?]+)?(?:\?([^#]+))?(?:#(.+$))?!i';
preg_match ($r, Tools::getHttpHost(false, false), $out);
if (preg_match('/^(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]{1}[0-9]|[1-9]).)'.
'{1}((25[0-5]|2[0-4][0-9]|[1]{1}[0-9]{2}|[1-9]{1}[0-9]|[0-9]).)'.
'{2}((25[0-5]|2[0-4][0-9]|[1]{1}[0-9]{2}|[1-9]{1}[0-9]|[0-9]){1}))$/', $out[4]))
return false;
if (!strstr(Tools::getHttpHost(false, false), '.'))
if (preg_match('/^(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]{1}[0-9]|[1-9]).)'.
'{1}((25[0-5]|2[0-4][0-9]|[1]{1}[0-9]{2}|[1-9]{1}[0-9]|[0-9]).)'.
'{2}((25[0-5]|2[0-4][0-9]|[1]{1}[0-9]{2}|[1-9]{1}[0-9]|[0-9]){1}))$/', $out[4])) {
return false;
}
if (!strstr(Tools::getHttpHost(false, false), '.')) {
return false;
}
$domain = $out[4];
$subDomains = SubDomain::getSubDomains();
if ($subDomains === false)
if ($subDomains === false) {
die(Tools::displayError('Bad SubDomain SQL query.'));
foreach ($subDomains AS $subDomain)
{
$subDomainLength = strlen($subDomain) + 1;
if (strncmp($subDomain.'.', $domain, $subDomainLength) == 0)
$domain = substr($domain, $subDomainLength);
}
foreach ($subDomains AS $subDomain) {
$subDomainLength = strlen($subDomain) + 1;
if (strncmp($subDomain.'.', $domain, $subDomainLength) == 0) {
$domain = substr($domain, $subDomainLength);
}
}
return $domain;
}

View File

@ -69,7 +69,7 @@ class BlockUserInfo extends Module
global $smarty, $cookie, $cart;
if (!$cookie->logged) {
if (!$cookie->isLogged()) {
return;
}
@ -92,7 +92,6 @@ class BlockUserInfo extends Module
'loyalties' => ($loyalties)?$loyalties:0,
'cart' => $cart,
'cart_qties' => $cart->nbProducts(),
'logged' => $cookie->isLogged(),
'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false),
'firstName' => ($cookie->logged ? $cookie->customer_firstname : false),
'lastName' => ($cookie->logged ? $cookie->customer_lastname : false),
@ -119,7 +118,7 @@ class BlockUserInfo extends Module
$loyalties = null;
if ($this->disableCredits === false) {
$display_credits = true;
if ($cookie->logged) {
if ($cookie->isLogged()) {
$display_credits = true;
$sql = 'SELECT id_customer FROM `'._DB_PREFIX_.'customer_credits` WHERE id_customer = ' .(int) $cookie->id_customer;
if(Db::getInstance()->getValue($sql)){
@ -137,7 +136,6 @@ class BlockUserInfo extends Module
'loyalties' => ($loyalties)?$loyalties:0,
'cart' => $cart,
'cart_qties' => $cart->nbProducts(),
'logged' => $cookie->isLogged(),
'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false),
'firstName' => ($cookie->logged ? $cookie->customer_firstname : false),
'lastName' => ($cookie->logged ? $cookie->customer_lastname : false),