diff --git a/common/framework/parsers/moduleactionparser.php b/common/framework/parsers/moduleactionparser.php index e091ca1c0..96b2acb1d 100644 --- a/common/framework/parsers/moduleactionparser.php +++ b/common/framework/parsers/moduleactionparser.php @@ -18,6 +18,7 @@ class ModuleActionParser 'hex' => '[0-9a-f]+', 'word' => '[a-zA-Z0-9_]+', 'any' => '[^/]+', + 'delete' => '[^/]+', ); /** @@ -194,7 +195,7 @@ class ModuleActionParser } else { - $var_type = ends_with('_srl', $match[1]) ? 'number' : 'any'; + $var_type = ends_with('_srl', $match[1]) ? 'int' : 'any'; $var_pattern = self::$_shortcuts[$var_type]; } $named_group = '(?P<' . $match[1] . '>' . $var_pattern . ')'; @@ -207,7 +208,9 @@ class ModuleActionParser // Return the regexp and variable list. $result = new \stdClass; - $result->route = preg_replace($var_regexp, '\\$$1', $route['route']); + $result->route = preg_replace_callback($var_regexp, function($match) { + return '$' . ((isset($match[2]) && $match[2] === 'delete') ? ($match[1] . ':' . $match[2]) : $match[1]); + }, $route['route']); $result->priority = $route['priority'] ?: 0; $result->regexp = $regexp; $result->vars = $vars; diff --git a/common/framework/router.php b/common/framework/router.php index e18a891a0..e3edcd78a 100644 --- a/common/framework/router.php +++ b/common/framework/router.php @@ -120,7 +120,6 @@ class Router // Separate the prefix and the internal part of the URL. $prefix = $matches[1]; $internal_url = $matches[2] ?? ''; - // Find the module associated with this prefix. $action_info = self::_getActionInfoByPrefix($prefix); if ($action_info) @@ -372,7 +371,7 @@ class Router $matched_arguments = array_intersect_key($route_vars['vars'], $vars); if (count($matched_arguments) === count($route_vars['vars'])) { - $reordered_routes[$route] = $route_vars['priority'] ?: count($matched_arguments); + $reordered_routes[$route] = ($route_vars['priority'] * 1000) + count($matched_arguments); } } if (!count($reordered_routes)) diff --git a/modules/board/conf/module.xml b/modules/board/conf/module.xml index 9330af666..6c14d204c 100644 --- a/modules/board/conf/module.xml +++ b/modules/board/conf/module.xml @@ -57,25 +57,35 @@ - - - - - - - - + + + + + + + + + - + - - - + + + + + + + + + + + +