// Retro-compatibility fix of front controllers

This commit is contained in:
rMalie
2012-03-05 15:32:06 +00:00
parent 2db02b9ff7
commit 8a24c0a741
31 changed files with 62 additions and 31 deletions
+2 -1
View File
@@ -268,6 +268,8 @@ class AddressControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
/* Secure restriction for guest */ /* Secure restriction for guest */
if ($this->context->customer->is_guest) if ($this->context->customer->is_guest)
Tools::redirect('index.php?controller=addresses'); Tools::redirect('index.php?controller=addresses');
@@ -297,7 +299,6 @@ class AddressControllerCore extends FrontController
} }
$this->setTemplate(_PS_THEME_DIR_.'address.tpl'); $this->setTemplate(_PS_THEME_DIR_.'address.tpl');
parent::initContent();
} }
/** /**
+2 -1
View File
@@ -60,6 +60,8 @@ class AddressesControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
$total = 0; $total = 0;
$multiple_addresses_formated = array(); $multiple_addresses_formated = array();
$ordered_fields = array(); $ordered_fields = array();
@@ -102,7 +104,6 @@ class AddressesControllerCore extends FrontController
)); ));
$this->setTemplate(_PS_THEME_DIR_.'addresses.tpl'); $this->setTemplate(_PS_THEME_DIR_.'addresses.tpl');
parent::initContent();
} }
} }
+2 -1
View File
@@ -77,6 +77,8 @@ class AuthControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
$this->context->smarty->assign('genders', Gender::getGenders()); $this->context->smarty->assign('genders', Gender::getGenders());
$this->assignDate(); $this->assignDate();
@@ -146,7 +148,6 @@ class AuthControllerCore extends FrontController
die(Tools::jsonEncode($return)); die(Tools::jsonEncode($return));
} }
$this->setTemplate(_PS_THEME_DIR_.'authentication.tpl'); $this->setTemplate(_PS_THEME_DIR_.'authentication.tpl');
parent::initContent();
} }
/** /**
+2 -1
View File
@@ -31,6 +31,8 @@ class BestSalesControllerCore extends FrontController
public function initContent() public function initContent()
{ {
parent::initContent();
$this->productSort(); $this->productSort();
$nbProducts = (int)ProductSale::getNbSales(); $nbProducts = (int)ProductSale::getNbSales();
$this->pagination($nbProducts); $this->pagination($nbProducts);
@@ -43,7 +45,6 @@ class BestSalesControllerCore extends FrontController
)); ));
$this->setTemplate(_PS_THEME_DIR_.'best-sales.tpl'); $this->setTemplate(_PS_THEME_DIR_.'best-sales.tpl');
parent::initContent();
} }
public function setMedia() public function setMedia()
+2 -1
View File
@@ -88,6 +88,8 @@ class CategoryControllerCore extends FrontController
public function initContent() public function initContent()
{ {
parent::initContent();
if (isset($this->context->cookie->id_compare)) if (isset($this->context->cookie->id_compare))
$this->context->smarty->assign('compareProducts', CompareProduct::getCompareProducts((int)$this->context->cookie->id_compare)); $this->context->smarty->assign('compareProducts', CompareProduct::getCompareProducts((int)$this->context->cookie->id_compare));
@@ -116,7 +118,6 @@ class CategoryControllerCore extends FrontController
$this->setTemplate(_PS_THEME_DIR_.'category.tpl'); $this->setTemplate(_PS_THEME_DIR_.'category.tpl');
parent::initContent();
} }
/** /**
+2 -1
View File
@@ -80,6 +80,8 @@ class CmsControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
$parent_cat = new CMSCategory(1, $this->context->language->id); $parent_cat = new CMSCategory(1, $this->context->language->id);
$this->context->smarty->assign('id_current_lang', $this->context->language->id); $this->context->smarty->assign('id_current_lang', $this->context->language->id);
$this->context->smarty->assign('home_title', $parent_cat->name); $this->context->smarty->assign('home_title', $parent_cat->name);
@@ -107,6 +109,5 @@ class CmsControllerCore extends FrontController
} }
$this->setTemplate(_PS_THEME_DIR_.'cms.tpl'); $this->setTemplate(_PS_THEME_DIR_.'cms.tpl');
parent::initContent();
} }
} }
+2 -1
View File
@@ -74,6 +74,8 @@ class CompareControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
//Clean compare product table //Clean compare product table
CompareProduct::cleanCompareProducts('week'); CompareProduct::cleanCompareProducts('week');
@@ -153,7 +155,6 @@ class CompareControllerCore extends FrontController
$this->context->smarty->assign('hasProduct', $hasProduct); $this->context->smarty->assign('hasProduct', $hasProduct);
$this->setTemplate(_PS_THEME_DIR_.'products-comparison.tpl'); $this->setTemplate(_PS_THEME_DIR_.'products-comparison.tpl');
parent::initContent();
} }
} }
+2 -1
View File
@@ -203,6 +203,8 @@ class ContactControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
$this->assignOrderList(); $this->assignOrderList();
$email = Tools::safeOutput(Tools::getValue('from', $email = Tools::safeOutput(Tools::getValue('from',
@@ -226,7 +228,6 @@ class ContactControllerCore extends FrontController
)); ));
$this->setTemplate(_PS_THEME_DIR_.'contact-form.tpl'); $this->setTemplate(_PS_THEME_DIR_.'contact-form.tpl');
parent::initContent();
} }
/** /**
+2 -1
View File
@@ -38,6 +38,8 @@ class DiscountControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
$discounts = Discount::getCustomerDiscounts($this->context->language->id, $this->context->customer->id, true, false); $discounts = Discount::getCustomerDiscounts($this->context->language->id, $this->context->customer->id, true, false);
$nbDiscounts = 0; $nbDiscounts = 0;
foreach ($discounts as $discount) foreach ($discounts as $discount)
@@ -46,7 +48,6 @@ class DiscountControllerCore extends FrontController
$this->context->smarty->assign(array('nbDiscounts' => (int)($nbDiscounts), 'discount' => $discounts)); $this->context->smarty->assign(array('nbDiscounts' => (int)($nbDiscounts), 'discount' => $discounts));
$this->setTemplate(_PS_THEME_DIR_.'discount.tpl'); $this->setTemplate(_PS_THEME_DIR_.'discount.tpl');
parent::initContent();
} }
} }
@@ -96,6 +96,8 @@ class GuestTrackingControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
/* Handle brute force attacks */ /* Handle brute force attacks */
if (count($this->errors)) if (count($this->errors))
sleep(1); sleep(1);
@@ -105,7 +107,6 @@ class GuestTrackingControllerCore extends FrontController
'errors' => $this->errors, 'errors' => $this->errors,
)); ));
$this->setTemplate(_PS_THEME_DIR_.'guest-tracking.tpl'); $this->setTemplate(_PS_THEME_DIR_.'guest-tracking.tpl');
parent::initContent();
} }
/** /**
+2 -1
View File
@@ -50,6 +50,8 @@ class HistoryControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
if ($orders = Order::getCustomerOrders($this->context->customer->id)) if ($orders = Order::getCustomerOrders($this->context->customer->id))
foreach ($orders as &$order) foreach ($orders as &$order)
{ {
@@ -64,7 +66,6 @@ class HistoryControllerCore extends FrontController
)); ));
$this->setTemplate(_PS_THEME_DIR_.'history.tpl'); $this->setTemplate(_PS_THEME_DIR_.'history.tpl');
parent::initContent();
} }
} }
+2 -1
View File
@@ -98,6 +98,8 @@ class IdentityControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
if ($this->customer->birthday) if ($this->customer->birthday)
$birthday = explode('-', $this->customer->birthday); $birthday = explode('-', $this->customer->birthday);
else else
@@ -118,7 +120,6 @@ class IdentityControllerCore extends FrontController
$this->context->smarty->assign('newsletter', (int)Module::getInstanceByName('blocknewsletter')->active); $this->context->smarty->assign('newsletter', (int)Module::getInstanceByName('blocknewsletter')->active);
$this->setTemplate(_PS_THEME_DIR_.'identity.tpl'); $this->setTemplate(_PS_THEME_DIR_.'identity.tpl');
parent::initContent();
} }
public function setMedia() public function setMedia()
+2 -1
View File
@@ -35,8 +35,9 @@ class IndexControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
$this->context->smarty->assign('HOOK_HOME', Hook::exec('displayHome')); $this->context->smarty->assign('HOOK_HOME', Hook::exec('displayHome'));
$this->setTemplate(_PS_THEME_DIR_.'index.tpl'); $this->setTemplate(_PS_THEME_DIR_.'index.tpl');
parent::initContent();
} }
} }
+2 -1
View File
@@ -70,6 +70,8 @@ class ManufacturerControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
if (Validate::isLoadedObject($this->manufacturer) && $this->manufacturer->active && $this->manufacturer->isAssociatedToGroupShop()) if (Validate::isLoadedObject($this->manufacturer) && $this->manufacturer->active && $this->manufacturer->isAssociatedToGroupShop())
{ {
$this->productSort(); $this->productSort();
@@ -81,7 +83,6 @@ class ManufacturerControllerCore extends FrontController
$this->assignAll(); $this->assignAll();
$this->setTemplate(_PS_THEME_DIR_.'manufacturer-list.tpl'); $this->setTemplate(_PS_THEME_DIR_.'manufacturer-list.tpl');
} }
parent::initContent();
} }
/** /**
+2 -1
View File
@@ -44,6 +44,8 @@ class MyAccountControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
$has_address = $this->context->customer->getAddresses($this->context->language->id); $has_address = $this->context->customer->getAddresses($this->context->language->id);
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'has_customer_an_address' => empty($has_address), 'has_customer_an_address' => empty($has_address),
@@ -53,7 +55,6 @@ class MyAccountControllerCore extends FrontController
$this->context->smarty->assign('HOOK_CUSTOMER_ACCOUNT', Hook::exec('displayCustomerAccount')); $this->context->smarty->assign('HOOK_CUSTOMER_ACCOUNT', Hook::exec('displayCustomerAccount'));
$this->setTemplate(_PS_THEME_DIR_.'my-account.tpl'); $this->setTemplate(_PS_THEME_DIR_.'my-account.tpl');
parent::initContent();
} }
} }
+2 -1
View File
@@ -41,6 +41,8 @@ class NewProductsControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
$this->productSort(); $this->productSort();
$nbProducts = (int)Product::getNewProducts( $nbProducts = (int)Product::getNewProducts(
@@ -60,7 +62,6 @@ class NewProductsControllerCore extends FrontController
)); ));
$this->setTemplate(_PS_THEME_DIR_.'new-products.tpl'); $this->setTemplate(_PS_THEME_DIR_.'new-products.tpl');
parent::initContent();
} }
} }
@@ -70,6 +70,8 @@ class OrderConfirmationControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'is_guest' => $this->context->customer->is_guest, 'is_guest' => $this->context->customer->is_guest,
'HOOK_ORDER_CONFIRMATION' => $this->displayOrderConfirmation(), 'HOOK_ORDER_CONFIRMATION' => $this->displayOrderConfirmation(),
@@ -87,7 +89,6 @@ class OrderConfirmationControllerCore extends FrontController
} }
$this->setTemplate(_PS_THEME_DIR_.'order-confirmation.tpl'); $this->setTemplate(_PS_THEME_DIR_.'order-confirmation.tpl');
parent::initContent();
} }
/** /**
+2 -1
View File
@@ -92,6 +92,8 @@ class OrderControllerCore extends ParentOrderController
{ {
global $isVirtualCart; global $isVirtualCart;
parent::initContent();
if (Tools::isSubmit('ajax') && Tools::getValue('method') == 'updateExtraCarrier') if (Tools::isSubmit('ajax') && Tools::getValue('method') == 'updateExtraCarrier')
{ {
// Change virtualy the currents delivery options // Change virtualy the currents delivery options
@@ -186,7 +188,6 @@ class OrderControllerCore extends ParentOrderController
'currencyFormat' => $this->context->currency->format, 'currencyFormat' => $this->context->currency->format,
'currencyBlank' => $this->context->currency->blank, 'currencyBlank' => $this->context->currency->blank,
)); ));
parent::initContent();
} }
protected function processAddressFormat() protected function processAddressFormat()
+2 -1
View File
@@ -132,6 +132,8 @@ class OrderDetailControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
if (!($id_order = (int)Tools::getValue('id_order')) || !Validate::isUnsignedId($id_order)) if (!($id_order = (int)Tools::getValue('id_order')) || !Validate::isUnsignedId($id_order))
$this->errors[] = Tools::displayError('Order ID required'); $this->errors[] = Tools::displayError('Order ID required');
else else
@@ -204,7 +206,6 @@ class OrderDetailControllerCore extends FrontController
} }
$this->setTemplate(_PS_THEME_DIR_.'order-detail.tpl'); $this->setTemplate(_PS_THEME_DIR_.'order-detail.tpl');
parent::initContent();
} }
public function setMedia() public function setMedia()
+2 -1
View File
@@ -78,6 +78,8 @@ class OrderFollowControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
$ordersReturn = OrderReturn::getOrdersReturn($this->context->customer->id); $ordersReturn = OrderReturn::getOrdersReturn($this->context->customer->id);
if (Tools::isSubmit('errorQuantity')) if (Tools::isSubmit('errorQuantity'))
$this->context->smarty->assign('errorQuantity', true); $this->context->smarty->assign('errorQuantity', true);
@@ -93,7 +95,6 @@ class OrderFollowControllerCore extends FrontController
$this->context->smarty->assign('ordersReturn', $ordersReturn); $this->context->smarty->assign('ordersReturn', $ordersReturn);
$this->setTemplate(_PS_THEME_DIR_.'order-follow.tpl'); $this->setTemplate(_PS_THEME_DIR_.'order-follow.tpl');
parent::initContent();
} }
public function setMedia() public function setMedia()
+2 -1
View File
@@ -271,6 +271,8 @@ class OrderOpcControllerCore extends ParentOrderController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
// SHOPPING CART // SHOPPING CART
$this->_assignSummaryInformations(); $this->_assignSummaryInformations();
// WRAPPING AND TOS // WRAPPING AND TOS
@@ -324,7 +326,6 @@ class OrderOpcControllerCore extends ParentOrderController
$this->_processAddressFormat(); $this->_processAddressFormat();
$this->setTemplate(_PS_THEME_DIR_.'order-opc.tpl'); $this->setTemplate(_PS_THEME_DIR_.'order-opc.tpl');
parent::initContent();
} }
protected function _getGuestInformations() protected function _getGuestInformations()
+2 -1
View File
@@ -78,12 +78,13 @@ class OrderReturnControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
$this->context->smarty->assign(array( $this->context->smarty->assign(array(
'errors' => $this->errors, 'errors' => $this->errors,
'nbdaysreturn' => (int)(Configuration::get('PS_ORDER_RETURN_NB_DAYS')) 'nbdaysreturn' => (int)(Configuration::get('PS_ORDER_RETURN_NB_DAYS'))
)); ));
$this->setTemplate(_PS_THEME_DIR_.'order-return.tpl'); $this->setTemplate(_PS_THEME_DIR_.'order-return.tpl');
parent::initContent();
} }
public function displayAjax() public function displayAjax()
+2 -1
View File
@@ -47,9 +47,10 @@ class OrderSlipControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
$this->context->smarty->assign('ordersSlip', OrderSlip::getOrdersSlip((int)$this->context->cookie->id_customer)); $this->context->smarty->assign('ordersSlip', OrderSlip::getOrdersSlip((int)$this->context->cookie->id_customer));
$this->setTemplate(_PS_THEME_DIR_.'order-slip.tpl'); $this->setTemplate(_PS_THEME_DIR_.'order-slip.tpl');
parent::initContent();
} }
} }
+2 -1
View File
@@ -36,8 +36,9 @@ class PageNotFoundControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
$this->setTemplate(_PS_THEME_DIR_.'404.tpl');
parent::initContent(); parent::initContent();
$this->setTemplate(_PS_THEME_DIR_.'404.tpl');
} }
} }
+2 -1
View File
@@ -111,8 +111,9 @@ class PasswordControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
$this->setTemplate(_PS_THEME_DIR_.'password.tpl');
parent::initContent(); parent::initContent();
$this->setTemplate(_PS_THEME_DIR_.'password.tpl');
} }
} }
+2 -1
View File
@@ -41,6 +41,8 @@ class PricesDropControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
$this->productSort(); $this->productSort();
$nbProducts = Product::getPricesDrop($this->context->language->id, null, null, true); $nbProducts = Product::getPricesDrop($this->context->language->id, null, null, true);
$this->pagination($nbProducts); $this->pagination($nbProducts);
@@ -53,7 +55,6 @@ class PricesDropControllerCore extends FrontController
)); ));
$this->setTemplate(_PS_THEME_DIR_.'prices-drop.tpl'); $this->setTemplate(_PS_THEME_DIR_.'prices-drop.tpl');
parent::initContent();
} }
} }
+2 -1
View File
@@ -132,6 +132,8 @@ class ProductControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
if (!$this->errors) if (!$this->errors)
{ {
// Assign to the template the id of the virtual product. "0" if the product is not downloadable. // Assign to the template the id of the virtual product. "0" if the product is not downloadable.
@@ -228,7 +230,6 @@ class ProductControllerCore extends FrontController
$this->context->smarty->assign('errors', $this->errors); $this->context->smarty->assign('errors', $this->errors);
$this->setTemplate(_PS_THEME_DIR_.'product.tpl'); $this->setTemplate(_PS_THEME_DIR_.'product.tpl');
parent::initContent();
} }
/** /**
+2 -1
View File
@@ -56,6 +56,8 @@ class SearchControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
$query = urldecode(Tools::getValue('q')); $query = urldecode(Tools::getValue('q'));
if ($this->ajax_search) if ($this->ajax_search)
{ {
@@ -122,7 +124,6 @@ class SearchControllerCore extends FrontController
$this->context->smarty->assign('add_prod_display', Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY')); $this->context->smarty->assign('add_prod_display', Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'));
$this->setTemplate(_PS_THEME_DIR_.'search.tpl'); $this->setTemplate(_PS_THEME_DIR_.'search.tpl');
parent::initContent();
} }
public function displayHeader($display = true) public function displayHeader($display = true)
+2 -1
View File
@@ -42,6 +42,8 @@ class SitemapControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
$this->context->smarty->assign('categoriesTree', Category::getRootCategory()->recurseLiteCategTree(0)); $this->context->smarty->assign('categoriesTree', Category::getRootCategory()->recurseLiteCategTree(0));
$this->context->smarty->assign('categoriescmsTree', CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1)); $this->context->smarty->assign('categoriescmsTree', CMSCategory::getRecurseCategory($this->context->language->id, 1, 1, 1));
$this->context->smarty->assign('voucherAllowed', (int)Configuration::get('PS_VOUCHERS')); $this->context->smarty->assign('voucherAllowed', (int)Configuration::get('PS_VOUCHERS'));
@@ -54,6 +56,5 @@ class SitemapControllerCore extends FrontController
$this->context->smarty->assign('display_store', Configuration::get('PS_STORES_DISPLAY_SITEMAP')); $this->context->smarty->assign('display_store', Configuration::get('PS_STORES_DISPLAY_SITEMAP'));
$this->setTemplate(_PS_THEME_DIR_.'sitemap.tpl'); $this->setTemplate(_PS_THEME_DIR_.'sitemap.tpl');
parent::initContent();
} }
} }
+2 -1
View File
@@ -238,6 +238,8 @@ class StoresControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
if (Configuration::get('PS_STORES_SIMPLIFIED')) if (Configuration::get('PS_STORES_SIMPLIFIED'))
$this->assignStoresSimplified(); $this->assignStoresSimplified();
else else
@@ -251,7 +253,6 @@ class StoresControllerCore extends FrontController
)); ));
$this->setTemplate(_PS_THEME_DIR_.'stores.tpl'); $this->setTemplate(_PS_THEME_DIR_.'stores.tpl');
parent::initContent();
} }
public function setMedia() public function setMedia()
+2 -1
View File
@@ -72,6 +72,8 @@ class SupplierControllerCore extends FrontController
*/ */
public function initContent() public function initContent()
{ {
parent::initContent();
if (Validate::isLoadedObject($this->supplier) && $this->supplier->active && $this->supplier->isAssociatedToGroupShop()) if (Validate::isLoadedObject($this->supplier) && $this->supplier->active && $this->supplier->isAssociatedToGroupShop())
{ {
$this->productSort(); // productSort must be called before assignOne $this->productSort(); // productSort must be called before assignOne
@@ -83,7 +85,6 @@ class SupplierControllerCore extends FrontController
$this->assignAll(); $this->assignAll();
$this->setTemplate(_PS_THEME_DIR_.'supplier-list.tpl'); $this->setTemplate(_PS_THEME_DIR_.'supplier-list.tpl');
} }
parent::initContent();
} }
/** /**