From a8fe62a8299d7ece916ec847a4ce2d041a083b65 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 31 Aug 2021 22:25:02 +0300 Subject: [PATCH 1/2] Added support for `task` and `action` inside JSON request body --- CHANGELOG.md | 6 ++++++ .../src/Grav/Common/Service/TaskServiceProvider.php | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98cc0f6a2..9a66335fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.7.20 +## mm/dd/2021 + +2. [](#improved) + * Added support for `task` and `action` inside JSON request body + # v1.7.19 ## 08/31/2021 diff --git a/system/src/Grav/Common/Service/TaskServiceProvider.php b/system/src/Grav/Common/Service/TaskServiceProvider.php index 9afab59a4..49ce147e9 100644 --- a/system/src/Grav/Common/Service/TaskServiceProvider.php +++ b/system/src/Grav/Common/Service/TaskServiceProvider.php @@ -12,6 +12,7 @@ use Grav\Common\Grav; use Pimple\Container; use Pimple\ServiceProviderInterface; +use Psr\Http\Message\ServerRequestInterface; /** * Class TaskServiceProvider @@ -26,7 +27,11 @@ class TaskServiceProvider implements ServiceProviderInterface public function register(Container $container) { $container['task'] = function (Grav $c) { - $task = $_POST['task'] ?? $c['uri']->param('task'); + /** @var ServerRequestInterface $request */ + $request = $c['request']; + $body = $request->getParsedBody(); + + $task = $body['task'] ?? $c['uri']->param('task'); if (null !== $task) { $task = filter_var($task, FILTER_SANITIZE_STRING); } @@ -35,7 +40,11 @@ public function register(Container $container) }; $container['action'] = function (Grav $c) { - $action = $_POST['action'] ?? $c['uri']->param('action'); + /** @var ServerRequestInterface $request */ + $request = $c['request']; + $body = $request->getParsedBody(); + + $action = $body['action'] ?? $c['uri']->param('action'); if (null !== $action) { $action = filter_var($action, FILTER_SANITIZE_STRING); } From c43b375d3b52c172d2b126f8daea06e84c08a6b4 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 1 Sep 2021 10:39:23 -0600 Subject: [PATCH 2/2] prepare for release --- CHANGELOG.md | 2 +- system/defines.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a66335fd..570b13482 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # v1.7.20 -## mm/dd/2021 +## 09/01/2021 2. [](#improved) * Added support for `task` and `action` inside JSON request body diff --git a/system/defines.php b/system/defines.php index 7c6d79ea6..9844b6b88 100644 --- a/system/defines.php +++ b/system/defines.php @@ -9,7 +9,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '1.7.19'); +define('GRAV_VERSION', '1.7.20'); define('GRAV_SCHEMA', '1.7.0_2020-11-20_1'); define('GRAV_TESTING', false);