From 4c83a63533d8616e01d2ac473f98f4a2dc6bb1be Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Tue, 27 Sep 2011 14:47:01 +0300 Subject: pass param, sequence id support --- MainApp.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'MainApp.php') diff --git a/MainApp.php b/MainApp.php index ea148bb..73d3dc6 100644 --- a/MainApp.php +++ b/MainApp.php @@ -37,22 +37,25 @@ class MainApp // dispatch requested controller $controller = self::classname($controller); $c = new $controller; -// var_dump($c); + + // try to determine passed argument + $a = (empty($_POST) && !empty($action)) ? $param : $_POST; + // assume no method name was given, try $param // URL format is always controller/param/action if (method_exists($c, $action)) { - return $c->$action($_POST); + return $c->$action($a); } // controller/action if (method_exists($c, $param)) { - return $c->$param($_POST); + return $c->$param($a); } // ...then fall back to defaultAction if (method_exists($c, $c->defaultAction)) { $action = $c->defaultAction; - return $c->$action($_POST); + return $c->$action($a); } // don't know what to do, giving up... -- cgit v1.2.3