// Context part 31
This commit is contained in:
@@ -171,6 +171,7 @@ class AuthControllerCore extends FrontController
|
||||
$this->context->cookie->customer_firstname = $customer->firstname;
|
||||
$this->context->cookie->passwd = $customer->passwd;
|
||||
$this->context->cookie->logged = 1;
|
||||
$customer->logged = 1;
|
||||
$this->context->cookie->email = $customer->email;
|
||||
$this->context->cookie->is_guest = !Tools::getValue('is_new_customer', 1);
|
||||
/* Update cart address */
|
||||
@@ -251,6 +252,7 @@ class AuthControllerCore extends FrontController
|
||||
$this->context->cookie->customer_lastname = $customer->lastname;
|
||||
$this->context->cookie->customer_firstname = $customer->firstname;
|
||||
$this->context->cookie->logged = 1;
|
||||
$customer->logged = 1;
|
||||
$this->context->cookie->is_guest = $customer->isGuest();
|
||||
$this->context->cookie->passwd = $customer->passwd;
|
||||
$this->context->cookie->email = $customer->email;
|
||||
|
||||
@@ -36,8 +36,7 @@ class getFileControllerCore extends FrontController
|
||||
|
||||
public function process()
|
||||
{
|
||||
$cookie = $this->context->cookie;
|
||||
if ($cookie->isLoggedBack() AND Tools::getValue('file'))
|
||||
if (isset($this->context->employee) && $this->context->employee->isLoggedBack() AND Tools::getValue('file'))
|
||||
{
|
||||
/* Admin can directly access to file */
|
||||
$filename = Tools::getValue('file');
|
||||
@@ -62,11 +61,10 @@ class getFileControllerCore extends FrontController
|
||||
if (!($key = Tools::getValue('key')))
|
||||
$this->displayCustomError('Invalid key.');
|
||||
|
||||
$cookie = new Cookie('ps');
|
||||
Tools::setCookieLanguage();
|
||||
if (!$cookie->isLogged() AND !Tools::getValue('secure_key') AND !Tools::getValue('id_order'))
|
||||
if (!$this->context->customer->isLogged() AND !Tools::getValue('secure_key') AND !Tools::getValue('id_order'))
|
||||
Tools::redirect('index.php?controller=authentication&back=get-file.php&key='.$key);
|
||||
elseif (!$cookie->isLogged() AND Tools::getValue('secure_key') AND Tools::getValue('id_order'))
|
||||
elseif (!$this->context->customer->isLogged() AND Tools::getValue('secure_key') AND Tools::getValue('id_order'))
|
||||
{
|
||||
$order = new Order((int)Tools::getValue('id_order'));
|
||||
if (!Validate::isLoadedObject($order))
|
||||
|
||||
@@ -76,7 +76,7 @@ class OrderConfirmationControllerCore extends FrontController
|
||||
'id_order_formatted' => sprintf('#%06d', $this->id_order)
|
||||
));
|
||||
/* If guest we clear the cookie for security reason */
|
||||
$this->context->cookie->logout();
|
||||
$this->context->customer->logout();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ class OrderControllerCore extends ParentOrderController
|
||||
if ($this->context->customer->is_guest)
|
||||
{
|
||||
$email = $this->context->customer->email;
|
||||
$this->context->cookie->logout(); // If guest we clear the cookie for security reason
|
||||
$this->context->customer->logout(); // If guest we clear the cookie for security reason
|
||||
Tools::redirect('index.php?controller=guest-tracking&id_order='.(int)$id_order.'&email='.urlencode($email));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -149,13 +149,13 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
{
|
||||
$email = $this->context->customer->email;
|
||||
if ($this->context->customer->is_guest)
|
||||
$this->context->cookie->logout(); // If guest we clear the cookie for security reason
|
||||
$this->context->customer->logout(); // If guest we clear the cookie for security reason
|
||||
die('freeorder:'.$id_order.':'.$email);
|
||||
}
|
||||
exit;
|
||||
break;
|
||||
case 'updateAddressesSelected':
|
||||
if ($this->context->cookie->isLogged(true))
|
||||
if ($this->context->customer->isLogged(true))
|
||||
{
|
||||
$id_address_delivery = (int)(Tools::getValue('id_address_delivery'));
|
||||
$id_address_invoice = (int)(Tools::getValue('id_address_invoice'));
|
||||
|
||||
@@ -290,7 +290,7 @@ class ParentOrderControllerCore extends FrontController
|
||||
//if guest checkout disabled and flag is_guest in cookies is actived
|
||||
if(Configuration::get('PS_GUEST_CHECKOUT_ENABLED') == 0 AND ((int)$this->context->customer->is_guest != Configuration::get('PS_GUEST_CHECKOUT_ENABLED')))
|
||||
{
|
||||
$this->context->cookie->logout();
|
||||
$this->context->customer->logout();
|
||||
Tools::redirect('');
|
||||
}
|
||||
elseif (!Customer::getAddressesTotalById($this->context->customer->id))
|
||||
|
||||
@@ -37,9 +37,7 @@ class PdfInvoiceControllerCore extends FrontController
|
||||
public function process()
|
||||
{
|
||||
parent::process();
|
||||
|
||||
$cookie = $this->context->cookie;
|
||||
if (!$cookie->isLogged() AND !Tools::getValue('secure_key'))
|
||||
if (!$this->context->customer->isLogged() AND !Tools::getValue('secure_key'))
|
||||
Tools::redirect('index.php?controller=authentication&back=pdf-invoice');
|
||||
if (!(int)(Configuration::get('PS_INVOICE')))
|
||||
die(Tools::displayError('Invoices are disabled in this shop.'));
|
||||
@@ -47,7 +45,7 @@ class PdfInvoiceControllerCore extends FrontController
|
||||
$order = new Order((int)($_GET['id_order']));
|
||||
if (!isset($order) OR !Validate::isLoadedObject($order))
|
||||
die(Tools::displayError('Invoice not found'));
|
||||
elseif ((isset($cookie->id_customer) AND $order->id_customer != $cookie->id_customer) OR (Tools::isSubmit('secure_key') AND $order->secure_key != Tools::getValue('secure_key')))
|
||||
elseif ((isset($this->context->customer->id) AND $order->id_customer != $this->context->customer->id) OR (Tools::isSubmit('secure_key') AND $order->secure_key != Tools::getValue('secure_key')))
|
||||
die(Tools::displayError('Invoice not found'));
|
||||
elseif (!OrderState::invoiceAvailable($order->getCurrentState()) AND !$order->invoice_number)
|
||||
die(Tools::displayError('No invoice available'));
|
||||
|
||||
@@ -38,15 +38,14 @@ class PdfOrderReturnControllerCore extends FrontController
|
||||
{
|
||||
parent::process();
|
||||
|
||||
$cookie = $this->context->cookie;
|
||||
if (!$cookie->isLogged())
|
||||
if (!$this->context->customer->isLogged())
|
||||
Tools::redirect('index.php?controller=authentication&back=order-follow');
|
||||
|
||||
if (isset($_GET['id_order_return']) AND Validate::isUnsignedId($_GET['id_order_return']))
|
||||
$orderReturn = new OrderReturn((int)($_GET['id_order_return']));
|
||||
if (!isset($orderReturn) OR !Validate::isLoadedObject($orderReturn))
|
||||
die(Tools::displayError('Order return not found'));
|
||||
else if ($orderReturn->id_customer != $cookie->id_customer)
|
||||
else if ($orderReturn->id_customer != $this->context->customer->id)
|
||||
die(Tools::displayError('Order return not found'));
|
||||
else if ($orderReturn->state < 2)
|
||||
die(Tools::displayError('Order return not confirmed'));
|
||||
|
||||
@@ -38,15 +38,14 @@ class PdfOrderSlipControllerCore extends FrontController
|
||||
{
|
||||
parent::process();
|
||||
|
||||
$cookie = $this->context->cookie;
|
||||
if (!$cookie->isLogged())
|
||||
if (!$this->context->customer->isLogged())
|
||||
Tools::redirect('index.php?controller=authentication&back=order-follow');
|
||||
|
||||
if (isset($_GET['id_order_slip']) AND Validate::isUnsignedId($_GET['id_order_slip']))
|
||||
$orderSlip = new OrderSlip((int)($_GET['id_order_slip']));
|
||||
if (!isset($orderSlip) OR !Validate::isLoadedObject($orderSlip))
|
||||
die(Tools::displayError('Order return not found'));
|
||||
elseif ($orderSlip->id_customer != $cookie->id_customer)
|
||||
elseif ($orderSlip->id_customer != $this->context->customer->id)
|
||||
die(Tools::displayError('Order return not found'));
|
||||
$order = new Order((int)($orderSlip->id_order));
|
||||
if (!Validate::isLoadedObject($order))
|
||||
|
||||
Reference in New Issue
Block a user