From 96c1d208a4a99c7ef593b305b1088f23c2d34f25 Mon Sep 17 00:00:00 2001 From: David Durieux Date: Thu, 11 Apr 2024 16:34:09 +0200 Subject: [PATCH] Fix lint --- ajax/showtaskjoblogdetail.php | 5 ++-- ajax/taskjobaddtype.php | 9 +++---- front/deploypackage.form.php | 5 ++-- front/inventoryruleentity.form.php | 2 +- front/inventoryruleentity.php | 2 +- front/inventoryruleimport.form.php | 2 +- front/inventoryruleimport.php | 2 +- front/inventoryrulelocation.form.php | 2 +- front/inventoryrulelocation.php | 2 +- front/inventoryruleremotework.form.php | 2 +- front/inventoryruleremotework.php | 2 +- inc/communicationnetworkinventory.class.php | 2 +- inc/deployaction.class.php | 29 +++++++++------------ inc/deploycheck.class.php | 13 +++++---- inc/deployfile.class.php | 7 +++-- inc/deployuserinteraction.class.php | 15 +++++------ inc/taskview.class.php | 4 +-- 17 files changed, 48 insertions(+), 57 deletions(-) diff --git a/ajax/showtaskjoblogdetail.php b/ajax/showtaskjoblogdetail.php index 0e38fbb44..c109c479d 100644 --- a/ajax/showtaskjoblogdetail.php +++ b/ajax/showtaskjoblogdetail.php @@ -59,9 +59,8 @@ $agents_id = filter_input(INPUT_POST, "agents_id"); $uniqid = filter_input(INPUT_POST, "uniqid"); -if ( - is_null($agents_id) || $agents_id === false || !is_numeric($agents_id) || - is_null($uniqid) || $uniqid === false || !is_numeric($uniqid) +if (is_null($agents_id) || $agents_id === false || !is_numeric($agents_id) || + is_null($uniqid) || $uniqid === false || !is_numeric($uniqid) ) { // not allowed exit; diff --git a/ajax/taskjobaddtype.php b/ajax/taskjobaddtype.php index 623174356..76655bfcd 100644 --- a/ajax/taskjobaddtype.php +++ b/ajax/taskjobaddtype.php @@ -57,11 +57,10 @@ $items_id = filter_input(INPUT_POST, "items_id"); $taskjobs_id = filter_input(INPUT_POST, "taskjobs_id"); -if ( - is_null($type) || - is_null($itemtype) || - is_null($items_id) || !is_numeric($items_id) || - is_null($taskjobs_id) || !is_numeric($taskjobs_id) +if (is_null($type) || + is_null($itemtype) || + is_null($items_id) || !is_numeric($items_id) || + is_null($taskjobs_id) || !is_numeric($taskjobs_id) ) { exit; } diff --git a/front/deploypackage.form.php b/front/deploypackage.form.php index a9b03eb46..80195db85 100644 --- a/front/deploypackage.form.php +++ b/front/deploypackage.form.php @@ -138,9 +138,8 @@ } $packages_id = filter_input(INPUT_POST, "packages_id"); - if ( - is_null($packages_id) || $packages_id === false || - !is_numeric($packages_id) || intval($packages_id) === 0 + if (is_null($packages_id) || $packages_id === false || + !is_numeric($packages_id) || intval($packages_id) === 0 ) { Html::displayErrorAndDie("Error with wrong format of data sent"); } diff --git a/front/inventoryruleentity.form.php b/front/inventoryruleentity.form.php index d34d13085..acaec5595 100644 --- a/front/inventoryruleentity.form.php +++ b/front/inventoryruleentity.form.php @@ -49,7 +49,7 @@ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access this file directly"); } - + Html::header(__('FusionInventory', 'fusioninventory'), $_SERVER["PHP_SELF"], "admin", diff --git a/front/inventoryruleentity.php b/front/inventoryruleentity.php index c941947cb..9089b5169 100644 --- a/front/inventoryruleentity.php +++ b/front/inventoryruleentity.php @@ -49,7 +49,7 @@ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access this file directly"); } - + Session::checkLoginUser(); Html::header(__('FusionInventory', 'fusioninventory'), $_SERVER["PHP_SELF"], diff --git a/front/inventoryruleimport.form.php b/front/inventoryruleimport.form.php index 33d6aebee..361c8bc13 100644 --- a/front/inventoryruleimport.form.php +++ b/front/inventoryruleimport.form.php @@ -49,7 +49,7 @@ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access this file directly"); } - + Html::header(__('FusionInventory', 'fusioninventory'), $_SERVER["PHP_SELF"], "admin", "pluginfusioninventorymenu", "inventoryruleimport"); diff --git a/front/inventoryruleimport.php b/front/inventoryruleimport.php index 2e6edd770..2d614c9dd 100644 --- a/front/inventoryruleimport.php +++ b/front/inventoryruleimport.php @@ -49,7 +49,7 @@ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access this file directly"); } - + Html::header(__('FusionInventory', 'fusioninventory'), $_SERVER["PHP_SELF"], "admin", "pluginfusioninventorymenu", "inventoryruleimport"); diff --git a/front/inventoryrulelocation.form.php b/front/inventoryrulelocation.form.php index d95e4178d..b58e88f37 100644 --- a/front/inventoryrulelocation.form.php +++ b/front/inventoryrulelocation.form.php @@ -50,7 +50,7 @@ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access this file directly"); } - + Html::header(__('FusionInventory', 'fusioninventory'), $_SERVER["PHP_SELF"], "admin", diff --git a/front/inventoryrulelocation.php b/front/inventoryrulelocation.php index 0e2a5bdc1..9b2bf80c2 100644 --- a/front/inventoryrulelocation.php +++ b/front/inventoryrulelocation.php @@ -50,7 +50,7 @@ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access this file directly"); } - + Session::checkLoginUser(); Html::header(__('FusionInventory', 'fusioninventory'), $_SERVER["PHP_SELF"], diff --git a/front/inventoryruleremotework.form.php b/front/inventoryruleremotework.form.php index e7dd6bd87..65763b530 100644 --- a/front/inventoryruleremotework.form.php +++ b/front/inventoryruleremotework.form.php @@ -49,7 +49,7 @@ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access this file directly"); } - + Html::header(__('FusionInventory', 'fusioninventory'), $_SERVER["PHP_SELF"], "admin", diff --git a/front/inventoryruleremotework.php b/front/inventoryruleremotework.php index 4fa885565..d3a16a7ad 100644 --- a/front/inventoryruleremotework.php +++ b/front/inventoryruleremotework.php @@ -49,7 +49,7 @@ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access this file directly"); } - + Session::checkLoginUser(); Html::header(__('FusionInventory', 'fusioninventory'), $_SERVER["PHP_SELF"], diff --git a/inc/communicationnetworkinventory.class.php b/inc/communicationnetworkinventory.class.php index a54942ecd..cb8e59aec 100644 --- a/inc/communicationnetworkinventory.class.php +++ b/inc/communicationnetworkinventory.class.php @@ -724,7 +724,7 @@ function is_wireless_controller($a_inventory, $parent_index = 0) { * @param mixed[] $a_inventory * @return mixed[] */ - function get_wireless_controller_access_points($a_inventory) { + function get_wireless_controller_access_points($a_inventory) { $accesspoints = []; $num = 0; foreach ($a_inventory['components'] as $component) { diff --git a/inc/deployaction.class.php b/inc/deployaction.class.php index 60e8de86a..44449c3da 100644 --- a/inc/deployaction.class.php +++ b/inc/deployaction.class.php @@ -480,7 +480,7 @@ function removeLine(item) { * Clean data of package form * @return array{'id': integer, 'actionstype': string, 'name': string, 'exec'?: string, 'retChecks'?: array{'type': string, 'values': (string|integer)[]}[], 'logLineLimit'?: int, 'from'?: string, 'to'?: string, 'list'?: string[]}|false */ - function check_data_from_form() { + function check_data_from_form() { $id = filter_input(INPUT_POST, "id"); $actionstype = filter_input(INPUT_POST, "actionstype"); $name = filter_input(INPUT_POST, "name"); @@ -490,10 +490,9 @@ function check_data_from_form() { $from = filter_input(INPUT_POST, "from"); $to = filter_input(INPUT_POST, "to"); - if ( - is_null($id) || $id === false || !is_numeric($id) || - is_null($actionstype) || $actionstype === false || - is_null($name) || $name === false + if (is_null($id) || $id === false || !is_numeric($id) || + is_null($actionstype) || $actionstype === false || + is_null($name) || $name === false ) { return false; } @@ -515,10 +514,9 @@ function check_data_from_form() { $data['exec'] = $exec; $data['logLineLimit'] = intval($logLineLimit); $data['retChecks'] = []; - if ( - isset($_POST['retchecks_type']) && is_array($_POST['retchecks_type']) && - isset($_POST['retchecks_value']) && is_array($_POST['retchecks_value']) && - count($_POST['retchecks_type']) == count($_POST['retchecks_value']) + if (isset($_POST['retchecks_type']) && is_array($_POST['retchecks_type']) && + isset($_POST['retchecks_value']) && is_array($_POST['retchecks_value']) && + count($_POST['retchecks_type']) == count($_POST['retchecks_value']) ) { foreach ($_POST['retchecks_type'] as $index => $type) { if ($type !== '0') { @@ -548,12 +546,11 @@ function check_data_from_form() { case 'mkdir': case 'delete': - if ( - !isset($_POST['list']) || - !isset($_POST['list'][0]) || - $_POST['list'][0] === false || - !is_string($_POST['list'][0]) || - empty($_POST['list'][0]) + if (!isset($_POST['list']) || + !isset($_POST['list'][0]) || + $_POST['list'][0] === false || + !is_string($_POST['list'][0]) || + empty($_POST['list'][0]) ) { return false; } @@ -561,7 +558,7 @@ function check_data_from_form() { $_POST['list'][0] ]; break; - + } return $data; } diff --git a/inc/deploycheck.class.php b/inc/deploycheck.class.php index a1ac1f03d..5a2cec3a0 100644 --- a/inc/deploycheck.class.php +++ b/inc/deploycheck.class.php @@ -634,7 +634,7 @@ static function formatCheckForJson($params) { * Clean data of package form * @return array{'id': integer,'checkstype': string, 'name': string, 'path': string, 'return': string, 'value': string, 'unit': string}|false */ - function check_data_from_form() { + function check_data_from_form() { $id = filter_input(INPUT_POST, "id"); $checkstype = filter_input(INPUT_POST, "checkstype"); $name = filter_input(INPUT_POST, "name"); @@ -644,12 +644,11 @@ function check_data_from_form() { $value = filter_input(INPUT_POST, "value"); $unit = filter_input(INPUT_POST, "unit"); - if ( - is_null($id) || $id === false || !is_numeric($id) || - is_null($checkstype) || $checkstype === false || - is_null($name) || $name === false || - is_null($path) || $path === false || !is_string($path) || empty($path) || - is_null($return) || $return === false + if (is_null($id) || $id === false || !is_numeric($id) || + is_null($checkstype) || $checkstype === false || + is_null($name) || $name === false || + is_null($path) || $path === false || !is_string($path) || empty($path) || + is_null($return) || $return === false ) { return false; } diff --git a/inc/deployfile.class.php b/inc/deployfile.class.php index 8929860c5..277880a0c 100644 --- a/inc/deployfile.class.php +++ b/inc/deployfile.class.php @@ -509,9 +509,8 @@ function check_data_from_form() { $filestype = filter_input(INPUT_POST, "filestype"); $filename = filter_input(INPUT_POST, "filename"); - if ( - is_null($id) || $id === false || !is_numeric($id) || - is_null($retentionDuration) || $retentionDuration === false || !is_numeric($retentionDuration) + if (is_null($id) || $id === false || !is_numeric($id) || + is_null($retentionDuration) || $retentionDuration === false || !is_numeric($retentionDuration) ) { return false; } @@ -545,7 +544,7 @@ function check_data_from_form() { } return $data; } - + /** * Add a new item in files of the package diff --git a/inc/deployuserinteraction.class.php b/inc/deployuserinteraction.class.php index f3e6b6ba4..7a2f8b01a 100644 --- a/inc/deployuserinteraction.class.php +++ b/inc/deployuserinteraction.class.php @@ -331,7 +331,7 @@ function getInteractionDescription($interaction) { * Clean data of package form * @return array{'id': integer, 'type': string, 'name': string, 'title': string, 'text': string, 'template': integer}|false */ - function check_data_from_form() { + function check_data_from_form() { $id = filter_input(INPUT_POST, "id"); $type = filter_input(INPUT_POST, "userinteractionstype"); $name = filter_input(INPUT_POST, "name"); @@ -339,13 +339,12 @@ function check_data_from_form() { $text = filter_input(INPUT_POST, "text"); $template = filter_input(INPUT_POST, "template"); - if ( - is_null($id) || $id === false || !is_numeric($id) || - is_null($type) || $type === false || - is_null($name) || $name === false || - is_null($title) || $title === false || empty($title) || - is_null($text) || $text === false || - is_null($template) || $template === false || !is_numeric($template) + if (is_null($id) || $id === false || !is_numeric($id) || + is_null($type) || $type === false || + is_null($name) || $name === false || + is_null($title) || $title === false || empty($title) || + is_null($text) || $text === false || + is_null($template) || $template === false || !is_numeric($template) ) { return false; } diff --git a/inc/taskview.class.php b/inc/taskview.class.php index 02ace9ae4..adfc9e7bc 100644 --- a/inc/taskview.class.php +++ b/inc/taskview.class.php @@ -530,6 +530,6 @@ function csvExport($params = []) { * Force running the current task * @return void **/ - function forceRunning() { - } + function forceRunning() { + } }