public function preProcess() { parent::preProcess(); //echo "vao day";die; if (Tools::isSubmit("getPopHotel")) { $areaid = Tools::getValue("areaid"); // Get Popular Hotel List $poList = HotelDetail::getPopularHotelList($areaid); $popularList = array(); global $cookie; $iso = Language::getIsoById((int) $cookie->LanguageID); foreach ($poList as $popular) { $image = HotelDetail::getFirstFileOfHotel($popular['HotelId'], 150, 150); if (is_file(_TAS_ROOT_DIR_ . "/asset/" . $image['w5_path'])) { $popular['HotelFilePath'] = $image['w5_path']; $popular['w5'] = $image['w5']; $popular['h5'] = $image['h5']; } $popular['LowestPrice'] = HotelDetail::getLowestPriceOfHotel($popular['HotelId']); $popular['AreaName'] = HotelDetail::getAreaName($popular['HotelArea']); $HotelNameKey = 'HotelName_' . $iso; $popular['HotelName'] = $popular[$HotelNameKey]; $popularList[] = $popular; } self::$smarty->assign("popularList", $popularList); self::$smarty->display(_TAS_THEME_DIR_ . 'homepage_popitem.tpl'); exit; } }
public function preProcess() { parent::preProcess(); $file_id = $_REQUEST['fid']; /* $file = UPLOAD_DIR.'/homepage_adimg.jpg'; echo $file; if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); ob_clean(); flush(); readfile($file); exit; } */ exit; }
public function preProcess() { parent::preProcess(); if (self::$cookie->isLogged()) { Tools::redirect('history.php'); } }
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) { } } }
public function preProcess() { global $cart; if ($id_product = (int) Tools::getValue('id_product')) { $this->product = new Product($id_product, true, self::$cookie->id_lang); } if (Tools::isSubmit('ajax')) { if (Tools::isSubmit('submitCustomizedDatas')) { $this->pictureUpload($this->product, $cart); $this->textRecord($this->product, $cart); $this->formTargetFormat(); } if (count($this->errors)) { die(Tools::jsonEncode(array('hasErrors' => true, 'errors' => $this->errors))); } else { die(Tools::jsonEncode(array('hasErrors' => false, 'conf' => Tools::displayError('Customization saved successfully.')))); } } if (!Validate::isLoadedObject($this->product)) { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); } else { $this->canonicalRedirection(); } parent::preProcess(); }
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); } }
public function preProcess() { parent::preProcess(); //Add or remove product with Ajax if (Tools::getValue('ajax') and Tools::getValue('id_product') and Tools::getValue('action')) { if (Tools::getValue('action') == 'add') { if (isset(self::$cookie->id_customer)) { if (CompareProduct::getCustomerNumberProducts(self::$cookie->id_customer) < Configuration::get('PS_COMPARATOR_MAX_ITEM')) { CompareProduct::addCustomerCompareProduct((int) self::$cookie->id_customer, (int) Tools::getValue('id_product')); } else { die('0'); } } else { if (isset(self::$cookie->id_guest) and CompareProduct::getGuestNumberProducts(self::$cookie->id_guest) < Configuration::get('PS_COMPARATOR_MAX_ITEM')) { CompareProduct::addGuestCompareProduct((int) self::$cookie->id_guest, (int) Tools::getValue('id_product')); } else { die('0'); } } } elseif (Tools::getValue('action') == 'remove') { if (isset(self::$cookie->id_customer)) { CompareProduct::removeCustomerCompareProduct((int) self::$cookie->id_customer, (int) Tools::getValue('id_product')); } elseif (isset(self::$cookie->id_guest)) { CompareProduct::removeGuestCompareProduct((int) self::$cookie->id_guest, (int) Tools::getValue('id_product')); } else { die('0'); } } else { die('0'); } die('1'); } }
public function preProcess() { if ($id_category = (int) Tools::getValue('id_category')) { $this->category = new Category($id_category, self::$cookie->id_lang); } if (!Validate::isLoadedObject($this->category)) { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); } else { // Automatically redirect to the canonical URL if the current in is the right one // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain $currentURL = self::$link->getCategoryLink($this->category); $currentURL = preg_replace('/[?&].*$/', '', $currentURL); if (!preg_match('/^' . Tools::pRegexp($currentURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) { header('HTTP/1.0 301 Moved'); if (defined('_PS_MODE_DEV_') and _PS_MODE_DEV_) { die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $currentURL . '">' . $currentURL . '</a>'); } Tools::redirectLink($currentURL); } } parent::preProcess(); if ((int) Configuration::get('PS_REWRITING_SETTINGS')) { if ($id_category = (int) Tools::getValue('id_category')) { $rewrite_infos = Category::getUrlRewriteInformations((int) $id_category); $default_rewrite = array(); foreach ($rewrite_infos as $infos) { $default_rewrite[$infos['id_lang']] = self::$link->getCategoryLink((int) $id_category, $infos['link_rewrite'], $infos['id_lang']); } self::$smarty->assign('lang_rewrite_urls', $default_rewrite); } } }
public function preProcess() { parent::preProcess(); $customer = new Customer((int) self::$cookie->id_customer); if (isset($_POST['years']) && isset($_POST['months']) && isset($_POST['days'])) { $customer->birthday = (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days']; } if (Tools::isSubmit('submitIdentity')) { if (Module::getInstanceByName('blocknewsletter')->active) { if (!isset($_POST['optin'])) { $customer->optin = 0; } if (!isset($_POST['newsletter'])) { $customer->newsletter = 0; } } if (!isset($_POST['id_gender'])) { $_POST['id_gender'] = 9; } if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) { $this->errors[] = Tools::displayError('Invalid date of birth'); } else { $customer->birthday = empty($_POST['years']) ? '' : (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days']; $id_customer_exists = (int) Customer::customerExists(Tools::getValue('email'), true, false); if ($id_customer_exists && $id_customer_exists != (int) self::$cookie->id_customer) { $this->errors[] = Tools::displayError('An account is already registered with this e-mail.'); } $_POST['old_passwd'] = trim($_POST['old_passwd']); if (empty($_POST['old_passwd']) || Tools::encrypt($_POST['old_passwd']) != self::$cookie->passwd) { $this->errors[] = Tools::displayError('Your password is incorrect.'); } elseif ($_POST['passwd'] != $_POST['confirmation']) { $this->errors[] = Tools::displayError('Password and confirmation do not match'); } else { $prev_id_default_group = $customer->id_default_group; $this->errors = array_unique(array_merge($this->errors, $customer->validateController(true, true))); } if (!count($this->errors)) { $customer->id_default_group = (int) $prev_id_default_group; $customer->firstname = Tools::ucfirst(Tools::strtolower($customer->firstname)); if (Tools::getValue('passwd')) { self::$cookie->passwd = $customer->passwd; } if ($customer->update()) { self::$cookie->customer_lastname = $customer->lastname; self::$cookie->customer_firstname = $customer->firstname; self::$smarty->assign('confirmation', 1); } else { $this->errors[] = Tools::displayError('Cannot update information'); } } } } else { $_POST = array_map('stripslashes', $customer->getFields()); } $birthday = $customer->birthday ? explode('-', $customer->birthday) : array('-', '-', '-'); /* Generate years, months and days */ self::$smarty->assign(array('years' => Tools::dateYears(), 'sl_year' => $birthday[0], 'months' => Tools::dateMonths(), 'sl_month' => $birthday[1], 'days' => Tools::dateDays(), 'sl_day' => $birthday[2], 'errors' => $this->errors)); self::$smarty->assign('newsletter', (int) Module::getInstanceByName('blocknewsletter')->active); }
public function preProcess() { parent::preProcess(); if (self::$cookie->RoleID == 1) { $this->mid = self::$cookie->HotelID; } else { $this->mid = Tools::getValue("mid"); } /*else { $error['no'] = 1; $error['message'] = 'User can not access this page'; self::$smarty->assign("error", $error); self::$smarty->display(_TAS_THEME_DIR_.'error_redirect.tpl'); exit(); } */ // $this->mid = Tools::getValue("mid")!="" ? Tools::getValue("mid") : ((self::$cookie->RoleID==1) ? self::$cookie->HotelID : ""); if ((self::$cookie->RoleID == 1 || (self::$cookie->RoleID == 4 || self::$cookie->RoleID == 5)) && $_GET['setOrder']) { $hotel_roomplan_list = RoomPlan::getRoomPlanListDetailByHotelIdHotelAndAdmin($this->mid); print_r($hotel_roomplan_list); $order_list = explode(",", trim($_REQUEST['orderList'], ',')); $new_orders = array(); foreach ($order_list as $key => $rpid) { $new_orders[$rpid] = $key + 1; } foreach ($hotel_roomplan_list as $roomplan) { $rpid = $roomplan['RoomPlanId']; $rp_order = 1; // default order value is 1 if (array_key_exists($rpid, $new_orders)) { $rp_order = $new_orders[$rpid]; } $sql = "\n\t\t\t\t\tUPDATE HT_HotelRoomPlanLink SET ShowOrder = {$rp_order} WHERE RoomPlanId = {$rpid}\n\t\t\t\t"; Db::getInstance()->ExecuteS($sql); } $search_form['HotelId'] = $this->mid; $continentCode = Tools::getUserContinentCode(self::$cookie->CompanyID); if (self::$cookie->RoleID == 2 || self::$cookie->RoleID == 3) { $search_form['ContinentCode'] = $continentCode; $search_form['Role'] = 'Agent'; } $hotel_roomplan_count = RoomPlan::searchHotelRoomPlanCount($search_form); parent::pagination($hotel_roomplan_count); $hotel_roomplan_list = RoomPlan::searchHotelRoomPlan($search_form, $this->p, $this->n); // $hotel_roomplan_list = RoomPlan::getRoomPlanListDetailByHotelId($this->mid); self::$smarty->assign("hotel_roomplan_list", $hotel_roomplan_list); self::$smarty->assign("mid", $this->mid); self::$smarty->display(_TAS_THEME_DIR_ . 'hotelpage_roomplan_list.tpl'); exit; } if (self::$cookie->RoleID > 1) { global $cookie; $iso = Language::getIsoById((int) $cookie->LanguageID); $hotel = new HotelDetail($this->mid); $HotelNameKey = 'HotelName_' . $iso; $this->brandNavi[] = array("name" => $hotel->{$HotelNameKey}, "url" => "hotelpage.php?mid=" . $this->mid); } }
public function preProcess() { parent::preProcess(); $customer = new Customer((int) self::$cookie->id_customer); if (sizeof($_POST)) { $exclusion = array('secure_key', 'old_passwd', 'passwd', 'active', 'date_add', 'date_upd', 'last_passwd_gen', 'newsletter_date_add', 'id_default_group'); $fields = $customer->getFields(); foreach ($fields as $key => $value) { if (!in_array($key, $exclusion)) { $customer->{$key} = key_exists($key, $_POST) ? trim($_POST[$key]) : 0; } } } if (isset($_POST['years']) and isset($_POST['months']) and isset($_POST['days'])) { $customer->birthday = (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days']; } if (Tools::isSubmit('submitIdentity')) { if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) and !(Tools::getValue('months') == '' and Tools::getValue('days') == '' and Tools::getValue('years') == '')) { $this->errors[] = Tools::displayError('Invalid date of birth'); } else { $customer->birthday = empty($_POST['years']) ? '' : (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days']; $_POST['old_passwd'] = trim($_POST['old_passwd']); if (empty($_POST['old_passwd']) or Tools::encrypt($_POST['old_passwd']) != self::$cookie->passwd) { $this->errors[] = Tools::displayError('Your password is incorrect.'); } elseif ($_POST['passwd'] != $_POST['confirmation']) { $this->errors[] = Tools::displayError('Password and confirmation do not match'); } else { $prev_id_default_group = $customer->id_default_group; $this->errors = $customer->validateControler(); } if (!sizeof($this->errors)) { $customer->id_default_group = (int) $prev_id_default_group; $customer->firstname = Tools::ucfirst(Tools::strtolower($customer->firstname)); if (Tools::getValue('passwd')) { self::$cookie->passwd = $customer->passwd; } if ($customer->update()) { self::$cookie->customer_lastname = $customer->lastname; self::$cookie->customer_firstname = $customer->firstname; self::$smarty->assign('confirmation', 1); } else { $this->errors[] = Tools::displayError('Cannot update information'); } } } } else { $_POST = array_map('stripslashes', $customer->getFields()); } if ($customer->birthday) { $birthday = explode('-', $customer->birthday); } else { $birthday = array('-', '-', '-'); } /* Generate years, months and days */ self::$smarty->assign(array('years' => Tools::dateYears(), 'sl_year' => $birthday[0], 'months' => Tools::dateMonths(), 'sl_month' => $birthday[1], 'days' => Tools::dateDays(), 'sl_day' => $birthday[2], 'errors' => $this->errors)); self::$smarty->assign('newsletter', (int) Module::getInstanceByName('blocknewsletter')->active); }
public function preProcess() { parent::preProcess(); if (Tools::isSubmit('submitReturnMerchandise')) { $customizationQtyInput = Tools::getValue('customization_qty_input'); if (!($id_order = (int) Tools::getValue('id_order'))) { Tools::redirect('history.php'); } if (!($order_qte_input = Tools::getValue('order_qte_input'))) { Tools::redirect('order-follow.php?errorDetail1'); } if ($customizationIds = Tools::getValue('customization_ids') and !$customizationQtyInput) { Tools::redirect('order-follow.php?errorDetail1'); } if (!($ids_order_detail = Tools::getValue('ids_order_detail')) and !$customizationIds) { Tools::redirect('order-follow.php?errorDetail2'); } $order = new Order((int) $id_order); if (!$order->isReturnable()) { Tools::redirect('order-follow.php?errorNotReturnable'); } if ($order->id_customer != self::$cookie->id_customer) { die(Tools::displayError()); } $orderReturn = new OrderReturn(); $orderReturn->id_customer = (int) self::$cookie->id_customer; $orderReturn->id_order = $id_order; $orderReturn->question = strval(Tools::getValue('returnText')); if (empty($orderReturn->question)) { Tools::redirect('order-follow.php?errorMsg'); } if (!$orderReturn->checkEnoughProduct($ids_order_detail, $order_qte_input, $customizationIds, $customizationQtyInput)) { Tools::redirect('order-follow.php?errorQuantity'); } $orderReturn->state = 1; $orderReturn->add(); $orderReturn->addReturnDetail($ids_order_detail, $order_qte_input, $customizationIds, $customizationQtyInput); Module::hookExec('orderReturn', array('orderReturn' => $orderReturn)); Tools::redirect('order-follow.php'); } $ordersReturn = OrderReturn::getOrdersReturn((int) self::$cookie->id_customer); if (Tools::isSubmit('errorQuantity')) { self::$smarty->assign('errorQuantity', true); } elseif (Tools::isSubmit('errorMsg')) { self::$smarty->assign('errorMsg', true); } elseif (Tools::isSubmit('errorDetail1')) { self::$smarty->assign('errorDetail1', true); } elseif (Tools::isSubmit('errorDetail2')) { self::$smarty->assign('errorDetail2', true); } elseif (Tools::isSubmit('errorNotReturnable')) { self::$smarty->assign('errorNotReturnable', true); } self::$smarty->assign('ordersReturn', $ordersReturn); }
public function preProcess() { parent::preProcess(); // if (!Tools::hasFunction('room_plan_edit')) Tools::redirect('index.php'); $rpid = Tools::getValue("rpid"); $roomplan_sales = RoomPlan::getRoomPlanSales($rpid); // $roomplan_sales['Nights'] =(strtotime($roomplan_sales['ConToTime']) - strtotime($roomplan_sales['ConFromTime'])) / (24 * 60 * 60); // diff day self::$smarty->assign("roomplan_sales", $roomplan_sales); parent::displayContent(); self::$smarty->display(_TAS_THEME_DIR_ . 'roomplan_sales.tpl'); exit; }
public function preProcess() { if ($id_category = (int) Tools::getValue('id_category')) { $this->category = new Category($id_category, self::$cookie->id_lang); } if (!Validate::isLoadedObject($this->category)) { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); } else { $this->canonicalRedirection(); } parent::preProcess(); }
public function preProcess() { parent::preProcess(); // if (!Tools::hasFunction('room_plan_edit')) Tools::redirect('index.php'); $rpid = Tools::getValue("rpid"); $price = Tools::getValue("price"); $roomplan_summary = RoomPlan::getRoomPlanSummary($rpid); self::$smarty->assign("roomplan_summary", $roomplan_summary); self::$smarty->assign('price', $price); parent::displayContent(); self::$smarty->display(_TAS_THEME_DIR_ . 'roomplan_summary.tpl'); exit; }
public function preProcess() { parent::preProcess(); try { $total_found = 0; $curated_products = SolrSearch::getCategoryProducts(CAT_CURATED, $brand_id = false, $total_found, $p = 1, $n = 500); $right_products = array_slice($curated_products, $total_found * 0.48); $left_products = array_slice($curated_products, 0, $total_found * 0.48); self::$smarty->assign('curated_products_right', $right_products); self::$smarty->assign('curated_products_left', $left_products); } catch (Exception $e) { } }
public function preProcess() { if ($id_manufacturer = (int) Tools::getValue('id_manufacturer')) { $this->manufacturer = new Manufacturer($id_manufacturer, self::$cookie->id_lang); if (!Validate::isLoadedObject($this->manufacturer) or !$this->manufacturer->active) { header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); $this->errors[] = Tools::displayError('Manufacturer does not exist.'); } else { $this->canonicalRedirection(); } } parent::preProcess(); }
public function preProcess() { parent::preProcess(); global $cookie; if (Tools::isSubmit("checkpass")) { $result = Member::checkReset($cookie->Email, Tools::getValue("password")); if ($result) { echo "true"; } else { echo "false"; } exit; } }
public function preProcess() { parent::preProcess(); if ($_REQUEST['booking'] == 'view') { //如果是查看订单 $orderId = $_GET['oid']; //获取订单编号 if ($_REQUEST['voucher']) { self::$smarty->assign("voucher", $_REQUEST['voucher']); } $error = Booking::checkUserCanViewOrder(self::$cookie->UserID, self::$cookie->RoleID, $orderId); //查看用户是否可以查看订单 } else { // other(build booking info from post variable for edit, confirm, finish) //或者是查看发票,或者是查看详细信息,或者是保存 $orderId = $_POST['order_id']; $error = Booking::checkUserCanEditOrder(self::$cookie->UserID, self::$cookie->RoleID, $orderId); } if ($error['no'] > 0) { self::$smarty->assign("error", $error); self::$smarty->display(_TAS_THEME_DIR_ . 'error_redirect.tpl'); exit; } if ($_REQUEST['booking'] == 'view') { // view page $this->brandNavi[] = array("name" => "Booking List", "url" => 'booking_list.php'); $booking_info = Booking::getBookingInfo($_GET['oid']); if (!$booking_info) { $booking_info = Booking::getBookingInfo_del($_GET['oid']); if (!$booking_info) { $error['no'] = 3; $error['message'] = 'There is no exist booking info'; self::$smarty->assign("error", $error); self::$smarty->display(_TAS_THEME_DIR_ . 'error_redirect.tpl'); exit; } } $this->brandNavi[] = array("name" => "Booking No:" . $booking_info['BookingNo'], "url" => 'booking_confirm.php?booking=view&oid=' . $booking_info['order_id'], "nolang" => 1); if ($_REQUEST['payment']) { self::$smarty->assign("payment", $_REQUEST['payment']); } self::$smarty->assign("method", 'view'); self::$smarty->assign("booking_info", $booking_info); self::$smarty->assign("payment_currency", DEFAULT_PAYMENT_CURRENCY); self::$smarty->assign("mail_address", DEFAULT_EMAIL_ADDRESS); self::$smarty->assign("env", DEFAULT_ENV); self::$smarty->assign("return_url", RETURN_URL); self::$smarty->assign("notify_url", NOTIFY_URL); } }
public function preProcess() { parent::preProcess(); $method = 'fullsized'; if ($_REQUEST['rpid']) { $rp_images = RoomFile::getRoomFileListByRoomPlanId($_REQUEST['rpid']); if (!rp_images) { exit; } $file_id = $rp_images[0]['RoomFileId']; $method = 'thumbs'; } else { $file_id = $_REQUEST['fid']; } $res = RoomFile::getRoomFile($file_id); if (!$res) { echo 'error'; exit; } $file = $res[0]['RoomFilePath']; //UPLOAD_DIR.'/homepage_adimg.jpg'; if ($method == 'thumbs') { $file = str_replace('/fullsized/', '/thumbs/', $file); } if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . basename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); ob_clean(); flush(); readfile($file); exit; } // $type = 'image/jpeg'; // header('Content-Type:'.$type); // header('Content-Length: '.filesize($file)); // $fp = fopen($file, 'rb'); // fpassthru($fp); //readfile($file); header('Location: /asset/' . $method . '/' . basename($file)); // echo filesize($file); exit; }
public function preProcess() { parent::preProcess(); $db = Db::getInstance(_PS_USE_SQL_SLAVE_); $res = $db->ExecuteS("SELECT \n\t\t\t\t\t\t\tdescription, \n\t\t\t\t\t\t\treference, \n\t\t\t\t\t\t\tdate_add, \n\t\t\t\t\t\t\tpoints_awarded, \n\t\t\t\t\t\t\tcoalesce(points_deducted, '-') as `points_deducted`, \n\t\t\t\t\t\t\tbalance FROM vb_customer_rewards WHERE id_customer = " . self::$cookie->id_customer . "\n\t\t\t\t\t\t\torder by id_reward desc"); self::$smarty->assign('vbpoints', $res); self::$smarty->assign('balance_points', VBRewards::getCustomerPoints(self::$cookie->id_customer)); self::$smarty->assign('redeemed_points', VBRewards::getCustomerPointsRedeemed(self::$cookie->id_customer)); self::$smarty->assign('earned_points', VBRewards::getCustomerPointsEarned(self::$cookie->id_customer)); self::$smarty->assign('reviews_approved', Customer::getTotalApprovedReviews(self::$cookie->id_customer)); self::$smarty->assign('social_points', $this->getSocialPoints()); $referrals = Customer::getCustomerReferrals(self::$cookie->id_customer); if ($referrals) { self::$smarty->assign('total_referred', count($referrals)); } }
public function preProcess() { if ($id_cms = (int) Tools::getValue('id_cms')) { $this->cms = new CMS($id_cms, self::$cookie->id_lang); } elseif ($id_cms_category = (int) Tools::getValue('id_cms_category')) { $this->cms_category = new CMSCategory($id_cms_category, self::$cookie->id_lang); } // Automatically redirect to the canonical URL if the current in is the right one // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain if ($this->cms and $canonicalURL = self::$link->getCMSLink($this->cms)) { if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) { header('HTTP/1.0 301 Moved'); if (defined(_PS_MODE_DEV_) and _PS_MODE_DEV_) { die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>'); } Tools::redirectLink($canonicalURL); } } if ($this->cms_category and $canonicalURL = self::$link->getCMSCategoryLink($this->cms_category)) { if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) { header('HTTP/1.0 301 Moved'); if (_PS_MODE_DEV_) { die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>'); } Tools::redirectLink($canonicalURL); } } parent::preProcess(); /* assignCase (1 = CMS page, 2 = CMS category) */ if (Validate::isLoadedObject($this->cms) and ($this->cms->active or Tools::getValue('adtoken') == Tools::encrypt('PreviewCMS' . $this->cms->id) and file_exists(dirname(__FILE__) . '/../' . Tools::getValue('ad') . '/ajax.php'))) { $this->assignCase = 1; } elseif (Validate::isLoadedObject($this->cms_category)) { $this->assignCase = 2; } else { Tools::redirect('404.php'); } if ((int) Configuration::get('PS_REWRITING_SETTINGS')) { $rewrite_infos = (isset($id_cms) and !isset($id_cms_category)) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category); $default_rewrite = array(); foreach ($rewrite_infos as $infos) { $arr_link = (isset($id_cms) and !isset($id_cms_category)) ? self::$link->getCMSLink($id_cms, $infos['link_rewrite'], $this->ssl, $infos['id_lang']) : self::$link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']); $default_rewrite[$infos['id_lang']] = $arr_link; } self::$smarty->assign('lang_rewrite_urls', $default_rewrite); } }
public function preProcess() { if ($id_cms = (int) Tools::getValue('id_cms')) { $this->cms = new CMS($id_cms, self::$cookie->id_lang); } elseif ($id_cms_category = (int) Tools::getValue('id_cms_category')) { $this->cms_category = new CMSCategory($id_cms_category, self::$cookie->id_lang); } $this->canonicalRedirection(); parent::preProcess(); /* assignCase (1 = CMS page, 2 = CMS category) */ if (Validate::isLoadedObject($this->cms) and ($this->cms->active or Tools::getValue('adtoken') == Tools::encrypt('PreviewCMS' . $this->cms->id) and file_exists(dirname(__FILE__) . '/../' . Tools::getValue('ad') . '/ajax.php'))) { $this->assignCase = 1; } elseif (Validate::isLoadedObject($this->cms_category)) { $this->assignCase = 2; } else { Tools::display404Error('404.php'); } }
public function preProcess() { parent::preProcess(); $query = urldecode(Tools::getValue('q')); if ($this->ajaxSearch) { self::$link = new Link(); $searchResults = Search::find((int) Tools::getValue('id_lang'), $query, 1, 10, 'position', 'desc', true); if (is_array($searchResults)) { foreach ($searchResults as &$product) { $product['product_link'] = self::$link->getProductLink($product['id_product'], $product['prewrite'], $product['crewrite']); } } die(Tools::jsonEncode($searchResults)); } elseif ($this->instantSearch && !is_array($query)) { $this->productSort(); $this->n = abs((int) Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE'))); $this->p = abs((int) Tools::getValue('p', 1)); $search = Search::find((int) self::$cookie->id_lang, $query, $this->p, $this->n, $this->orderBy, $this->orderWay); Module::hookExec('search', array('expr' => $query, 'total' => $search['total'])); $nbProducts = $search['total']; $this->pagination($nbProducts); self::$smarty->assign(array('products' => $search['result'], 'search_products' => $search['result'], 'nbProducts' => $search['total'], 'search_query' => $query, 'instantSearch' => $this->instantSearch, 'homeSize' => Image::getSize('home'))); } elseif ($query = Tools::getValue('search_query', Tools::getValue('ref')) and !is_array($query)) { $this->productSort(); $this->n = abs((int) Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE'))); $this->p = abs((int) Tools::getValue('p', 1)); $search = Search::find((int) self::$cookie->id_lang, $query, $this->p, $this->n, $this->orderBy, $this->orderWay); Module::hookExec('search', array('expr' => $query, 'total' => $search['total'])); $nbProducts = $search['total']; $this->pagination($nbProducts); self::$smarty->assign(array('products' => $search['result'], 'search_products' => $search['result'], 'nbProducts' => $search['total'], 'search_query' => $query, 'homeSize' => Image::getSize('home'))); } elseif ($tag = urldecode(Tools::getValue('tag')) and !is_array($tag)) { $this->productSort(); $nbProducts = (int) Search::searchTag((int) self::$cookie->id_lang, $tag, true); $this->pagination($nbProducts); $result = Search::searchTag((int) self::$cookie->id_lang, $tag, false, $this->p, $this->n, $this->orderBy, $this->orderWay); Module::hookExec('search', array('expr' => $tag, 'total' => sizeof($result))); self::$smarty->assign(array('search_tag' => $tag, 'products' => $result, 'search_products' => $result, 'nbProducts' => $nbProducts, 'homeSize' => Image::getSize('home'))); } else { self::$smarty->assign(array('products' => array(), 'search_products' => array(), 'pages_nb' => 1, 'nbProducts' => 0)); } self::$smarty->assign('add_prod_display', Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY')); }
public function preProcess() { if (!Tools::hasFunction("popular_area")) { Tools::redirect("index.php"); } $this->brandNavi[] = array("name" => "Popular Area Edit", "url" => $this->php_self); parent::preProcess(); if (Tools::isSubmit("Submit")) { $fidList = $_POST['fids'] == '' ? '' : $_POST['fids']; Db::getInstance()->Execute("update HT_Area set IsPopular = 0"); if (is_array($fidList)) { foreach ($fidList as $aid) { Db::getInstance()->Execute("update HT_Area set IsPopular = 1 where AreaId = " . $aid); } } } $areaList = Db::getInstance()->ExecuteS(' select *, AreaName_' . $this->iso . ' as AreaName from `HT_Area` where CountryId = 109'); self::$smarty->assign("areaList", $areaList); }
public function preProcess() { parent::preProcess(); if (!isset($_GET['id_order_return']) or !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) and $orderRet->id_customer == self::$cookie->id_customer) { $order = new Order((int) $orderRet->id_order); if (Validate::isLoadedObject($order)) { $state = new OrderReturnState((int) $orderRet->state); self::$smarty->assign(array('orderRet' => $orderRet, 'order' => $order, 'state_name' => $state->name[(int) self::$cookie->id_lang], '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 this order return'); } } else { $this->errors[] = Tools::displayError('Cannot find this order return'); } } self::$smarty->assign(array('errors' => $this->errors, 'nbdaysreturn' => (int) Configuration::get('PS_ORDER_RETURN_NB_DAYS'))); }
public function preProcess() { parent::preProcess(); $id_customer = self::$cookie->id_customer; $customer = new Customer($id_customer); $db = Db::getInstance(_PS_USE_SQL_SLAVE_); //self::$smarty->assign('display_thanks', 1); if (!Tools::isSubmit('submitFeedback')) { return; } $overall = Tools::getValue('overall'); $recommend = Tools::getValue('recommend'); $collection = Tools::getValue('collection'); $products = Tools::getValue('products'); $fitting = Tools::getValue('fitting'); $delivery = Tools::getValue('delivery'); $support = Tools::getValue('support'); $suggestions = Tools::getValue('suggestions'); $id_order = Tools::getValue('oid'); if (empty($id_order)) { $id_order = 0; } $suggestions = pSQL($suggestions); $query = 'INSERT INTO `ps_order_feedback`(id_customer, overall, recommend, collection, products, fitting, delivery, support, suggestion,id_order) values( ' . $id_customer . ', ' . $overall . ', ' . $recommend . ', ' . $collection . ', ' . $products . ', ' . $fitting . ', ' . $delivery . ', ' . $support . ', "' . $suggestions . '", ' . $id_order . ' )'; $db->Execute($query); Mail::Send(1, 'neworderfeedback', Mail::l('New Order Feedback'), array('{customer_name}' => $customer->firstname . ' - ' . $customer->email . ' - (Order Id # ' . $id_order . ')', '{$overall}' => $overall, '{$recommend}' => $recommend, '{$collection}' => $collection, '{$products}' => $products, '{$fitting}' => $fitting, '{$delivery}' => $delivery, '{$support}' => $support, '{$suggestions}' => $suggestions), array('*****@*****.**', '*****@*****.**', '*****@*****.**'), 'IndusDiva Order Feedback'); self::$smarty->assign('display_thanks', 1); Tools::sendSQSRuleMessage(EVENT_ORDER_FEEDBACK, $id_order, $cookie->id_customer, date('Y-m-d H:i:s')); }
public function preProcess() { parent::preProcess(); $unsubscribe_key = Tools::getValue('unsub_key', null); $unsubscribe_key = filter_var($unsubscribe_key, FILTER_SANITIZE_STRING); $success = false; if (!empty($unsubscribe_key)) { $customer = Customer::getCustomerByUnSubscribeKey($unsubscribe_key); if (!empty($customer) && Validate::isLoadedObject($customer)) { if (isset(self::$cookie->id_customer) && (int) $customer->id !== (int) self::$cookie->id_customer) { $success = false; } else { $customer->newsletter = 1; $customer->update(); $success = true; } } } if (!$success) { Tools::redirect('page-not-found'); } }
public function preProcess() { parent::preProcess(); $db = Db::getInstance(_PS_USE_SQL_SLAVE_); //self::$smarty->assign('display_thanks', 1); $phone = Tools::getValue('phone'); $country = Tools::getValue('country'); $enquiry = Tools::getValue('enquiry'); $name = Tools::getValue('name'); $email = Tools::getValue('email'); $enquiry = pSQL($enquiry); $query = 'INSERT INTO `ps_design_enquiries`(name, email, phone, country, enquiry) values( "' . $name . '", "' . $email . '", "' . $phone . '", "' . $country . '", "' . $enquiry . '" )'; $db->Execute($query); Mail::Send(1, 'designenquiry', Mail::l('New Design Enquiry'), array('{name}' => $name, '{email}' => $email, '{phone}' => $phone, '{country}' => $country, '{enquiry}' => $enquiry), array('*****@*****.**', '*****@*****.**'), 'IndusDiva Design Enquiry'); echo "success"; exit; }
public function preProcess() { parent::preProcess(); //Add or remove product with Ajax if (Tools::getValue('ajax') and Tools::getValue('id_product') and Tools::getValue('action')) { if (Tools::getValue('action') == 'add') { $id_compare = isset(self::$cookie->id_compare) ? self::$cookie->id_compare : false; if (CompareProduct::getNumberProducts($id_compare) < Configuration::get('PS_COMPARATOR_MAX_ITEM')) { CompareProduct::addCompareProduct($id_compare, (int) Tools::getValue('id_product')); } else { die('0'); } } elseif (Tools::getValue('action') == 'remove') { if (isset(self::$cookie->id_compare)) { CompareProduct::removeCompareProduct((int) self::$cookie->id_compare, (int) Tools::getValue('id_product')); } else { die('0'); } } else { die('0'); } die('1'); } }