Skip to content

Commit

Permalink
replace all '\$_POST\[(.+?)\](?= \?\?)' matches
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Sep 26, 2023
1 parent ec876b9 commit 52d528a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/Form/Control/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function addJsAction(JsExpressionable $action): void
public function onUpload(\Closure $fx): void
{
$this->hasUploadCb = true;
if (($_POST['fUploadAction'] ?? null) === self::UPLOAD_ACTION) {
if ($this->getApp()->tryGetRequestPostParam('fUploadAction') === self::UPLOAD_ACTION) {
$this->cb->set(function () use ($fx) {
$postFiles = [];
for ($i = 0;; ++$i) {
Expand Down Expand Up @@ -187,7 +187,7 @@ public function onUpload(\Closure $fx): void
public function onDelete(\Closure $fx): void
{
$this->hasDeleteCb = true;
if (($_POST['fUploadAction'] ?? null) === self::DELETE_ACTION) {
if ($this->getApp()->tryGetRequestPostParam('fUploadAction') === self::DELETE_ACTION) {
$this->cb->set(function () use ($fx) {
$fileId = $_POST['fUploadId'];

Expand All @@ -206,7 +206,7 @@ protected function renderView(): void
parent::renderView();

if ($this->cb->canTerminate()) {
$uploadActionRaw = $_POST['fUploadAction'] ?? null;
$uploadActionRaw = $this->getApp()->tryGetRequestPostParam('fUploadAction');
if (!$this->hasUploadCb && ($uploadActionRaw === self::UPLOAD_ACTION)) {
throw new Exception('Missing onUpload callback');
} elseif (!$this->hasDeleteCb && ($uploadActionRaw === self::DELETE_ACTION)) {
Expand Down
2 changes: 1 addition & 1 deletion src/UserAction/JsCallbackExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function executeModelAction(): void
$this->set(function (Jquery $j, ...$values) {
$id = $this->getApp()->uiPersistence->typecastLoadField(
$this->action->getModel()->getField($this->action->getModel()->idField),
$_POST[$this->name] ?? null
$this->getApp()->tryGetRequestPostParam($this->name)
);
if ($id && $this->action->appliesTo === Model\UserAction::APPLIES_TO_SINGLE_RECORD) {
if ($this->action->isOwnerEntity() && $this->action->getEntity()->getId()) {
Expand Down
4 changes: 2 additions & 2 deletions src/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -854,10 +854,10 @@ public function jsGetStoreData(): array
{
$data = [];
$data['local'] = $this->getApp()->decodeJson(
$this->getApp()->tryGetRequestGetParam($this->name . '_local_store') ?? $_POST[$this->name . '_local_store'] ?? 'null'
$this->getApp()->tryGetRequestGetParam($this->name . '_local_store') ?? $this->getApp()->tryGetRequestPostParam($this->name . '_local_store') ?? 'null'
);
$data['session'] = $this->getApp()->decodeJson(
$this->getApp()->tryGetRequestGetParam($this->name . '_session_store') ?? $_POST[$this->name . '_session_store'] ?? 'null'
$this->getApp()->tryGetRequestGetParam($this->name . '_session_store') ?? $this->getApp()->tryGetRequestPostParam($this->name . '_session_store') ?? 'null'
);

return $data;
Expand Down
2 changes: 1 addition & 1 deletion src/VueComponent/InlineEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function onChange(\Closure $fx): void
if (!$this->autoSave) {
$value = $this->getApp()->uiPersistence->typecastLoadField(
$this->model->getField($this->fieldName),
$_POST['value'] ?? null
$this->getApp()->tryGetRequestPostParam('value')
);
$this->cb->set(static function () use ($fx, $value) {
return $fx($value);
Expand Down

0 comments on commit 52d528a

Please sign in to comment.