Skip to content

Commit

Permalink
Merge branch 'release/1.7.20'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Sep 1, 2021
2 parents 4708a46 + c43b375 commit a128c7f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v1.7.20
## 09/01/2021

2. [](#improved)
* Added support for `task` and `action` inside JSON request body

# v1.7.19
## 08/31/2021

Expand Down
2 changes: 1 addition & 1 deletion system/defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
13 changes: 11 additions & 2 deletions system/src/Grav/Common/Service/TaskServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Grav\Common\Grav;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
use Psr\Http\Message\ServerRequestInterface;

/**
* Class TaskServiceProvider
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit a128c7f

Please sign in to comment.