diff --git a/controllers/admin/AdminCmsCategoriesController.php b/controllers/admin/AdminCmsCategoriesController.php index f841cba6a..236f83eba 100644 --- a/controllers/admin/AdminCmsCategoriesController.php +++ b/controllers/admin/AdminCmsCategoriesController.php @@ -52,6 +52,15 @@ class AdminCmsCategoriesControllerCore extends AdminController 'align' => 'center','type' => 'bool', 'orderby' => false )); + // The controller can't be call directly + // In this case, AdminCmsContentController::getCurrentCMSCategory() is null + if (!AdminCmsContentController::getCurrentCMSCategory()) + { + elog('rrrr'); + $this->redirect_after = '?controller=AdminCmsContent&token='.Tools::getAdminTokenLite('AdminCmsContent'); + $this->redirect(); + } + $this->cms_category = AdminCmsContentController::getCurrentCMSCategory(); $this->_filter = 'AND `id_parent` = '.(int)$this->cms_category->id; $this->_select = 'position '; diff --git a/controllers/admin/AdminCmsController.php b/controllers/admin/AdminCmsController.php index a213ca983..f33a12429 100644 --- a/controllers/admin/AdminCmsController.php +++ b/controllers/admin/AdminCmsController.php @@ -35,13 +35,13 @@ class AdminCmsControllerCore extends AdminController public function __construct() { - $this->table = 'cms'; - $this->className = 'CMS'; - $this->lang = true; + $this->table = 'cms'; + $this->className = 'CMS'; + $this->lang = true; $this->addRowAction('view'); $this->addRowAction('edit'); $this->addRowAction('delete'); - $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'))); + $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'))); $this->fields_list = array( 'id_cms' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), @@ -51,6 +51,15 @@ class AdminCmsControllerCore extends AdminController 'active' => array('title' => $this->l('Displayed'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false) ); + // The controller can't be call directly + // In this case, AdminCmsContentController::getCurrentCMSCategory() is null + if (!AdminCmsContentController::getCurrentCMSCategory()) + { + elog('rrrr'); + $this->redirect_after = '?controller=AdminCmsContent&token='.Tools::getAdminTokenLite('AdminCmsContent'); + $this->redirect(); + } + $this->_category = AdminCmsContentController::getCurrentCMSCategory(); $this->_join = ' LEFT JOIN `'._DB_PREFIX_.'cms_category` c ON (c.`id_cms_category` = a.`id_cms_category`)';