// Fix #PSCFV-4468

This commit is contained in:
rGaillard
2012-09-28 13:08:48 +00:00
parent f0d0a98bef
commit f0bf2da7e3
7 changed files with 25 additions and 17 deletions
+5 -3
View File
@@ -318,8 +318,7 @@ class CookieCore
public function __destruct() public function __destruct()
{ {
if ($this->_modified) $this->write();
$this->write();
} }
/** /**
@@ -327,6 +326,9 @@ class CookieCore
*/ */
public function write() public function write()
{ {
if (!$this->_modified || headers_sent())
return;
$cookie = ''; $cookie = '';
/* Serialize cookie content */ /* Serialize cookie content */
@@ -336,7 +338,7 @@ class CookieCore
/* Add checksum to cookie */ /* Add checksum to cookie */
$cookie .= 'checksum|'.crc32($this->_iv.$cookie); $cookie .= 'checksum|'.crc32($this->_iv.$cookie);
$this->_modified = false;
/* Cookies are encrypted for evident security reasons */ /* Cookies are encrypted for evident security reasons */
return $this->_setcookie($cookie); return $this->_setcookie($cookie);
} }
+2 -2
View File
@@ -1160,10 +1160,10 @@ class AdminControllerCore extends Controller
$this->context->smarty->assign('page', Tools::jsonEncode($page)); $this->context->smarty->assign('page', Tools::jsonEncode($page));
else else
$this->context->smarty->assign('page', $page); $this->context->smarty->assign('page', $page);
$this->smartyOutputContent($this->layout);
$this->context->smarty->display($this->layout);
} }
/** /**
* add a warning message to display at the top of the page * add a warning message to display at the top of the page
* *
+6
View File
@@ -347,4 +347,10 @@ abstract class ControllerCore
{ {
return (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'); return (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
} }
protected function smartyOutputContent($content)
{
$this->context->cookie->write();
$this->context->smarty->display($content);
}
} }
+9 -9
View File
@@ -497,7 +497,7 @@ class FrontControllerCore extends Controller
$this->context->smarty->assign('js_files', array_unique($this->js_files)); $this->context->smarty->assign('js_files', array_unique($this->js_files));
$this->display_header = $display; $this->display_header = $display;
$this->context->smarty->display(_PS_THEME_DIR_.'header.tpl'); $this->smartyOutputContent(_PS_THEME_DIR_.'header.tpl');
} }
@@ -508,7 +508,7 @@ class FrontControllerCore extends Controller
{ {
// This method will be removed in 1.6 // This method will be removed in 1.6
Tools::displayAsDeprecated(); Tools::displayAsDeprecated();
$this->context->smarty->display(_PS_THEME_DIR_.'footer.tpl'); $this->smartyOutputContent(_PS_THEME_DIR_.'footer.tpl');
} }
public function initCursedPage() public function initCursedPage()
@@ -572,28 +572,28 @@ class FrontControllerCore extends Controller
ob_clean(); ob_clean();
$this->context->smarty->assign('template', $template); $this->context->smarty->assign('template', $template);
} }
$this->context->smarty->display($layout); $this->smartyOutputContent($layout);
} }
else else
{ {
// BEGIN - 1.4 retrocompatibility - will be removed in 1.6 // BEGIN - 1.4 retrocompatibility - will be removed in 1.6
Tools::displayAsDeprecated('layout.tpl is missing in your theme directory'); Tools::displayAsDeprecated('layout.tpl is missing in your theme directory');
if ($this->display_header) if ($this->display_header)
$this->context->smarty->display(_PS_THEME_DIR_.'header.tpl'); $this->smartyOutputContent(_PS_THEME_DIR_.'header.tpl');
if ($this->template) if ($this->template)
$this->context->smarty->display($this->template); $this->smartyOutputContent($this->template);
else // For retrocompatibility with 1.4 controller else // For retrocompatibility with 1.4 controller
$this->displayContent(); $this->displayContent();
if ($this->display_footer) if ($this->display_footer)
$this->context->smarty->display(_PS_THEME_DIR_.'footer.tpl'); $this->smartyOutputContent(_PS_THEME_DIR_.'footer.tpl');
// live edit // live edit
if (Tools::isSubmit('live_edit') && ($ad = Tools::getValue('ad')) && Tools::getAdminToken('AdminModulesPositions'.(int)Tab::getIdFromClassName('AdminModulesPositions').(int)Tools::getValue('id_employee'))) if (Tools::isSubmit('live_edit') && ($ad = Tools::getValue('ad')) && Tools::getAdminToken('AdminModulesPositions'.(int)Tab::getIdFromClassName('AdminModulesPositions').(int)Tools::getValue('id_employee')))
{ {
$this->context->smarty->assign(array('ad' => $ad, 'live_edit' => true)); $this->context->smarty->assign(array('ad' => $ad, 'live_edit' => true));
$this->context->smarty->display(_PS_ALL_THEMES_DIR_.'live_edit.tpl'); $this->smartyOutputContent(_PS_ALL_THEMES_DIR_.'live_edit.tpl');
} }
// END - 1.4 retrocompatibility - will be removed in 1.6 // END - 1.4 retrocompatibility - will be removed in 1.6
} }
@@ -613,7 +613,7 @@ class FrontControllerCore extends Controller
$this->context->smarty->assign('favicon_url', _PS_IMG_.Configuration::get('PS_FAVICON')); $this->context->smarty->assign('favicon_url', _PS_IMG_.Configuration::get('PS_FAVICON'));
$template_dir = ($this->context->getMobileDevice() == true ? _PS_THEME_MOBILE_DIR_ : _PS_THEME_DIR_); $template_dir = ($this->context->getMobileDevice() == true ? _PS_THEME_MOBILE_DIR_ : _PS_THEME_DIR_);
$this->context->smarty->display($template_dir.'maintenance.tpl'); $this->smartyOutputContent($template_dir.'maintenance.tpl');
exit; exit;
} }
} }
@@ -624,7 +624,7 @@ class FrontControllerCore extends Controller
{ {
header('HTTP/1.1 503 temporarily overloaded'); header('HTTP/1.1 503 temporarily overloaded');
$this->context->smarty->assign('favicon_url', _PS_IMG_.Configuration::get('PS_FAVICON')); $this->context->smarty->assign('favicon_url', _PS_IMG_.Configuration::get('PS_FAVICON'));
$this->context->smarty->display(_PS_THEME_DIR_.'restricted-country.tpl'); $this->smartyOutputContent(_PS_THEME_DIR_.'restricted-country.tpl');
exit; exit;
} }
+1 -1
View File
@@ -295,7 +295,7 @@ class AdminCartsControllerCore extends AdminController
$this->initFooter(); $this->initFooter();
$this->context->smarty->assign(array('customization_errors' => implode('<br />', $errors), $this->context->smarty->assign(array('customization_errors' => implode('<br />', $errors),
'css_files' => $this->css_files)); 'css_files' => $this->css_files));
return $this->context->smarty->display('controllers/orders/form_customization_feedback.tpl'); return $this->smartyOutputContent('controllers/orders/form_customization_feedback.tpl');
} }
} }
+1 -1
View File
@@ -222,7 +222,7 @@ class AdminModulesControllerCore extends AdminController
Configuration::updateValue('PS_SHOW_CAT_MODULES_'.(int)$this->id_employee, ''); Configuration::updateValue('PS_SHOW_CAT_MODULES_'.(int)$this->id_employee, '');
$this->initContent(); $this->initContent();
$this->context->smarty->display('controllers/modules/list.tpl'); $this->smartyOutputContent('controllers/modules/list.tpl');
exit; exit;
} }
+1 -1
View File
@@ -89,7 +89,7 @@ class OrderReturnControllerCore extends FrontController
public function displayAjax() public function displayAjax()
{ {
$this->context->smarty->display($this->template); $this->smartyOutputContent($this->template);
} }
} }