From fc71efe424529ef4bd2cb76c6705ae618bb6b47c Mon Sep 17 00:00:00 2001 From: mDeflotte Date: Thu, 29 Sep 2011 12:58:08 +0000 Subject: [PATCH] //ModuleController+MyAccountController+NewProductsController+OrderConfirmationController : Refacto done --- controllers/front/ModuleController.php | 4 ++++ controllers/front/MyAccountController.php | 4 ++++ controllers/front/NewProductsController.php | 6 +++++- controllers/front/OrderConfirmationController.php | 12 ++++++++++-- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/controllers/front/ModuleController.php b/controllers/front/ModuleController.php index 65e5bf845..578d76b1c 100644 --- a/controllers/front/ModuleController.php +++ b/controllers/front/ModuleController.php @@ -33,6 +33,10 @@ */ class ModuleControllerCore extends FrontController { + /** + * Assign template vars related to page content + * @see FrontController::process() + */ public function process() { // Check module existence diff --git a/controllers/front/MyAccountController.php b/controllers/front/MyAccountController.php index e10b3264f..d9dedfb09 100644 --- a/controllers/front/MyAccountController.php +++ b/controllers/front/MyAccountController.php @@ -38,6 +38,10 @@ class MyAccountControllerCore extends FrontController $this->addCSS(_THEME_CSS_DIR_.'my-account.css'); } + /** + * Assign template vars related to page content + * @see FrontController::process() + */ public function process() { $this->context->smarty->assign(array( diff --git a/controllers/front/NewProductsController.php b/controllers/front/NewProductsController.php index 0cd337dc9..3694b017e 100644 --- a/controllers/front/NewProductsController.php +++ b/controllers/front/NewProductsController.php @@ -35,11 +35,15 @@ class NewProductsControllerCore extends FrontController $this->addCSS(_THEME_CSS_DIR_.'product_list.css'); } + /** + * Assign template vars related to page content + * @see FrontController::process() + */ public function process() { $this->productSort(); - $nbProducts = (int)Product::getNewProducts($this->context->language->id, (isset($this->p) ? (int)($this->p) - 1 : NULL), (isset($this->n) ? (int)($this->n) : NULL), true); + $nbProducts = (int)Product::getNewProducts($this->context->language->id, (isset($this->p) ? (int)($this->p) - 1 : null), (isset($this->n) ? (int)($this->n) : null), true); $this->pagination($nbProducts); $this->context->smarty->assign(array( diff --git a/controllers/front/OrderConfirmationController.php b/controllers/front/OrderConfirmationController.php index 504ab5ef5..7f7f0492c 100644 --- a/controllers/front/OrderConfirmationController.php +++ b/controllers/front/OrderConfirmationController.php @@ -34,6 +34,10 @@ class OrderConfirmationControllerCore extends FrontController public $id_order; public $secure_key; + /** + * Initialize order confirmation controller + * @see FrontController::init() + */ public function init() { parent::init(); @@ -49,17 +53,21 @@ class OrderConfirmationControllerCore extends FrontController $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)) + if (!$this->id_order || !$this->id_module || !$this->secure_key || 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 != $this->context->customer->id OR $this->secure_key != $order->secure_key) + 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); } + /** + * Assign template vars related to page content + * @see FrontController::process() + */ public function process() { $this->context->smarty->assign(array(