本文整理汇总了PHP中FrontController::preProcess方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontController::preProcess方法的具体用法?PHP FrontController::preProcess怎么用?PHP FrontController::preProcess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrontController
的用法示例。
在下文中一共展示了FrontController::preProcess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
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;
}
}
示例2: preProcess
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;
}
示例3: preProcess
public function preProcess()
{
parent::preProcess();
if (self::$cookie->isLogged()) {
Tools::redirect('history.php');
}
}
示例4: preProcess
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) {
}
}
}
示例5: preProcess
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();
}
示例6: 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);
}
}
示例7: preProcess
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');
}
}
示例8: preProcess
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);
}
}
}
示例9: preProcess
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);
}
示例10: preProcess
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);
}
}
示例11: preProcess
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);
}
示例12: preProcess
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);
}
示例13: preProcess
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;
}
示例14: preProcess
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();
}
示例15: 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;
}