/** * Initialize addresses controller * @see FrontController::init() */ public function init() { parent::init(); if (!Validate::isLoadedObject($this->context->customer)) { die(Tools::displayError('The customer could not be found.')); } }
public function init() { parent::init(); AuthController::requireLogin(); AuthController::requireShopSession(); $this->setSmarty(); }
/** * Initialize order confirmation controller * @see FrontController::init() */ public function init() { parent::init(); $this->id_cart = (int) Tools::getValue('id_cart', 0); $is_guest = false; /* check if the cart has been made by a Guest customer, for redirect link */ if (Cart::isGuestCartByCartId($this->id_cart)) { $is_guest = true; $redirectLink = 'index.php?controller=guest-tracking'; } else { $redirectLink = 'index.php?controller=history'; } $this->id_module = (int) Tools::getValue('id_module', 0); $this->id_order = Order::getOrderByCartId((int) $this->id_cart); $this->secure_key = Tools::getValue('key', false); $order = new Order((int) $this->id_order); if ($is_guest) { $customer = new Customer((int) $order->id_customer); $redirectLink .= '&id_order=' . $order->reference . '&email=' . urlencode($customer->email); } if (!$this->id_order || !$this->id_module || !$this->secure_key || empty($this->secure_key)) { Tools::redirect($redirectLink . (Tools::isSubmit('slowvalidation') ? '&slowvalidation' : '')); } $this->reference = $order->reference; if (!Validate::isLoadedObject($order) || $order->id_customer != $this->context->customer->id || $this->secure_key != $order->secure_key) { Tools::redirect($redirectLink); } $module = Module::getInstanceById((int) $this->id_module); if ($order->payment != $module->displayName) { Tools::redirect($redirectLink); } }
/** * Initialize guest tracking controller * @see FrontController::init() */ public function init() { parent::init(); if ($this->context->customer->isLogged()) { Tools::redirect('history.php'); } }
/** * Initialize order return controller. * * @see FrontController::init() */ public function init() { parent::init(); $id_order_return = (int) Tools::getValue('id_order_return'); if (!isset($id_order_return) || !Validate::isUnsignedId($id_order_return)) { $this->redirect_after = '404'; $this->redirect(); } else { $order_return = new OrderReturn((int) $id_order_return); if (Validate::isLoadedObject($order_return) && $order_return->id_customer == $this->context->cookie->id_customer) { $order = new Order((int) $order_return->id_order); if (Validate::isLoadedObject($order)) { if ($order_return->state == 1) { $this->warning[] = $this->trans('You must wait for confirmation before returning any merchandise.', array(), 'Shop.Notifications.Warning'); } // StarterTheme: Use presenters! $this->context->smarty->assign(array('return' => $this->getTemplateVarOrderReturn($order_return), 'products' => $this->getTemplateVarProducts((int) $order_return->id, $order))); } else { $this->redirect_after = '404'; $this->redirect(); } } else { $this->redirect_after = '404'; $this->redirect(); } } }
/** * Initialize category controller * @see FrontController::init() */ public function init() { // Get category ID $id_category = (int) Tools::getValue('id_category'); if (!$id_category || !Validate::isUnsignedId($id_category)) { $this->errors[] = Tools::displayError('Missing category ID'); } // Instantiate category $this->category = new Category($id_category, $this->context->language->id); parent::init(); if (!$this->ajax) { //check if the category is active and return 404 error if is disable. if (!$this->category->active) { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); } //check if category can be accessible by current customer and return 403 if not if (!$this->category->checkAccess($this->context->customer->id)) { header('HTTP/1.1 403 Forbidden'); header('Status: 403 Forbidden'); $this->errors[] = Tools::displayError('You do not have access to this category.'); $this->customer_access = false; } } }
public function init() { parent::init(); AuthController::getInstance()->requireLogin(); ErrorHandler::getInstance()->getUrlErrorMessage(); $this->setSmarty(); }
public function init() { $this->attachBehavior('breadcrumbs', new CrumbsBehaviour()); $this->breadcrumbs->setEnabled(true); $this->initProfile(); parent::init(); }
/** * Initialize cms controller * @see FrontController::init() */ public function init() { if ($id_cms = (int) Tools::getValue('id_cms')) { $this->cms = new CMS($id_cms, $this->context->language->id); } elseif ($id_cms_category = (int) Tools::getValue('id_cms_category')) { $this->cms_category = new CMSCategory($id_cms_category, $this->context->language->id); } if (Configuration::get('PS_SSL_ENABLED') && Tools::getValue('content_only') && Tools::getValue('id_cms') == (int) Configuration::get('PS_CONDITIONS_CMS_ID') && Validate::isLoadedObject($this->cms)) { $this->ssl = true; } parent::init(); $this->canonicalRedirection(); // assignCase (1 = CMS page, 2 = CMS category) if (Validate::isLoadedObject($this->cms)) { $adtoken = Tools::getAdminToken('AdminCmsContent' . (int) Tab::getIdFromClassName('AdminCmsContent') . (int) Tools::getValue('id_employee')); if (!$this->cms->isAssociatedToShop() || !$this->cms->active && Tools::getValue('adtoken') != $adtoken) { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); } else { $this->assignCase = 1; } } elseif (Validate::isLoadedObject($this->cms_category)) { $this->assignCase = 2; } else { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); } }
/** * Initialize stores controller * @see FrontController::init() */ public function init() { parent::init(); if (!extension_loaded('Dom')) { $this->errors[] = Tools::displayError('PHP "Dom" extension has not been loaded.'); $this->context->smarty->assign('errors', $this->errors); } }
public function init() { parent::init(); AuthController::requireLogin(); AuthController::requireShopSession(); Shop::getInstance()->requireOpenShop(); $this->setSmarty(); }
/** * Initialize guest tracking controller * @see FrontController::init() */ public function init() { $this->display_column_left = false; parent::init(); if ($this->context->customer->isLogged()) { Tools::redirect('history.php'); } }
/** * Initialize stores controller * @see FrontController::init() */ public function init() { parent::init(); // StarterTheme: Remove check when google maps v3 is done if (!extension_loaded('Dom')) { $this->errors[] = Tools::displayError('PHP "Dom" extension has not been loaded.'); $this->context->smarty->assign('errors', $this->errors); } }
/** * @inheritdoc */ public function init() { parent::init(); $this->module = Module::getInstanceByName(Tools::getValue('module')); if (!$this->module->active) { Tools::redirect('index.php'); } $this->initContent(); }
/** * Initialize cart controller * @see FrontController::init() */ public function init() { parent::init(); // Get page main parameters $this->id_product = (int) Tools::getValue('id_product', null); $this->id_product_attribute = (int) Tools::getValue('id_product_attribute', Tools::getValue('ipa')); $this->customization_id = (int) Tools::getValue('id_customization'); $this->qty = abs(Tools::getValue('qty', 1)); $this->id_address_delivery = (int) Tools::getValue('id_address_delivery'); }
/** * Initialize search controller * @see FrontController::init() */ public function init() { parent::init(); $this->instant_search = Tools::getValue('instantSearch'); $this->ajax_search = Tools::getValue('ajaxSearch'); if ($this->instant_search || $this->ajax_search) { $this->display_header = false; $this->display_footer = false; } }
/** * Initialize auth controller * @see FrontController::init() */ public function init() { parent::init(); if (!Tools::getIsset('step') && $this->context->customer->isLogged() && !$this->ajax) { Tools::redirect('index.php?controller=' . ($this->authRedirection !== false ? urlencode($this->authRedirection) : 'my-account')); } if (Tools::getValue('create_account')) { $this->create_account = true; } }
/** * Initialize product controller * @see FrontController::init() */ public function init() { parent::init(); if ($id_product = (int) Tools::getValue('id_product')) { $this->product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id); } if (!Validate::isLoadedObject($this->product)) { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); } else { $this->canonicalRedirection(); } if (!Validate::isLoadedObject($this->product)) { $this->errors[] = Tools::displayError('Product not found'); } else { if (Pack::isPack((int) $this->product->id) && !Pack::isInStock((int) $this->product->id)) { $this->product->quantity = 0; } $this->product->description = $this->transformDescriptionWithImg($this->product->description); /* * If the product is associated to the shop * and is active or not active but preview mode (need token + file_exists) * allow showing the product * In all the others cases => 404 "Product is no longer available" */ if (!$this->product->isAssociatedToShop() || !$this->product->active && (Tools::getValue('adtoken') != Tools::getAdminToken('AdminProducts' . (int) Tab::getIdFromClassName('AdminProducts') . (int) Tools::getValue('id_employee')) || !file_exists(_PS_ROOT_DIR_ . '/' . Tools::getValue('ad') . '/index.php'))) { header('HTTP/1.1 404 page not found'); $this->errors[] = Tools::displayError('Product is no longer available.'); } else { if (!$this->product->checkAccess(isset($this->context->customer) ? $this->context->customer->id : 0)) { $this->errors[] = Tools::displayError('You do not have access to this product.'); } } // Load category if (isset($_SERVER['HTTP_REFERER']) && !strstr($_SERVER['HTTP_REFERER'], Tools::getHttpHost()) && preg_match('!^(.*)\\/([0-9]+)\\-(.*[^\\.])|(.*)id_category=([0-9]+)(.*)$!', $_SERVER['HTTP_REFERER'], $regs)) { // If the previous page was a category and is a parent category of the product use this category as parent category if (isset($regs[2]) && is_numeric($regs[2])) { if (Product::idIsOnCategoryId((int) $this->product->id, array('0' => array('id_category' => (int) $regs[2])))) { $this->category = new Category($regs[2], (int) $this->context->cookie->id_lang); } } else { if (isset($regs[5]) && is_numeric($regs[5])) { if (Product::idIsOnCategoryId((int) $this->product->id, array('0' => array('id_category' => (int) $regs[5])))) { $this->category = new Category($regs[5], (int) $this->context->cookie->id_lang); } } } } else { // Set default product category $this->category = new Category($this->product->id_category_default, (int) $this->context->cookie->id_lang); } } }
/** * Initialize cart controller * @see FrontController::init() */ public function init() { parent::init(); // Send noindex to avoid ghost carts by bots header('X-Robots-Tag: noindex, nofollow', true); // Get page main parameters $this->id_product = (int) Tools::getValue('id_product', null); $this->id_product_attribute = (int) Tools::getValue('id_product_attribute', Tools::getValue('ipa')); $this->customization_id = (int) Tools::getValue('id_customization'); $this->qty = abs(Tools::getValue('qty', 1)); $this->id_address_delivery = (int) Tools::getValue('id_address_delivery'); }
public function init() { //precedence order parent::init(); AuthController::requireLogin(); AuthController::requireShopSession(); Shop::getInstance()->requireOpenShop(); $formProcess = new FormProductProcess(); $this->verifyURLVars(); $this->requireActiveCategory(); $this->setSmarty(); }
/** * Initialize supplier controller * @see FrontController::init() */ public function init() { parent::init(); if ($id_supplier = (int) Tools::getValue('id_supplier')) { $this->supplier = new Supplier($id_supplier, $this->context->language->id); if (!Validate::isLoadedObject($this->supplier) || !$this->supplier->active) { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); $this->errors[] = Tools::displayError('The chosen supplier does not exist.'); } else { $this->canonicalRedirection(); } } }
/** * Initialize manufaturer controller * @see FrontController::init() */ public function init() { parent::init(); if ($id_manufacturer = Tools::getValue('id_manufacturer')) { $this->manufacturer = new Manufacturer((int) $id_manufacturer, $this->context->language->id); if (!Validate::isLoadedObject($this->manufacturer) || !$this->manufacturer->active || !$this->manufacturer->isAssociatedToShop()) { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); $this->errors[] = Tools::displayError('The manufacturer does not exist.'); } else { $this->canonicalRedirection(); } } }
/** * Initialize category controller * @see FrontController::init() */ public function init() { // Get category ID $id_category = (int) Tools::getValue('id_category'); if (!$id_category || !Validate::isUnsignedId($id_category)) { $this->errors[] = Tools::displayError('Missing category ID'); } // Instantiate category $this->category = new Category($id_category, $this->context->language->id); parent::init(); if (!$this->category->checkAccess($this->context->customer->id)) { $this->errors[] = Tools::displayError('You do not have access to this category.'); } }
/** * Initialize order confirmation controller * @see FrontController::init() */ public function init() { parent::init(); if (isset($this->context->cookie->{'url_confirmation'})) { unset($this->context->cookie->{'url_confirmation'}); } $this->id_cart = (int) Tools::getValue('id_cart', 0); $is_guest = false; /* check if the cart has been made by a Guest customer, for redirect link */ if (Cart::isGuestCartByCartId($this->id_cart)) { $is_guest = true; $redirectLink = 'index.php?controller=guest-tracking'; } else { $redirectLink = 'index.php?controller=history'; } $this->id_module = (int) Tools::getValue('id_module', 0); $this->id_order = Order::getOrderByCartId((int) $this->id_cart); $this->secure_key = Tools::getValue('key', false); $order = new Order((int) $this->id_order); if ($is_guest) { $customer = new Customer((int) $order->id_customer); $redirectLink .= '&id_order=' . $order->reference . '&email=' . urlencode($customer->email); } if (!$this->id_order || !$this->id_module || !$this->secure_key || empty($this->secure_key)) { Tools::redirect($redirectLink . (Tools::isSubmit('slowvalidation') ? '&slowvalidation' : '')); } $this->reference = $order->reference; if (!Validate::isLoadedObject($order) || $order->id_customer != $this->context->customer->id || $this->secure_key != $order->secure_key) { Tools::redirect($redirectLink); } $module = Module::getInstanceById((int) $this->id_module); if (isset($order->payment) && isset($module->displayName) && $order->payment != $module->displayName && !in_array($order->payment, $this->get_mediosp())) { Tools::redirect($redirectLink); } $url_banco2 = Tools::getValue('bankdest2', 0); $url_dec_64 = base64_decode(strtr($url_banco2, '-_,', '+/=')); if ($url_banco2 != false) { $this->url_banco = $url_dec_64; Tools::redirect($this->url_banco); } $URL_PAYMENT_RECEIPT_HTML = Tools::getValue('URL_PAYMENT_RECEIPT_HTML', 0); $url_iframe = base64_decode(strtr($URL_PAYMENT_RECEIPT_HTML, '-_,', '+/=')); if ($URL_PAYMENT_RECEIPT_HTML != false) { $this->url_iframe = $url_iframe; } }
/** * Initialize address controller * @see FrontController::init() */ public function init() { parent::init(); // Get address ID $id_address = 0; if ($this->ajax && Tools::isSubmit('type')) { if (Tools::getValue('type') == 'delivery' && isset($this->context->cart->id_address_delivery)) { $id_address = (int) $this->context->cart->id_address_delivery; } else { if (Tools::getValue('type') == 'invoice' && isset($this->context->cart->id_address_invoice) && $this->context->cart->id_address_invoice != $this->context->cart->id_address_delivery) { $id_address = (int) $this->context->cart->id_address_invoice; } } } else { $id_address = (int) Tools::getValue('id_address', 0); } // Initialize address if ($id_address) { $this->_address = new Address($id_address); if (Validate::isLoadedObject($this->_address) && Customer::customerHasAddress($this->context->customer->id, $id_address)) { if (Tools::isSubmit('delete')) { if ($this->context->cart->id_address_invoice == $this->_address->id) { unset($this->context->cart->id_address_invoice); } if ($this->context->cart->id_address_delivery == $this->_address->id) { unset($this->context->cart->id_address_delivery); } if ($this->_address->delete()) { Tools::redirect('index.php?controller=addresses'); } $this->errors[] = Tools::displayError('This address cannot be deleted.'); } } else { if ($this->ajax) { exit; } else { Tools::redirect('index.php?controller=addresses'); } } } }
/** * Initialize order confirmation controller. * * @see FrontController::init() */ public function init() { parent::init(); $this->id_cart = (int) Tools::getValue('id_cart', 0); $redirectLink = 'index.php?controller=history'; $this->id_module = (int) Tools::getValue('id_module', 0); $this->id_order = Order::getOrderByCartId((int) $this->id_cart); $this->secure_key = Tools::getValue('key', false); $order = new Order((int) $this->id_order); if (!$this->id_order || !$this->id_module || !$this->secure_key || empty($this->secure_key)) { Tools::redirect($redirectLink . (Tools::isSubmit('slowvalidation') ? '&slowvalidation' : '')); } $this->reference = $order->reference; if (!Validate::isLoadedObject($order) || $order->id_customer != $this->context->customer->id || $this->secure_key != $order->secure_key) { Tools::redirect($redirectLink); } $module = Module::getInstanceById((int) $this->id_module); if ($order->module != $module->name) { Tools::redirect($redirectLink); } $this->order_presenter = new OrderPresenter(); }
/** * Initialize order return controller * @see FrontController::init() */ public function init() { parent::init(); header('Cache-Control: no-cache, must-revalidate'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); if (!isset($_GET['id_order_return']) || !Validate::isUnsignedId($_GET['id_order_return'])) { $this->errors[] = Tools::displayError('Order ID required'); } else { $orderRet = new OrderReturn((int) $_GET['id_order_return']); if (Validate::isLoadedObject($orderRet) && $orderRet->id_customer == $this->context->cookie->id_customer) { $order = new Order((int) $orderRet->id_order); if (Validate::isLoadedObject($order)) { $state = new OrderReturnState((int) $orderRet->state); $this->context->smarty->assign(array('orderRet' => $orderRet, 'order' => $order, 'state_name' => $state->name[(int) $this->context->language->id], 'return_allowed' => false, 'products' => OrderReturn::getOrdersReturnProducts((int) $orderRet->id, $order), 'returnedCustomizations' => OrderReturn::getReturnedCustomizedProducts((int) $orderRet->id_order), 'customizedDatas' => Product::getAllCustomizedDatas((int) $order->id_cart))); } else { $this->errors[] = Tools::displayError('Cannot find the order return.'); } } else { $this->errors[] = Tools::displayError('Cannot find the order return.'); } } }
/** * Initialize cms controller * @see FrontController::init() */ public function init() { parent::init(); if ($id_cms = (int) Tools::getValue('id_cms')) { $this->cms = new CMS($id_cms, $this->context->language->id); } else { if ($id_cms_category = (int) Tools::getValue('id_cms_category')) { $this->cms_category = new CMSCategory($id_cms_category, $this->context->language->id); } } $this->canonicalRedirection(); /* assignCase (1 = CMS page, 2 = CMS category) */ if (Validate::isLoadedObject($this->cms) && ($this->cms->isAssociatedToShop() && $this->cms->active || Tools::getValue('adtoken') == Tools::getAdminToken('AdminCmsContent' . (int) Tab::getIdFromClassName('AdminCmsContent') . (int) Tools::getValue('id_employee')))) { $this->assignCase = 1; } else { if (Validate::isLoadedObject($this->cms_category)) { $this->assignCase = 2; } else { Tools::redirect('index.php?controller=404'); } } }
* * @author PaymentSense <*****@*****.**> * @copyright 2013 PaymentSense * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * This file is part of the Prestashop PaymentSense Re-Directed Payment Module See paymentsense.php for Licensing and support info. File Last Modified: 12/03/2013 - By Shaun Ponting - Opal Creations */ include dirname(__FILE__) . '/../../config/config.inc.php'; include dirname(__FILE__) . '/../../init.php'; include dirname(__FILE__) . '/paymentsense.php'; $paymentsense = new PaymentSense(); if ($paymentsense->active) { if ((int) Configuration::get('PS_REWRITING_SETTINGS') === 1) { $rewrited_url = __PS_BASE_URI__; } /*include(dirname(__FILE__).'/../../header.php');*/ $controller = new FrontController(); $controller->init(); $controller->initContent(); $controller->setMedia(); $controller->displayHeader(); if (!isset($link)) { $link = new Link(); } $smarty->assign('cartURL', $link->getPageLink('order.php?step=1')); $smarty->assign('contactURL', $link->getPageLink('contact-form.php')); $smarty->display(dirname(__FILE__) . '/views/templates/front/return.tpl'); $controller->displayFooter(); }
/** * Initialize order detail controller * @see FrontController::init() */ public function init() { parent::init(); header('Cache-Control: no-cache, must-revalidate'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); }