mirror of
https://github.com/getgrav/grav.git
synced 2026-07-10 12:03:28 +02:00
Added support for task:action (like task but works without nonce)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
* Added `orderBy()` and `limit()` methods to `ObjectCollectionInterface` and its base classes
|
||||
* Flex: Added support for custom object index classes (API compatibility break)
|
||||
* Added `user-data://` which is a writable stream (`user://data` is not and should be avoided)
|
||||
* Added support for `task:action` (like task but works without nonce)
|
||||
1. [](#improved)
|
||||
* Improve Flex storage
|
||||
1. [](#bugfix)
|
||||
|
||||
@@ -24,7 +24,8 @@ class TasksProcessor extends ProcessorBase
|
||||
$this->startTimer();
|
||||
|
||||
$task = $this->container['task'];
|
||||
if ($task) {
|
||||
$action = $this->container['action'];
|
||||
if ($task || $action) {
|
||||
$attributes = $request->getAttribute('controller');
|
||||
|
||||
$controllerClass = $attributes['class'] ?? null;
|
||||
@@ -38,7 +39,9 @@ class TasksProcessor extends ProcessorBase
|
||||
}
|
||||
}
|
||||
|
||||
$this->container->fireEvent('onTask.' . $task);
|
||||
if ($task) {
|
||||
$this->container->fireEvent('onTask.' . $task);
|
||||
}
|
||||
}
|
||||
$this->stopTimer();
|
||||
|
||||
|
||||
@@ -24,5 +24,14 @@ class TaskServiceProvider implements ServiceProviderInterface
|
||||
|
||||
return $task ?: null;
|
||||
};
|
||||
|
||||
$container['action'] = function (Grav $c) {
|
||||
$action = $_POST['action'] ?? $c['uri']->param('action');
|
||||
if (null !== $action) {
|
||||
$action = filter_var($action, FILTER_SANITIZE_STRING);
|
||||
}
|
||||
|
||||
return $action ?: null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user