From 8bd836c6b0ff474bfbbea51aba83a9be2197b0a0 Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Tue, 31 Oct 2023 09:04:54 +0100 Subject: [PATCH] Extend conf, new fixes --- ajax/reorder.php | 3 +++ front/commondropdown.form.php | 2 +- front/commondropdown.php | 2 +- hook.php | 1 + phpstan.neon | 3 +++ 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ajax/reorder.php b/ajax/reorder.php index 3efae82a..8356c9da 100644 --- a/ajax/reorder.php +++ b/ajax/reorder.php @@ -44,6 +44,9 @@ $old_order = (int)$_POST['old_order']; $new_order = (int)$_POST['new_order']; +/** @var DBmysql $DB */ +global $DB; + // Retrieve id of field to update $field_iterator = $DB->request( [ diff --git a/front/commondropdown.form.php b/front/commondropdown.form.php index 06ae450a..cc20a260 100644 --- a/front/commondropdown.form.php +++ b/front/commondropdown.form.php @@ -30,7 +30,7 @@ include "../../../inc/includes.php"; if (preg_match('/[a-z]/i', $_REQUEST['ddtype']) !== 1) { - throw new \RuntimeException(sprintf('Invalid itemtype "%"', $_REQUEST['ddtype'])); + throw new \RuntimeException(sprintf('Invalid itemtype "%1$s"', $_REQUEST['ddtype'])); } $path = PLUGINFIELDS_FRONT_PATH . '/' . $_REQUEST['ddtype'] . '.form.php'; require_once $path; diff --git a/front/commondropdown.php b/front/commondropdown.php index d0f3f71b..ebd334be 100644 --- a/front/commondropdown.php +++ b/front/commondropdown.php @@ -30,7 +30,7 @@ include "../../../inc/includes.php"; if (preg_match('/[a-z]/i', $_REQUEST['ddtype']) !== 1) { - throw new \RuntimeException(sprintf('Invalid itemtype "%"', $_REQUEST['ddtype'])); + throw new \RuntimeException(sprintf('Invalid itemtype "%1$s"', $_REQUEST['ddtype'])); } $path = PLUGINFIELDS_FRONT_PATH . '/' . $_REQUEST['ddtype'] . '.php'; require_once $path; diff --git a/hook.php b/hook.php index 84f77f2f..e7aef829 100644 --- a/hook.php +++ b/hook.php @@ -252,6 +252,7 @@ function plugin_fields_rule_matched($params = []) switch ($params['sub_type']) { case "PluginFusioninventoryTaskpostactionRule": + /** @phpstan-ignore-next-line */ $agent = new PluginFusioninventoryAgent(); if (isset($params['input']['plugin_fusioninventory_agents_id'])) { diff --git a/phpstan.neon b/phpstan.neon index 7d28e224..d6186dcb 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -7,6 +7,9 @@ parameters: - setup.php paths: - inc + - front + - ajax + - hook.php scanDirectories: - ../../inc - ../../src