From 55e8746463feaece3d2b9c0304fadbc60a885dd0 Mon Sep 17 00:00:00 2001 From: mDeflotte Date: Thu, 8 Mar 2012 16:17:20 +0000 Subject: [PATCH] [-] MO : #PSFV-640 - Fatal error in HomeSlider module --- classes/Module.php | 24 ++++++++++++++++++++++++ modules/homeslider/homeslider.php | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/classes/Module.php b/classes/Module.php index f33fd5521..fcec05f8d 100644 --- a/classes/Module.php +++ b/classes/Module.php @@ -1694,5 +1694,29 @@ abstract class ModuleCore return $result['position']; } + + /** + * add a warning message to display at the top of the admin page + * + * @param string $msg + */ + public function adminDisplayWarning($msg) + { + if (!($this->context->controller instanceof AdminController)) + return false; + $this->context->controller->warnings[] = $msg; + } + + /** + * add a info message to display at the top of the admin page + * + * @param string $msg + */ + protected function adminDisplayInformation($msg) + { + if (!($this->context->controller instanceof AdminController)) + return false; + $this->context->controller->informations[] = $msg; + } } diff --git a/modules/homeslider/homeslider.php b/modules/homeslider/homeslider.php index 0965600ec..00b28ad65 100644 --- a/modules/homeslider/homeslider.php +++ b/modules/homeslider/homeslider.php @@ -293,7 +293,7 @@ class HomeSlider extends Module $slide = new HomeSlide((int)Tools::getValue('id_slide')); /* Checks if directory is writable */ if (!is_writable('.')) - $this->displayWarning(sprintf($this->l('modules %s must be writable (CHMOD 755 / 777)'), $this->name)); + $this->adminDisplayWarning(sprintf($this->l('modules %s must be writable (CHMOD 755 / 777)'), $this->name)); /* Gets languages and sets which div requires translations */ $defaultLanguage = (int)Configuration::get('PS_LANG_DEFAULT');