Use Url:post() to get the $_POST variable (allows common security checks/filtering for the POST data)

This commit is contained in:
Matias Griese
2018-09-17 09:54:27 +03:00
parent 5fb772d87e
commit ec93b823ca
3 changed files with 6 additions and 3 deletions

View File

@@ -3,7 +3,9 @@
1. [](#new) 1. [](#new)
* Added new event `onAdminPage` which allows plugins to customize `Page` object in `$event['page']` * Added new event `onAdminPage` which allows plugins to customize `Page` object in `$event['page']`
1. [](#improved)
* Use `Url:post()` to get the `$_POST` variable (allows common security checks/filtering for the POST data)
# v1.8.9 # v1.8.9
## 08/23/2018 ## 08/23/2018

View File

@@ -360,7 +360,7 @@ class AdminPlugin extends Plugin
} }
// Make local copy of POST. // Make local copy of POST.
$post = !empty($_POST) ? $_POST : []; $post = $this->grav['uri']->post();
// Handle tasks. // Handle tasks.
$this->admin->task = $task = !empty($post['task']) ? $post['task'] : $this->uri->param('task'); $this->admin->task = $task = !empty($post['task']) ? $post['task'] : $this->uri->param('task');

View File

@@ -595,7 +595,8 @@ class Admin
} }
if (!$post) { if (!$post) {
$post = isset($_POST['data']) ? $_POST['data'] : []; $post = $this->grav['uri']->post();
$post = isset($post['data']) ? $post['data'] : [];
} }
// Check to see if a data type is plugin-provided, before looking into core ones // Check to see if a data type is plugin-provided, before looking into core ones