[*] All : modified run() to use checkAccess in the Controller class

[+] BO : #PSFV-94 - invalid token is now correctly handled. its uses initCursedPage 
// die2Exception

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9705 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mMarinetti
2011-10-28 10:10:27 +00:00
parent 5e6c8f4b2d
commit beaaef3c0f
3 changed files with 71 additions and 24 deletions
+39 -19
View File
@@ -65,6 +65,11 @@ abstract class ControllerCore
*/
protected $ajax = false;
/**
* check that the controller is available for the current user/visitor
*/
abstract public function checkAccess();
/**
* Initialize the page
*/
@@ -117,29 +122,39 @@ abstract class ControllerCore
{
$this->init();
// postProcess handles ajaxProcess
$this->postProcess();
if ($this->display_header)
if ($this->checkAccess())
{
$this->setMedia();
$this->initHeader();
}
$this->initContent();
if ($this->display_footer)
$this->initFooter();
if ($this->ajax && method_exists($this, 'ajaxPreprocess'))
$this->ajaxPreProcess();
if ($this->ajax)
{
$action = Tools::getValue('action');
if (!empty($action) && method_exists($this, 'displayAjax'.Tools::toCamelCase($action)))
$this->{'displayAjax'.$action}();
elseif (method_exists($this, 'displayAjax'))
$this->displayAjax();
// postProcess handles ajaxProcess
$this->postProcess();
if ($this->display_header)
{
$this->setMedia();
$this->initHeader();
}
$this->initContent();
if ($this->display_footer)
$this->initFooter();
// default behavior for ajax process is to use $_POST[action] or $_GET[action]
// then using displayAjax[action]
if ($this->ajax)
{
$action = Tools::getValue('action');
if (!empty($action) && method_exists($this, 'displayAjax'.Tools::toCamelCase($action)))
$this->{'displayAjax'.$action}();
elseif (method_exists($this, 'displayAjax'))
$this->displayAjax();
}
}
else
$this->display();
$this->initCursedPage();
$this->display();
}
public function displayHeader($display = true)
@@ -167,6 +182,11 @@ abstract class ControllerCore
*/
abstract public function initContent();
/**
* Assign smarty variables when access is forbidden
*/
abstract public function initCursedPage();
/**
* Assign smarty variables for the page footer
*/