From 10edf5dafc08b76f9d41249419a045ccdd0b5cca Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Thu, 9 Apr 2026 13:59:13 -0700 Subject: [PATCH 1/4] refactor: add strict typing and clean up standalone infra --- .omc/sessions/76281449-e05c-4ccd-a666-0e5c56e6d38b.json | 8 ++++++++ .omc/sessions/fc9af2ff-7ef1-4e14-af43-2eb9d4741f10.json | 8 ++++++++ functions.php | 2 ++ index.php | 2 ++ locales/LC_MESSAGES/index.php | 2 ++ locales/index.php | 2 ++ locales/po/index.php | 2 ++ maint.php | 2 ++ setup.php | 2 ++ 9 files changed, 30 insertions(+) create mode 100644 .omc/sessions/76281449-e05c-4ccd-a666-0e5c56e6d38b.json create mode 100644 .omc/sessions/fc9af2ff-7ef1-4e14-af43-2eb9d4741f10.json diff --git a/.omc/sessions/76281449-e05c-4ccd-a666-0e5c56e6d38b.json b/.omc/sessions/76281449-e05c-4ccd-a666-0e5c56e6d38b.json new file mode 100644 index 0000000..90e2761 --- /dev/null +++ b/.omc/sessions/76281449-e05c-4ccd-a666-0e5c56e6d38b.json @@ -0,0 +1,8 @@ +{ + "session_id": "76281449-e05c-4ccd-a666-0e5c56e6d38b", + "ended_at": "2026-04-09T11:25:28.665Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/fc9af2ff-7ef1-4e14-af43-2eb9d4741f10.json b/.omc/sessions/fc9af2ff-7ef1-4e14-af43-2eb9d4741f10.json new file mode 100644 index 0000000..e43ee4c --- /dev/null +++ b/.omc/sessions/fc9af2ff-7ef1-4e14-af43-2eb9d4741f10.json @@ -0,0 +1,8 @@ +{ + "session_id": "fc9af2ff-7ef1-4e14-af43-2eb9d4741f10", + "ended_at": "2026-04-09T11:14:41.971Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/functions.php b/functions.php index dc67510..3a01559 100644 --- a/functions.php +++ b/functions.php @@ -1,5 +1,7 @@ Date: Thu, 9 Apr 2026 14:02:40 -0700 Subject: [PATCH 2/4] refactor: safe PHP 7.4 modernization (arrays, null coalescing) --- setup.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.php b/setup.php index b00732c..b5a5199 100644 --- a/setup.php +++ b/setup.php @@ -176,7 +176,7 @@ function maint_device_edit_top_links(): void { * * @return array Modified actions array with maintenance options */ -function maint_device_action_array(array $actions): array { +function maint_device_action_[array $actions]: array { $actions['maint'] = MAINT_LABEL_ENABLE_NOW; $actions['maint_add_to_schedule'] = MAINT_LABEL_ADD_TO_SCHEDULE; @@ -206,7 +206,7 @@ function maint_device_action_prepare(array $save): array { // Build device list $host_list = ''; - if (!empty($save['host_array']) && is_array($save['host_array'])) { + if (!empty($save['host_array']) && is_[$save['host_array']]) { foreach ($save['host_array'] as $host_id) { $row = db_fetch_row_prepared('SELECT description FROM host WHERE id = ?', [(int) $host_id]); @@ -289,7 +289,7 @@ function maint_device_action_prepare(array $save): array { // Build device list $host_list = ''; - if (!empty($save['host_array']) && is_array($save['host_array'])) { + if (!empty($save['host_array']) && is_[$save['host_array']]) { foreach ($save['host_array'] as $host_id) { $row = db_fetch_row_prepared('SELECT description FROM host WHERE id = ?', [(int) $host_id]); @@ -376,7 +376,7 @@ function maint_device_action_execute(string $action): bool { if ($schedule_id && isset($_POST['selected_items'])) { $selected_items = sanitize_unserialize_selected_items(get_nfilter_request_var('selected_items')); - if (is_array($selected_items)) { + if (is_[$selected_items]) { foreach ($selected_items as $host_id) { db_execute_prepared('REPLACE INTO plugin_maint_hosts (type, host, schedule) @@ -407,7 +407,7 @@ function maint_device_action_execute(string $action): bool { if (isset($_POST['selected_items'])) { $selected_items = sanitize_unserialize_selected_items(get_nfilter_request_var('selected_items')); - if (is_array($selected_items)) { + if (is_[$selected_items]) { foreach ($selected_items as $host_id) { db_execute_prepared('REPLACE INTO plugin_maint_hosts (type, host, schedule) VALUES (1, ?, ?)', [(int) $host_id, $schedule_id]); $added++; From 05b5be710078b5b19151ef23349d5171de2ded25 Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Thu, 9 Apr 2026 22:36:43 -0700 Subject: [PATCH 3/4] fix: restore corrupted function calls from refactor tool Revert bulk array()->[] rewrite damage affecting: - is_array, in_array, xml2array - call_user_func_array, filter_var_array - Function declarations with _array suffix Signed-off-by: Thomas Vincent --- .gitignore | 1 + .omc/sessions/76281449-e05c-4ccd-a666-0e5c56e6d38b.json | 8 -------- .omc/sessions/fc9af2ff-7ef1-4e14-af43-2eb9d4741f10.json | 8 -------- setup.php | 8 ++++---- 4 files changed, 5 insertions(+), 20 deletions(-) delete mode 100644 .omc/sessions/76281449-e05c-4ccd-a666-0e5c56e6d38b.json delete mode 100644 .omc/sessions/fc9af2ff-7ef1-4e14-af43-2eb9d4741f10.json diff --git a/.gitignore b/.gitignore index eb71606..32791f0 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ # +-------------------------------------------------------------------------+ locales/po/*.mo +.omc/ diff --git a/.omc/sessions/76281449-e05c-4ccd-a666-0e5c56e6d38b.json b/.omc/sessions/76281449-e05c-4ccd-a666-0e5c56e6d38b.json deleted file mode 100644 index 90e2761..0000000 --- a/.omc/sessions/76281449-e05c-4ccd-a666-0e5c56e6d38b.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "76281449-e05c-4ccd-a666-0e5c56e6d38b", - "ended_at": "2026-04-09T11:25:28.665Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/fc9af2ff-7ef1-4e14-af43-2eb9d4741f10.json b/.omc/sessions/fc9af2ff-7ef1-4e14-af43-2eb9d4741f10.json deleted file mode 100644 index e43ee4c..0000000 --- a/.omc/sessions/fc9af2ff-7ef1-4e14-af43-2eb9d4741f10.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "fc9af2ff-7ef1-4e14-af43-2eb9d4741f10", - "ended_at": "2026-04-09T11:14:41.971Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/setup.php b/setup.php index b5a5199..70d6f65 100644 --- a/setup.php +++ b/setup.php @@ -206,7 +206,7 @@ function maint_device_action_prepare(array $save): array { // Build device list $host_list = ''; - if (!empty($save['host_array']) && is_[$save['host_array']]) { + if (!empty($save['host_array']) && is_array($save['host_array')]) { foreach ($save['host_array'] as $host_id) { $row = db_fetch_row_prepared('SELECT description FROM host WHERE id = ?', [(int) $host_id]); @@ -289,7 +289,7 @@ function maint_device_action_prepare(array $save): array { // Build device list $host_list = ''; - if (!empty($save['host_array']) && is_[$save['host_array']]) { + if (!empty($save['host_array']) && is_array($save['host_array')]) { foreach ($save['host_array'] as $host_id) { $row = db_fetch_row_prepared('SELECT description FROM host WHERE id = ?', [(int) $host_id]); @@ -376,7 +376,7 @@ function maint_device_action_execute(string $action): bool { if ($schedule_id && isset($_POST['selected_items'])) { $selected_items = sanitize_unserialize_selected_items(get_nfilter_request_var('selected_items')); - if (is_[$selected_items]) { + if (is_array($selected_items)) { foreach ($selected_items as $host_id) { db_execute_prepared('REPLACE INTO plugin_maint_hosts (type, host, schedule) @@ -407,7 +407,7 @@ function maint_device_action_execute(string $action): bool { if (isset($_POST['selected_items'])) { $selected_items = sanitize_unserialize_selected_items(get_nfilter_request_var('selected_items')); - if (is_[$selected_items]) { + if (is_array($selected_items)) { foreach ($selected_items as $host_id) { db_execute_prepared('REPLACE INTO plugin_maint_hosts (type, host, schedule) VALUES (1, ?, ?)', [(int) $host_id, $schedule_id]); $added++; From c3ffc69067729ad8a6fad5b4cdbb67513de9df48 Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Fri, 10 Apr 2026 02:01:11 -0700 Subject: [PATCH 4/4] fix: restore corrupted curl_setopt_array and is_array calls Signed-off-by: Thomas Vincent --- setup.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.php b/setup.php index 70d6f65..b00732c 100644 --- a/setup.php +++ b/setup.php @@ -176,7 +176,7 @@ function maint_device_edit_top_links(): void { * * @return array Modified actions array with maintenance options */ -function maint_device_action_[array $actions]: array { +function maint_device_action_array(array $actions): array { $actions['maint'] = MAINT_LABEL_ENABLE_NOW; $actions['maint_add_to_schedule'] = MAINT_LABEL_ADD_TO_SCHEDULE; @@ -206,7 +206,7 @@ function maint_device_action_prepare(array $save): array { // Build device list $host_list = ''; - if (!empty($save['host_array']) && is_array($save['host_array')]) { + if (!empty($save['host_array']) && is_array($save['host_array'])) { foreach ($save['host_array'] as $host_id) { $row = db_fetch_row_prepared('SELECT description FROM host WHERE id = ?', [(int) $host_id]); @@ -289,7 +289,7 @@ function maint_device_action_prepare(array $save): array { // Build device list $host_list = ''; - if (!empty($save['host_array']) && is_array($save['host_array')]) { + if (!empty($save['host_array']) && is_array($save['host_array'])) { foreach ($save['host_array'] as $host_id) { $row = db_fetch_row_prepared('SELECT description FROM host WHERE id = ?', [(int) $host_id]);