当前位置: 首页>>代码示例>>PHP>>正文


PHP FrontController::init方法代码示例

本文整理汇总了PHP中FrontController::init方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontController::init方法的具体用法?PHP FrontController::init怎么用?PHP FrontController::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FrontController的用法示例。


在下文中一共展示了FrontController::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 /**
  * 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.'));
     }
 }
开发者ID:zangles,项目名称:lennyba,代码行数:11,代码来源:AddressesController.php

示例2: init

 public function init()
 {
     parent::init();
     AuthController::requireLogin();
     AuthController::requireShopSession();
     $this->setSmarty();
 }
开发者ID:ecuation,项目名称:Control-de-stock,代码行数:7,代码来源:SettignsController.php

示例3: init

 /**
  * 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);
     }
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:36,代码来源:OrderConfirmationController.php

示例4: init

 /**
  * Initialize guest tracking controller
  * @see FrontController::init()
  */
 public function init()
 {
     parent::init();
     if ($this->context->customer->isLogged()) {
         Tools::redirect('history.php');
     }
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:11,代码来源:GuestTrackingController.php

示例5: init

 /**
  * 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();
         }
     }
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:32,代码来源:OrderReturnController.php

示例6: init

 /**
  * 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;
         }
     }
 }
开发者ID:Beattle,项目名称:perrino-shop,代码行数:29,代码来源:CategoryController.php

示例7: init

 public function init()
 {
     parent::init();
     AuthController::getInstance()->requireLogin();
     ErrorHandler::getInstance()->getUrlErrorMessage();
     $this->setSmarty();
 }
开发者ID:ecuation,项目名称:Control-de-stock,代码行数:7,代码来源:Shop_selectionController.php

示例8: init

 public function init()
 {
     $this->attachBehavior('breadcrumbs', new CrumbsBehaviour());
     $this->breadcrumbs->setEnabled(true);
     $this->initProfile();
     parent::init();
 }
开发者ID:vasiliy-pdk,项目名称:aes,代码行数:7,代码来源:SocialController.php

示例9: 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');
     }
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:32,代码来源:CmsController.php

示例10: init

 /**
  * 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);
     }
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:12,代码来源:StoresController.php

示例11: init

 public function init()
 {
     parent::init();
     AuthController::requireLogin();
     AuthController::requireShopSession();
     Shop::getInstance()->requireOpenShop();
     $this->setSmarty();
 }
开发者ID:ecuation,项目名称:Control-de-stock,代码行数:8,代码来源:OverviewController.php

示例12: init

 /**
  * 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');
     }
 }
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:12,代码来源:GuestTrackingController.php

示例13: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->module = Module::getInstanceByName(Tools::getValue('module'));
     if (!$this->module->active) {
         Tools::redirect('index.php');
     }
     $this->initContent();
 }
开发者ID:silbersaiten,项目名称:nostotagging,代码行数:12,代码来源:module.php

示例14: init

 /**
  * 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');
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:14,代码来源:CartController.php

示例15: init

 /**
  * 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;
     }
 }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:14,代码来源:SearchController.php


注:本文中的FrontController::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。