Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions modules/backend/classes/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,24 @@ public function run($url = null)
$controller = $params[1] ?? 'index';
$isApp = strtolower($module) === 'app';

self::$action = $action = isset($params[2]) ? $this->parseAction($params[2]) : 'index';
self::$params = $controllerParams = array_slice($params, 3);
$controllerClass = "{$module}\\Controllers\\{$controller}";
$controllerBase = $isApp ? base_path() : base_path('modules');
if ($controllerObj = $this->findController(
$controllerClass,
$action,
$controllerBase
)) {

// Try finding the controller first with the original action
$originalAction = $params[2] ?? 'index';
$controllerObj = $this->findController($controllerClass, $originalAction, $controllerBase);

// Use the original action for WildcardController, otherwise transform the action
$action = $originalAction;
if (!($controllerObj instanceof WildcardController)) {
$action = $this->parseAction($originalAction);
$controllerObj = $this->findController($controllerClass, $action, $controllerBase);
}

self::$action = $action;
self::$params = $controllerParams = array_slice($params, 3);

if ($controllerObj) {
if (!$isApp && !System::hasModule(ucfirst($module))) {
return Response::make(View::make('backend::404'), 404);
}
Expand Down