Compare commits
2 Commits
master
...
fix/cookie
Author | SHA1 | Date | |
---|---|---|---|
|
3fd3c44b4a | ||
|
b2c8ce4248 |
@ -85,20 +85,27 @@ class CookieCore
|
|||||||
preg_match ($r, Tools::getHttpHost(false, false), $out);
|
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]).)'.
|
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]).)'.
|
'{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]))
|
'{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;
|
return false;
|
||||||
if (!strstr(Tools::getHttpHost(false, false), '.'))
|
}
|
||||||
|
|
||||||
|
if (!strstr(Tools::getHttpHost(false, false), '.')) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$domain = $out[4];
|
$domain = $out[4];
|
||||||
$subDomains = SubDomain::getSubDomains();
|
$subDomains = SubDomain::getSubDomains();
|
||||||
if ($subDomains === false)
|
if ($subDomains === false) {
|
||||||
die(Tools::displayError('Bad SubDomain SQL query.'));
|
die(Tools::displayError('Bad SubDomain SQL query.'));
|
||||||
foreach ($subDomains AS $subDomain)
|
}
|
||||||
{
|
|
||||||
|
foreach ($subDomains AS $subDomain) {
|
||||||
$subDomainLength = strlen($subDomain) + 1;
|
$subDomainLength = strlen($subDomain) + 1;
|
||||||
if (strncmp($subDomain.'.', $domain, $subDomainLength) == 0)
|
if (strncmp($subDomain.'.', $domain, $subDomainLength) == 0) {
|
||||||
$domain = substr($domain, $subDomainLength);
|
$domain = substr($domain, $subDomainLength);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $domain;
|
return $domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ class BlockUserInfo extends Module
|
|||||||
|
|
||||||
global $smarty, $cookie, $cart;
|
global $smarty, $cookie, $cart;
|
||||||
|
|
||||||
if (!$cookie->logged) {
|
if (!$cookie->isLogged()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +92,6 @@ class BlockUserInfo extends Module
|
|||||||
'loyalties' => ($loyalties)?$loyalties:0,
|
'loyalties' => ($loyalties)?$loyalties:0,
|
||||||
'cart' => $cart,
|
'cart' => $cart,
|
||||||
'cart_qties' => $cart->nbProducts(),
|
'cart_qties' => $cart->nbProducts(),
|
||||||
'logged' => $cookie->isLogged(),
|
|
||||||
'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false),
|
'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false),
|
||||||
'firstName' => ($cookie->logged ? $cookie->customer_firstname : false),
|
'firstName' => ($cookie->logged ? $cookie->customer_firstname : false),
|
||||||
'lastName' => ($cookie->logged ? $cookie->customer_lastname : false),
|
'lastName' => ($cookie->logged ? $cookie->customer_lastname : false),
|
||||||
@ -119,7 +118,7 @@ class BlockUserInfo extends Module
|
|||||||
$loyalties = null;
|
$loyalties = null;
|
||||||
if ($this->disableCredits === false) {
|
if ($this->disableCredits === false) {
|
||||||
$display_credits = true;
|
$display_credits = true;
|
||||||
if ($cookie->logged) {
|
if ($cookie->isLogged()) {
|
||||||
$display_credits = true;
|
$display_credits = true;
|
||||||
$sql = 'SELECT id_customer FROM `'._DB_PREFIX_.'customer_credits` WHERE id_customer = ' .(int) $cookie->id_customer;
|
$sql = 'SELECT id_customer FROM `'._DB_PREFIX_.'customer_credits` WHERE id_customer = ' .(int) $cookie->id_customer;
|
||||||
if(Db::getInstance()->getValue($sql)){
|
if(Db::getInstance()->getValue($sql)){
|
||||||
@ -137,7 +136,6 @@ class BlockUserInfo extends Module
|
|||||||
'loyalties' => ($loyalties)?$loyalties:0,
|
'loyalties' => ($loyalties)?$loyalties:0,
|
||||||
'cart' => $cart,
|
'cart' => $cart,
|
||||||
'cart_qties' => $cart->nbProducts(),
|
'cart_qties' => $cart->nbProducts(),
|
||||||
'logged' => $cookie->isLogged(),
|
|
||||||
'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false),
|
'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false),
|
||||||
'firstName' => ($cookie->logged ? $cookie->customer_firstname : false),
|
'firstName' => ($cookie->logged ? $cookie->customer_firstname : false),
|
||||||
'lastName' => ($cookie->logged ? $cookie->customer_lastname : false),
|
'lastName' => ($cookie->logged ? $cookie->customer_lastname : false),
|
||||||
|
Loading…
Reference in New Issue
Block a user