public function preProcess() { parent::preProcess(); $customer = new Customer((int) self::$cookie->id_customer); if ($idAdd = Tools::getValue('add')) { $res = Db::getInstance()->ExecuteS("insert into ps_wishlist(id_customer, id_product) values(" . self::$cookie->id_customer . ", " . $idAdd . ")"); Tools::captureActivity(PSTAT_ADD_WL, $idAdd); Tools::redirect('wishlist.php'); } if ($idDelete = Tools::getValue('delete')) { $res = Db::getInstance()->ExecuteS("delete from ps_wishlist where id_customer = " . self::$cookie->id_customer . " and id_product = " . $idDelete); Tools::captureActivity(PSTAT_DEL_WL, $idDelete); Tools::redirect('wishlist.php'); } $sql = "select id_product from ps_wishlist where id_customer = " . self::$cookie->id_customer; $res = Db::getInstance()->ExecuteS($sql); if ($res) { $productIds = array(); foreach ($res as $row) { $productIds[] = $row['id_product']; } $total_found = 0; try { $wishlist_products = SolrSearch::getProductsForIDs($productIds, $total_found, 1, 100); self::$smarty->assign('wishlist_products', $wishlist_products); } catch (Exception $e) { } } }
function displayProcess($payerID) { global $cookie; $cookie->paypal_token = strval($cookie->paypal_token); $cookie->paypal_payer_id = $payerID; Tools::redirect('order.php?step=1&back=paypal'); }
public function postProcess() { $cart = $this->context->cart; if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) { Tools::redirect('index.php?controller=order&step=1'); } // Check that this payment option is still available in case the customer changed his address just before the end of the checkout process $authorized = false; foreach (Module::getPaymentModules() as $module) { if ($module['name'] == 'cheque') { $authorized = true; break; } } if (!$authorized) { die($this->module->l('This payment method is not available.', 'validation')); } $customer = new Customer($cart->id_customer); if (!Validate::isLoadedObject($customer)) { Tools::redirect('index.php?controller=order&step=1'); } $currency = $this->context->currency; $total = (double) $cart->getOrderTotal(true, Cart::BOTH); $mailVars = array('{cheque_name}' => Configuration::get('CHEQUE_NAME'), '{cheque_address}' => Configuration::get('CHEQUE_ADDRESS'), '{cheque_address_html}' => str_replace("\n", '<br />', Configuration::get('CHEQUE_ADDRESS'))); $this->module->validateOrder((int) $cart->id, Configuration::get('PS_OS_CHEQUE'), $total, $this->module->displayName, NULL, $mailVars, (int) $currency->id, false, $customer->secure_key); Tools::redirect('index.php?controller=order-confirmation&id_cart=' . (int) $cart->id . '&id_module=' . (int) $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key); }
/** * @see FrontController::postProcess() */ public function postProcess() { $cart = $this->context->cart; if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) { Tools::redirect('index.php?controller=order&step=1'); } // Check that this payment option is still available in case the customer changed his address just before the end of the checkout process $authorized = false; foreach (Module::getPaymentModules() as $module) { if ($module['name'] == 'bankpermata') { $authorized = true; break; } } if (!$authorized) { die($this->module->getTranslator()->trans('This payment method is not available.', array(), 'Modules.BankPermata.Shop')); } $customer = new Customer($cart->id_customer); if (!Validate::isLoadedObject($customer)) { Tools::redirect('index.php?controller=order&step=1'); } $currency = $this->context->currency; $total = (double) $cart->getOrderTotal(true, Cart::BOTH); $mailVars = array('{bankpermata_owner}' => Configuration::get('BANK_PERMATA_OWNER'), '{bankpermata_details}' => nl2br(Configuration::get('BANK_PERMATA_DETAILS')), '{bankpermata_address}' => nl2br(Configuration::get('BANK_PERMATA_ADDRESS'))); $this->module->validateOrder($cart->id, Configuration::get('PS_OS_BANKPERMATA'), $total, $this->module->displayName, NULL, $mailVars, (int) $currency->id, false, $customer->secure_key); Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart->id . '&id_module=' . $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key); }
public function preProcess() { parent::preProcess(); if (self::$cookie->isLogged()) { Tools::redirect('history.php'); } }
public function preProcess() { if (!Tools::hasFunction('admin_list')) { Tools::redirect('index.php'); } $this->brandNavi[] = array("name" => "Admin List", "url" => $this->php_self); $idList = $_POST['idlist'] == '' ? '' : $_POST['idlist']; if (Tools::isSubmit("delete")) { if (is_array($idList)) { foreach ($idList as $aid) { Member::DeleteMember($aid); } } exit; } else { if (Tools::isSubmit("del_permanent")) { if (is_array($idList)) { foreach ($idList as $aid) { Member::DeleteMemberPermanent($aid); } } exit; } else { if (Tools::isSubmit("undel")) { if (is_array($idList)) { foreach ($idList as $aid) { Member::UnDeleteMember($aid); } } exit; } } } }
public function preProcess() { parent::preProcess(); $this->id_cart = (int) Tools::getValue('id_cart', 0); /* check if the cart has been made by a Guest customer, for redirect link */ if (Cart::isGuestCartByCartId($this->id_cart)) { $redirectLink = 'guest-tracking.php'; } else { $redirectLink = 'history.php'; } $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); if (!$this->id_order or !$this->id_module or !$this->secure_key or empty($this->secure_key)) { Tools::redirect($redirectLink . (Tools::isSubmit('slowvalidation') ? '?slowvalidation' : '')); } $order = new Order((int) $this->id_order); if (!Validate::isLoadedObject($order) or $order->id_customer != self::$cookie->id_customer or $this->secure_key != $order->secure_key) { Tools::redirect($redirectLink); } $module = Module::getInstanceById((int) $this->id_module); if ($order->payment != $module->displayName) { Tools::redirect($redirectLink); } }
/** * This method is called when the customer goes back to shop, after he made a payment. * The customer will redirected either to the order confirmation page or to an error page * @return mixed */ public function postProcess() { require_once dirname(__FILE__) . '/../../api/loader.php'; $alipay = new Alipay(); $payment_response = new PaymentResponse(); $payment_response->getPostData(); if ($payment_response->getTradeStatus() == 'TRADE_FINISHED') { $payment_response->setIdModule($this->module->id); if (!$payment_response->processResponse()) { $errors = $payment_response->getErrors(); if ($errors) { foreach ($errors as $error) { $this->errors[] = $error; } return $this->setTemplate('error.tpl'); } } if ($payment_response->getIdOrder()) { $params = array('id_cart' => $payment_response->getIdCart(), 'id_module' => $payment_response->getIdModule(), 'id_order' => $payment_response->getIdOrder(), 'key' => $payment_response->getSecureKey()); $s = $this->context->link->getModuleLink('alipay', 'confirmation', $params); Tools::redirect($s); } else { $this->context->smarty->assign($payment_response->getTplVars()); return $this->setTemplate('check_order.tpl'); } } $this->errors[] = $alipay->l('An error occured. Please contact the merchant to have more informations'); return $this->setTemplate('error.tpl'); }
/** * @see FrontController::postProcess() */ public function postProcess() { $cart = $this->context->cart; if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) { Tools::redirect('index.php?controller=order&step=1'); } // Check that this payment option is still available in case the customer changed his address just before the end of the checkout process $authorized = false; foreach (Module::getPaymentModules() as $module) { if ($module['name'] == 'swipp') { $authorized = true; break; } } if (!$authorized) { die($this->module->l('This payment method is not available.', 'validation')); } $customer = new Customer($cart->id_customer); if (!Validate::isLoadedObject($customer)) { Tools::redirect('index.php?controller=order&step=1'); } $currency = $this->context->currency; $total = (double) $cart->getOrderTotal(true, Cart::BOTH); $mailVars = array('{swipp_phone}' => Configuration::get('SWIPP_PHONE'), '{swipp_owner}' => Configuration::get('SWIPP_OWNER'), '{swipp_payment_dkk}' => Tools::displayPrice($this->module->__getPriceDkk($cart), (int) Currency::getIdByIsoCode('DKK'))); $this->module->validateOrder($cart->id, Configuration::get('SWIPP_PAYMENT_STATE'), $total, $this->module->displayName, NULL, $mailVars, (int) $currency->id, false, $customer->secure_key); Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart->id . '&id_module=' . $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key); }
public function displayMain() { global $smarty, $link, $cookie; if ($cookie->logged) { Tools::redirect($link->getPage('MyaccountView')); } if (Tools::isSubmit('loginSubmit')) { if (Tools::getRequest('email') && Tools::getRequest('passwd')) { $user = new User(); if ($user->getByEmail(Tools::getRequest('email'), Tools::getRequest('passwd'))) { $user->logined(); if (Tools::G("step") == 2) { Tools::redirect($link->getPage('CheckoutView')); } else { Tools::redirect($link->getPage('MyaccountView')); } } else { $smarty->assign('errors', $user->_errors); } } else { $smarty->assign('errors', 'invalid email password combination'); } } return $smarty->fetch('login.tpl'); }
public function initContent() { $payu = new PayU(); $id_cart = Tools::getValue('id_cart'); $id_payu_session = $this->context->cookie->__get('payu_order_id'); if (Tools::getValue('error')) { Tools::redirect('order.php?error=' . Tools::getValue('error'), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); } $payu->id_cart = $id_cart; $payu->payu_order_id = $id_payu_session; $order_payment = $payu->getOrderPaymentBySessionId($payu->payu_order_id); $id_order = (int) $order_payment['id_order']; $payu->id_cart = (int) $order_payment['id_cart']; // if order not validated yet $cart_id = $payu->id_cart; if ($id_order == 0 && $order_payment['status'] == PayU::PAYMENT_STATUS_NEW) { $cart = new Cart($payu->id_cart); $cart_id = $cart->id; $payu->validateOrder($cart->id, (int) Configuration::get('PAYU_PAYMENT_STATUS_PENDING'), $cart->getOrderTotal(true, Cart::BOTH), $payu->displayName, 'PayU cart ID: ' . $cart_id . ', sessionId: ' . $payu->payu_order_id, null, (int) $cart->id_currency, false, $cart->secure_key, Context::getContext()->shop->id ? new Shop((int) Context::getContext()->shop->id) : null); $payu->id_order = $payu->current_order = $payu->{'currentOrder'}; $payu->updateOrderPaymentStatusBySessionId(PayU::PAYMENT_STATUS_INIT); } $id_order = $payu->getOrderIdBySessionId($id_payu_session); if (!empty($id_order)) { $payu->id_order = $id_order; $payu->updateOrderData(); } Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart_id, __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently'); }
private function accessRestriction() { if ($this->access_restriction && !Auth::getUser()) { Tools::redirect($this->context->link->getPageLink('auth')); } $this->smarty->assign('user', Auth::getUser()); }
public function postProcess() { $this->context->smarty->assign(array("cfmmsg_flag" => Tools::getValue("cfmmsg_flag"))); if (Tools::isSubmit("submitSellerAccount")) { AgileMultipleSeller::createSellerAccount(new Customer(self::$cookie->id_customer)); Tools::redirect(self::$link->getModuleLink("agilemultipleseller", "sellersummary", array("cfmmsg_flag" => 1), true)); } if (Tools::getValue("submitRequest") == "B2T") { $zbdpzet = "errmsg"; ${${"GLOBALS"}["uswhdzhd"]} = AgileMultipleSeller::convert_balance_to_token(self::$cookie->id_customer, (double) Tools::getValue("amount_to_convert"), $this->l('CHANGE BALANCE TO TOKENS')); if (!empty(${$zbdpzet})) { $this->errors[] = ${${"GLOBALS"}["uswhdzhd"]}; return; } Tools::redirect(self::$link->getModuleLink("agilemultipleseller", "sellersummary", array("cfmmsg_flag" => 1), true)); } if (Tools::getValue("submitRequest") == "MPR") { ${${"GLOBALS"}["uswhdzhd"]} = AgileMultipleSeller::make_fund_request(self::$cookie->id_customer, (double) Tools::getValue("amount_to_convert"), $this->l('MAKE FUND REQUEST')); if (!empty(${${"GLOBALS"}["uswhdzhd"]})) { $this->errors[] = ${${"GLOBALS"}["uswhdzhd"]}; return; } Tools::redirect(self::$link->getModuleLink("agilemultipleseller", "sellersummary", array("cfmmsg_flag" => 1), true)); } if (Tools::getValue("submitRequest") == "T2B") { ${"GLOBALS"}["jjycov"] = "errmsg"; ${${"GLOBALS"}["jjycov"]} = AgileMultipleSeller::convert_tokens_to_balance(self::$cookie->id_customer, (double) Tools::getValue("tokens_to_convert"), $this->l('CHANGE TOKENS TO BALANCE')); if (!empty(${${"GLOBALS"}["uswhdzhd"]})) { $this->errors[] = ${${"GLOBALS"}["uswhdzhd"]}; return; } Tools::redirect(self::$link->getModuleLink("agilemultipleseller", "sellersummary", array("cfmmsg_flag" => 1), true)); } }
public function displayMain() { global $smarty, $link, $cookie; $errors = false; if (!$cookie->logged || !User::checkPassword($cookie->id_user, $cookie->passwd)) { Tools::redirect($link->getPage('userView')); } $referer = Tools::Q('referer') ? $link->getPage(Tools::Q('referer')) : $link->getPage('MyAddressesView'); if ($id_address = Tools::Q('id')) { $address = new Address((int) $id_address); if (Tools::isSubmit('saveAddress')) { $address->copyFromPost(); if ($address->update()) { Tools::redirect($referer); } else { $errors = $address->_errors; } } $smarty->assign('address', $address); } elseif (Tools::isSubmit('saveAddress')) { $address = new Address(); $address->copyFromPost(); $address->id_user = $cookie->id_user; if ($address->add()) { Tools::redirect($referer); } else { $errors = $address->_errors; } } $countrys = Country::loadData(1, 1000, 'position', 'asc', array('active' => true)); $smarty->assign(array('referer' => Tools::Q('referer'), 'countrys' => $countrys, 'errors' => $errors)); return $smarty->fetch('address.tpl'); }
/** * @see FrontController::postProcess() */ public function postProcess() { $oplata = new Oplata(); if ($_POST['order_status'] == OplataCls::ORDER_DECLINED) { $this->errors[] = Tools::displayError('Order declined'); } $settings = array('merchant_id' => $oplata->getOption('merchant'), 'secret_key' => $oplata->getOption('secret_key')); $isPaymentValid = OplataCls::isPaymentValid($settings, $_POST); if ($isPaymentValid !== true) { $this->errors[] = Tools::displayError($isPaymentValid); } $cart = $this->context->cart; if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) { Tools::redirect('index.php?controller=order&step=1'); } $customer = new Customer($cart->id_customer); if (!Validate::isLoadedObject($customer)) { Tools::redirect('index.php?controller=order&step=1'); } if (empty($this->errors)) { list($orderId, ) = explode(OplataCls::ORDER_SEPARATOR, $_POST['order_id']); $history = new OrderHistory(); $history->id_order = $orderId; $history->changeIdOrderState((int) Configuration::get('PS_OS_PAYMENT'), $orderId); $history->addWithemail(true, array('order_name' => $orderId)); Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart->id . '&id_module=' . $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key); } }
public function init() { parent::init(); /* * Piqué dans le AuthController. J'aurais bien aimé utiliser le AuthController, mais le premier contrôle dans son init() * c'est pour vérifier si l'utilisateur est loggé ou non, ce qui mettait à plat ma stratégie. * * Je me suis posé la question 'Faut il que ca marche pour des admin ?', j'ai supposé que non, * mais s'il avait fallu, il suffisait de tester un 'Employee' en plus d'un 'Customer' */ $passwd = trim(Tools::getValue('passwd')); $_POST['passwd'] = null; $email = trim(Tools::getValue('email')); if (!empty($email) && Validate::isEmail($email) && !empty($passwd) && Validate::isPasswd($passwd)) { $customer = new Customer(); $authentication = $customer->getByEmail(trim($email), trim($passwd)); if (isset($authentication->active) && $authentication->active && $customer->id) { Tools::redirect(Configuration::get("ADMIN_TAB_MODULE_URLBACK")); } } /* * Ici, je ne suis vraiment pas satisfait de la méthode employée, je trouve ça plutôt crade * de transmettre des infos sur les erreurs via un param en GET, mais dans l'immédiat je n'ai pas trouvé mieux */ Tools::redirect("index.php?urlback_haserror=1"); }
/** * @see FrontController::postProcess() */ public function postProcess() { // if status == "success" $cart = $this->context->cart; if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) { Tools::redirect('index.php?controller=order&step=1'); } // Check that this payment option is still available in case the customer changed his address just before the end of the checkout process $authorized = false; foreach (Module::getPaymentModules() as $module) { if ($module['name'] == 'tinklit') { $authorized = true; break; } } if (!$authorized) { die($this->module->l('This payment method is not available.', 'validation')); } $customer = new Customer($cart->id_customer); if (!Validate::isLoadedObject($customer)) { Tools::redirect('index.php?controller=order&step=1'); } $currency = $this->context->currency; $total = (double) $cart->getOrderTotal(true, Cart::BOTH); $mailVars = array(); Tools::redirect('index.php?controller=order-confirmation&id_cart=' . (int) $cart->id . '&id_module=' . (int) $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key); }
private function _defineTplInformation() { $tplFile = array(); $tplVars = array(); if (\Session::isLogged()) { $this->wallabag->action($this->action, $this->url, $this->id, FALSE, $this->autoclose); $tplFile = Tools::getTplFile($this->view); $tplVars = array_merge($this->vars, $this->wallabag->displayView($this->view, $this->id)); } elseif (ALLOW_REGISTER && isset($_GET['registerform'])) { Tools::logm('register'); $tplFile = Tools::getTplFile('register'); } elseif (ALLOW_REGISTER && isset($_GET['register'])) { $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser'], $_POST['newuseremail']); Tools::redirect(); } elseif (isset($_SERVER['REMOTE_USER'])) { if ($this->wallabag->store->userExists($_SERVER['REMOTE_USER'])) { $this->wallabag->login($this->referer); } else { $this->wallabag->messages->add('e', _('login failed: user doesn\'t exist')); Tools::logm('user doesn\'t exist'); $tplFile = Tools::getTplFile('login'); $tplVars['http_auth'] = 1; } } else { $tplFile = Tools::getTplFile('login'); $tplVars['http_auth'] = 0; \Session::logout(); } $this->file = $tplFile; $this->vars = array_merge($this->defaultVars, $tplVars); }
/** * 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); } }
/** * Update language for current user * * @param $newLanguage */ public function updateLanguage($newLanguage) { # we are not going to change it to the current language if ($newLanguage == $this->getLanguage()) { $this->wallabag->messages->add('w', _('still using the "' . $this->getLanguage() . '" language!')); Tools::redirect('?view=config'); } $languages = $this->getInstalledLanguages(); $actualLanguage = false; foreach ($languages as $language) { if ($language['value'] == $newLanguage) { $actualLanguage = true; break; } } if (!$actualLanguage) { $this->wallabag->messages->add('e', _('that language does not seem to be installed')); Tools::redirect('?view=config'); } $this->wallabag->store->updateUserConfig($this->wallabag->user->getId(), 'language', $newLanguage); $this->wallabag->messages->add('s', _('you have changed your language preferences')); $currentConfig = $_SESSION['poche_user']->config; $currentConfig['language'] = $newLanguage; $_SESSION['poche_user']->setConfig($currentConfig); Tools::emptyCache(); Tools::redirect('?view=config'); }
public function postProcess() { $sid = Configuration::get('TWOCHECKOUTPP_SID'); $secret_word = Configuration::get('TWOCHECKOUTPP_SECRET'); $credit_card_processed = $_REQUEST['credit_card_processed']; $order_number = $_REQUEST['order_number']; $cart_id = $_REQUEST['merchant_order_id']; $cart = new Cart($cart_id); $checkout = new twocheckoutpp(); if (Configuration::get('TWOCHECKOUTPP_CURRENCY') > 0) { $amount = number_format($cart->getOrderTotal(true, 3), 2, '.', ''); $currency_from = Currency::getCurrency($cart->id_currency); $currency_to = Currency::getCurrency(Configuration::get('TWOCHECKOUTPP_CURRENCY')); $amount = Tools::ps_round($amount / $currency_from['conversion_rate'], 2); $total = number_format(Tools::ps_round($amount *= $currency_to['conversion_rate'], 2), 2, '.', ''); } else { $total = number_format($cart->getOrderTotal(true, 3), 2, '.', ''); } //Check the hash $compare_string = $secret_word . $sid . $order_number . $total; $compare_hash1 = strtoupper(md5($compare_string)); $compare_hash2 = $_REQUEST['key']; if ($compare_hash1 == $compare_hash2) { $customer = new Customer($cart->id_customer); $total = (double) $cart->getOrderTotal(true, Cart::BOTH); $checkout->validateOrder($cart_id, _PS_OS_PAYMENT_, $total, $checkout->displayName, '', array(), NULL, false, $customer->secure_key); $order = new Order($checkout->currentOrder); Tools::redirect('index.php?controller=order-confirmation&id_cart=' . (int) $cart->id . '&id_module=' . (int) $this->module->id . '&id_order=' . $checkout->currentOrder); } else { echo 'Hash Mismatch! Please contact the seller directly for assistance.</br>'; echo 'Total: ' . $total . '</br>'; echo '2CO Total: ' . $_REQUEST['total']; } }
/** * @see FrontController::postProcess() */ public function postProcess() { $cart = $this->context->cart; if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) { Tools::redirect('index.php?controller=order&step=1'); } // Check that this payment option is still available in case the customer changed his address just before the end of the checkout process $authorized = false; foreach (Module::getPaymentModules() as $module) { if ($module['name'] == 'paymentexample') { $authorized = true; break; } } if (!$authorized) { die($this->module->l('This payment method is not available.', 'validation')); } $this->context->smarty->assign(['params' => $_REQUEST]); $this->setTemplate('payment_return.tpl'); // $customer = new Customer($cart->id_customer); // if (!Validate::isLoadedObject($customer)) // Tools::redirect('index.php?controller=order&step=1'); // $currency = $this->context->currency; // $total = (float)$cart->getOrderTotal(true, Cart::BOTH); // $mailVars = array( // '{bankwire_owner}' => Configuration::get('BANK_WIRE_OWNER'), // '{bankwire_details}' => nl2br(Configuration::get('BANK_WIRE_DETAILS')), // '{bankwire_address}' => nl2br(Configuration::get('BANK_WIRE_ADDRESS')) // ); // $this->module->validateOrder($cart->id, Configuration::get('PS_OS_BANKWIRE'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key); // Tools::redirect('index.php?controller=order-confirmation&id_cart='.$cart->id.'&id_module='.$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key); }
/** * @see FrontController::initContent() */ public function initContent() { parent::initContent(); $shop_name = htmlentities(Configuration::get('PS_SHOP_NAME'), NULL, 'utf-8'); $shop_url = Tools::getHttpHost(true, true); $customer = Context::getContext()->customer; if (!preg_match("#.*\\.html\$#Ui", Tools::getValue('mail')) or !preg_match("#.*\\.html\$#Ui", Tools::getValue('mail'))) { die(Tools::redirect()); } $file = file_get_contents(dirname(__FILE__) . '/../../mails/' . strval(preg_replace('#\\.{2,}#', '.', Tools::getValue('mail')))); $file = str_replace('{shop_name}', $shop_name, $file); $file = str_replace('{shop_url}', $shop_url . __PS_BASE_URI__, $file); $file = str_replace('{shop_logo}', $shop_url . _PS_IMG_ . 'logo.jpg', $file); $file = str_replace('{firstname}', $customer->firstname, $file); $file = str_replace('{lastname}', $customer->lastname, $file); $file = str_replace('{email}', $customer->email, $file); $file = str_replace('{firstname_friend}', 'XXXXX', $file); $file = str_replace('{lastname_friend}', 'xxxxxx', $file); $file = str_replace('{link}', 'authentication.php?create_account=1', $file); $discount_type = (int) Configuration::get('REFERRAL_DISCOUNT_TYPE'); if ($discount_type == 1) { $file = str_replace('{discount}', Discount::display((double) Configuration::get('REFERRAL_PERCENTAGE'), $discount_type, new Currency($this->context->currency->id)), $file); } else { $file = str_replace('{discount}', Discount::display((double) Configuration::get('REFERRAL_DISCOUNT_VALUE_' . $this->context->currency->id), $discount_type, new Currency($this->context->currency->id)), $file); } $this->context->smarty->assign(array('content' => $file)); $this->setTemplate('email.tpl'); }
public function postProcess() { // Update the cart ONLY if $this->cookies are available, in order to avoid ghost carts created by bots if ($this->context->cookie->exists() && !$this->errors && !($this->context->customer->isLogged() && !$this->isTokenValid())) { if (Tools::getIsset('add') || Tools::getIsset('update')) { $this->processChangeProductInCart(); } elseif (Tools::getIsset('delete')) { $this->processDeleteProductInCart(); } elseif (Tools::getIsset('changeAddressDelivery')) { $this->processChangeProductAddressDelivery(); } elseif (Tools::getIsset('allowSeperatedPackage')) { $this->processAllowSeperatedPackage(); } elseif (Tools::getIsset('duplicate')) { $this->processDuplicateProduct(); } // Make redirection if (!$this->errors && !$this->ajax) { $queryString = Tools::safeOutput(Tools::getValue('query', null)); if ($queryString && !Configuration::get('PS_CART_REDIRECT')) { Tools::redirect('index.php?controller=search&search=' . $queryString); } // Redirect to previous page if (isset($_SERVER['HTTP_REFERER'])) { preg_match('!http(s?)://(.*)/(.*)!', $_SERVER['HTTP_REFERER'], $regs); if (isset($regs[3]) && !Configuration::get('PS_CART_REDIRECT')) { Tools::redirect($_SERVER['HTTP_REFERER']); } } Tools::redirect('index.php?controller=order&' . (isset($this->id_product) ? 'ipa=' . $this->id_product : '')); } } elseif (!$this->isTokenValid()) { Tools::redirect('index.php'); } }
public function init() { if (!$this->context->customer->isLogged()) { Tools::redirect('index.php?controller=authentication&back=modules/referralprogram/referralprogram-program.php'); } parent::init(); }
public function enterAction() { $config = Config::share(); if (!empty($_POST['systemPass'])) { if (empty($config['systemPass'])) { $config['systemPass'] = password_hash($_POST['systemPass'], PASSWORD_DEFAULT); $config['installed'] = true; Config::save('share', $config); } if (password_verify($_POST['systemPass'], $config['systemPass'])) { $_SESSION['systemLogin'] = 1; } else { if (empty($config['failTry'])) { $config['failTry'] = 1; } else { $config['failTry']++; } Config::save('share', $config); } Tools::redirect('/setup'); } if (!empty($config['systemPass']) && !empty($_COOKIE['systemPass']) && $_COOKIE['systemPass'] == $config['systemPass']) { Tools::redirect('/setup'); } $this->view->setTitle('Enter'); $this->view->page(); }
/** * Initialize guest tracking controller * @see FrontController::init() */ public function init() { parent::init(); if ($this->context->customer->isLogged()) { Tools::redirect('history.php'); } }
public function postProcess() { ${"GLOBALS"}["blpimnned"] = "id_order_seller"; $dbodbxes = "id_order"; ${${"GLOBALS"}["qusrvgm"]} = (int) Tools::getValue("id_order"); if (!$this->context->customer->isLogged() && !Tools::getValue("secure_key")) { Tools::redirect("index.php?controller=authentication&back=my-account"); } ${"GLOBALS"}["tvasln"] = "id_order"; $jpdhpfqcj = "id_order"; if (!(int) Configuration::get("PS_INVOICE")) { die(Tools::displayError("Invoices are disabled in this shop.")); } if (isset(${${"GLOBALS"}["qusrvgm"]}) && Validate::isUnsignedId(${$dbodbxes})) { ${${"GLOBALS"}["ymjzko"]} = new Order(${$jpdhpfqcj}); } if (!isset(${${"GLOBALS"}["ymjzko"]}) || !Validate::isLoadedObject(${${"GLOBALS"}["ymjzko"]})) { die(Tools::displayError("Invoice not found")); } ${${"GLOBALS"}["vewtbt"]} = AgileSellerManager::getObjectOwnerID("order", ${${"GLOBALS"}["tvasln"]}); ${${"GLOBALS"}["sokafjqdei"]} = AgileSellerManager::getLinkedSellerID($this->context->customer->id); if (${${"GLOBALS"}["blpimnned"]} != ${${"GLOBALS"}["sokafjqdei"]}) { die(Tools::displayError("You do not have permission to see this invoice")); } if (Tools::isSubmit("secure_key") && $order->secure_key != Tools::getValue("secure_key")) { die(Tools::displayError("You do not have permission to see this invoice")); } if (!OrderState::invoiceAvailable($order->getCurrentState()) && !$order->invoice_number) { die(Tools::displayError("No invoice available")); } $this->order = ${${"GLOBALS"}["ymjzko"]}; }
public function initContent() { if (Configuration::get('PS_DISPLAY_BEST_SELLERS')) { parent::initContent(); $this->productSort(); $nb_products = (int) ProductSale::getNbSales(); $this->pagination($nb_products); if (!Tools::getValue('orderby')) { $this->orderBy = 'sales'; } $products = ProductSale::getBestSales($this->context->language->id, $this->p - 1, $this->n, $this->orderBy, $this->orderWay); $this->addColorsToProductList($products); /************************* /Images Array ******************************/ if (method_exists('Product', 'getProductsImgs')) { $image_array = array(); for ($i = 0; $i < $nb_products; $i++) { if (isset($products[$i]['id_product'])) { $image_array[$products[$i]['id_product']] = Product::getProductsImgs($products[$i]['id_product']); } } $this->context->smarty->assign('productimg', (isset($image_array) and $image_array) ? $image_array : NULL); } /************************* /Images Array ******************************/ $this->context->smarty->assign(array('products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'nbProducts' => $nb_products, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), 'comparator_max_item' => Configuration::get('PS_COMPARATOR_MAX_ITEM'))); $this->setTemplate(_PS_THEME_DIR_ . 'best-sales.tpl'); } else { Tools::redirect('index.php?controller=404'); } }
/** * @return Redirect */ public function postProcess() { /* @var $cart CartCore */ $cart = $this->context->cart; $chargeId = Tools::getValue('changeId'); if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active || !$chargeId) { Tools::redirect('index.php?controller=order&step=1'); } /* @var $this->module->gateway \SecurionPay\SecurionPayGateway */ $charge = $this->module->gateway->retrieveCharge($chargeId); if (!$charge) { throw new \UnexpectedValueException($this->module->l('Charge is not set', 'payment')); } $metadata = $this->resolveMetadata($charge); // Check that this payment option is still available // in case the customer changed his address just before // the end of the checkout process $this->validatePaymentOption(); $customer = new Customer($cart->id_customer); if (!Validate::isLoadedObject($customer)) { Tools::redirect('index.php?controller=order&step=1'); } $this->validateOrder($charge, $customer->secure_key, $cart->id); // update metadata $metadata[self::METADATA_ORDER_ID] = $this->module->currentOrder; $metadata[self::METADATA_ORDER_REFERENCE] = $this->module->currentOrderReference; $chargeUpdate = new \SecurionPay\Request\ChargeUpdateRequest(); $chargeUpdate->chargeId($chargeId)->metadata($metadata); $this->module->gateway->updateCharge($chargeUpdate); $this->updatePaymentDetails($charge); // redirect to order-confirmation page Tools::redirect('index.php?controller=order-confirmation' . '&id_cart=' . $cart->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key); }