diff options
Updated the comments and documentation in some controllers
3 files changed, 10 insertions, 0 deletions
| -rw-r--r-- | src/controllers/BaseController.php | 4 | ||||
| -rw-r--r-- | src/controllers/DashboardController.php | 3 | ||||
| -rw-r--r-- | src/controllers/DashboardLoginController.php | 3 |
diff --git a/src/controllers/BaseController.php b/src/controllers/BaseController.php index f766398..412cf25 100644 --- a/src/controllers/BaseController.php +++ b/src/controllers/BaseController.php @@ -1,5 +1,9 @@ <?php class BaseController { + /** + * Calls the get, post, put or delete static methods, depending on the server request method ($_SERVER['REQUEST_METHOD']) + * **By default** all requests that are not POST, PUT or DELETE execute the GET request method + */ public static function invoke() { switch ($_SERVER['REQUEST_METHOD']) { case 'POST': diff --git a/src/controllers/DashboardController.php b/src/controllers/DashboardController.php index 80717ca..59c1090 100644 --- a/src/controllers/DashboardController.php +++ b/src/controllers/DashboardController.php @@ -16,6 +16,9 @@ class DashboardController extends BaseController { } public static function post() { + // Forms can only send POST or GET requests. + // EditOfferController doesn't have it's own URI, so we can't send a request. + // We also can't just invoke it, because that means manually changing the server's request method. switch($_POST['_method']) { case 'get': EditOfferController::get(); diff --git a/src/controllers/DashboardLoginController.php b/src/controllers/DashboardLoginController.php index af1113e..c6ac070 100644 --- a/src/controllers/DashboardLoginController.php +++ b/src/controllers/DashboardLoginController.php @@ -10,6 +10,9 @@ class DashboardLoginController extends BaseController { } public static function post() { + // The dashboard(controller) doesn't have it's own URI (and all requests are sent in this controller), so + // we can't send a request directly to dashboard. + // This does compromise security, but for now it will have to do. if (isset($_POST['_method'])) { DashboardController::invoke(); } |
