Dispatcher: Default to the default module if no module has been given in the request

This is most likely the case when custom routes have been added to the router w/o the module parameter being set.

refs #5786
This commit is contained in:
Eric Lippmann 2015-08-28 13:13:20 +02:00
parent c0eb0cbe6a
commit e7e1b1a98e
1 changed files with 2 additions and 1 deletions

View File

@ -44,7 +44,8 @@ class Dispatcher extends Zend_Controller_Dispatcher_Standard
return; return;
} }
$controllerName = ucfirst($controllerName) . 'Controller'; $controllerName = ucfirst($controllerName) . 'Controller';
if ($this->_defaultModule === $moduleName = $request->getModuleName()) { $moduleName = $request->getModuleName();
if ($moduleName === null || $moduleName === $this->_defaultModule) {
$controllerClass = 'Icinga\\' . self::CONTROLLER_NAMESPACE . '\\' . $controllerName; $controllerClass = 'Icinga\\' . self::CONTROLLER_NAMESPACE . '\\' . $controllerName;
} else { } else {
$controllerClass = 'Icinga\\Module\\' . ucfirst($moduleName) . '\\' . self::CONTROLLER_NAMESPACE . '\\' $controllerClass = 'Icinga\\Module\\' . ucfirst($moduleName) . '\\' . self::CONTROLLER_NAMESPACE . '\\'