diff --git a/admin-dev/tabs/AdminModulesPositions.php b/admin-dev/tabs/AdminModulesPositions.php index c98a5f5e7..5f0a3ffa4 100644 --- a/admin-dev/tabs/AdminModulesPositions.php +++ b/admin-dev/tabs/AdminModulesPositions.php @@ -126,7 +126,7 @@ class AdminModulesPositions extends AdminTab $this->_errors[] = Tools::displayError('No valid value for field exceptions'); // Add files exceptions - if (!$module->editExceptions($id_hook, $exception, array($id))) + if (!$module->editExceptions($id_hook, $exception, Shop::getListFromContext())) $this->_errors[] = Tools::displayError('An error occurred while transplanting module to hook.'); } @@ -320,7 +320,6 @@ class AdminModulesPositions extends AdminTab '.($instance->version ? ' v'.((int)($instance->version) == $instance->version? sprintf('%.1f', $instance->version) : (float)($instance->version)) : '').'
'.$instance->description.' '; - if ($canMove) echo ' '.$this->l('Edit').' '.$this->l('Delete').' @@ -409,15 +408,44 @@ class AdminModulesPositions extends AdminTab echo ' * '; + + echo << + // + +EOF; // Manage exceptions if (!$exceptsDiff) { echo ' -
-
Ex: identity.php, history.php, order.php, product.php

- '.$this->l('Please specify those files for which you do not want the module to be displayed').'.
- '.$this->l('These files are located in your base directory').', '.$this->l('e.g., ').' identity.php.
+
'; + $this->displayModuleExceptionList($excepts, 0); + + echo $this->l('Please specify those files for which you do not want the module to be displayed').'.
'.$this->l('Please type each filename separated by a comma').'.

'; @@ -428,13 +456,9 @@ class AdminModulesPositions extends AdminTab
'; foreach ($exceptsList as $shopID => $fileList) { - echo ''; - $shop = new Shop($shopID); - echo ' ('.htmlspecialchars($shop->name).')

'; + $this->displayModuleExceptionList($fileList, $shopID); } - echo 'Ex: identity.php, history.php, order.php, product.php

- '.$this->l('Please specify those files for which you do not want the module to be displayed').'.
- '.$this->l('These files are located in your base directory').', '.$this->l('e.g., ').' identity.php.
+ echo $this->l('Please specify those files for which you do not want the module to be displayed').'.
'.$this->l('Please type each filename separated by a comma').'.

'; @@ -456,4 +480,25 @@ class AdminModulesPositions extends AdminTab '; } + + public function displayModuleExceptionList($fileList, $shopID) + { + if (!is_array($fileList)) + $fileList = ($fileList) ? array($fileList) : array(); + + echo ''; + if ($shopID) + echo ' ('.Shop::getInstance($shopID)->name.')'; + echo '
+

'; + } } diff --git a/classes/Dispatcher.php b/classes/Dispatcher.php index d28ee9edd..bfc08ec77 100644 --- a/classes/Dispatcher.php +++ b/classes/Dispatcher.php @@ -2,7 +2,7 @@ class DispatcherCore { - public $controllers; + public static $controllers = array(); public static $controller; function __construct() @@ -15,24 +15,24 @@ class DispatcherCore self::$controller = $this->getController(); self::$controller = str_replace('-', '', strtolower(self::$controller)); - if (!isset($this->controllers[self::$controller])) + if (!isset(self::$controllers[self::$controller])) self::$controller = 'index'; - ControllerFactory::getController($this->controllers[self::$controller])->run(); + ControllerFactory::getController(self::$controllers[self::$controller])->run(); } - protected function loadControllers() + public static function loadControllers() { $controller_files = scandir(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.'controllers'); - foreach($controller_files as $controller_filename) + foreach ($controller_files as $controller_filename) { if (substr($controller_filename, -14, 14) == 'Controller.php') - $this->controllers[strtolower(substr($controller_filename, 0, -14))] = basename($controller_filename, '.php'); + self::$controllers[strtolower(substr($controller_filename, 0, -14))] = basename($controller_filename, '.php'); } // add default controller - $this->controllers['index'] = 'IndexController'; - $this->controllers['authentication'] = $this->controllers['auth']; - $this->controllers['productscomparison'] = $this->controllers['compare']; + self::$controllers['index'] = 'IndexController'; + self::$controllers['authentication'] = self::$controllers['auth']; + self::$controllers['productscomparison'] = self::$controllers['compare']; } public function getController() diff --git a/classes/Module.php b/classes/Module.php index 2c9010453..650cda2ed 100644 --- a/classes/Module.php +++ b/classes/Module.php @@ -783,9 +783,8 @@ abstract class ModuleCore continue; $exceptions = $moduleInstance->getExceptions($array['id_hook']); - foreach ($exceptions AS $exception) - if (strstr(basename($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'], $exception)) - continue 2; + if (in_array(Dispatcher::$controller, $exceptions)) + continue; if (is_callable(array($moduleInstance, 'hook'.$hook_name))) {