Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Allow 'action' parameter override from POST parameter for easier form submissions

givanz456973bbf5fa
diff --git a/system/core/frontcontroller.php b/system/core/frontcontroller.php
index 3f5eaf6..3cf4103 100755
--- a/system/core/frontcontroller.php
+++ b/system/core/frontcontroller.php
@@ -303,13 +303,8 @@ class FrontController {
}
static public function dispatch() {
- $module = $_GET['module'] ?? $_POST['module'] ?? null;
- $action = $_GET['action'] ?? $_POST['action'] ?? null;
-
- if (empty($action)) {
- $action = 'index';
- }
-
+ $module = $_GET['module'] ?? $_POST['module'] ?? null;
+ $action = $_GET['action'] ?? $_POST['action'] ?? null;
$_REQUEST = array_merge($_GET, $_REQUEST);
//subdirectory support
@@ -337,12 +332,15 @@ class FrontController {
if (isset($_GET['route'])) {
if (preg_match('@(^.+?)/(\w+$)@', $_GET['route'], $routeMatch)) {
$module = $routeMatch[1];
- $action = $routeMatch[2];
+ $action = $action ?? $routeMatch[2];
} else {
$module = trim($_GET['route'], '/');
}
}
+ if (empty($action)) {
+ $action = 'index';
+ }
//santize inputs
if (($module && ! preg_match('@^[a-zA-Z_/0-9\-]{4,70}$@', $module)) ||
($action && ! preg_match('@^[a-zA-Z_/0-9\-]{3,70}$@', $action))) {