From 0f5968c8422b6fe4212ca68649a27daaf5f060f3 Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Thu, 9 Apr 2026 13:59:50 -0700 Subject: [PATCH 1/4] refactor: add strict typing and clean up standalone infra --- .omc/sessions/13078be2-490d-4463-b1cb-d4f18ed4f17b.json | 8 ++++++++ .omc/sessions/1d8db818-d03e-49db-b914-885d353ec217.json | 8 ++++++++ .omc/sessions/329f355f-e88f-4898-8ed5-0982ae2e7e4d.json | 8 ++++++++ .omc/sessions/3bb2f627-a069-454e-92ae-36433f072136.json | 8 ++++++++ .omc/sessions/4ce27694-4715-413d-b907-b9f5a1265d19.json | 8 ++++++++ .omc/sessions/692e33b9-e73c-4d0f-8f73-2aa864795a7b.json | 8 ++++++++ .omc/sessions/71d55ede-992a-425f-8f99-53fbce80a343.json | 8 ++++++++ .omc/sessions/7f1e4ef4-707d-49b3-b57d-16f7220a8d12.json | 8 ++++++++ .omc/sessions/827ec296-29cc-4cd8-8331-f73fdd756f37.json | 8 ++++++++ .omc/sessions/9641f786-5142-4ae1-9e18-b11f5e6fb816.json | 8 ++++++++ .omc/sessions/96a4b59a-d5a8-43cd-af25-0597cbf12107.json | 8 ++++++++ .omc/sessions/a408d1a5-f516-4379-9a1e-35398aa29599.json | 8 ++++++++ .omc/sessions/a5b592a5-38aa-4b11-bf0a-5d0d087615b5.json | 8 ++++++++ .omc/sessions/bf809b2e-0eed-4a7e-b895-01510e5d6b9d.json | 8 ++++++++ .omc/sessions/cbf69f79-e236-4d9c-9289-4333f5f3c545.json | 8 ++++++++ .omc/sessions/cf3ccfa8-c9cf-42df-876d-cbe0cd78ad2f.json | 8 ++++++++ .omc/sessions/d541a73b-f1aa-4e3c-a6c6-6f00f7f2a58a.json | 8 ++++++++ .omc/sessions/d6e019bb-7a92-4df7-a0f5-34964c37bd3d.json | 8 ++++++++ .omc/sessions/e783cff2-839b-4686-bbc3-c8758d9c7b6c.json | 8 ++++++++ .omc/sessions/f7263a26-c009-490e-992e-53a418b29eec.json | 8 ++++++++ .omc/sessions/f945f45a-c0d4-4a7e-b89f-0b41c163869a.json | 8 ++++++++ cli_import.php | 2 ++ cli_thresholds.php | 2 ++ extras/apply_realms.php | 2 ++ extras/index.php | 2 ++ extras/upgrade.php | 2 ++ images/index.php | 2 ++ includes/arrays.php | 2 ++ includes/database.php | 2 ++ includes/index.php | 2 ++ includes/polling.php | 2 ++ includes/settings.php | 2 ++ includes/tab.php | 2 ++ index.php | 2 ++ locales/LC_MESSAGES/index.php | 2 ++ locales/index.php | 2 ++ locales/po/index.php | 2 ++ notify_lists.php | 2 ++ notify_queue.php | 2 ++ poller_thold.php | 2 ++ service/index.php | 2 ++ service/systemd/index.php | 2 ++ setup.php | 2 ++ themes/classic/index.php | 2 ++ themes/dark/index.php | 2 ++ themes/index.php | 2 ++ themes/modern/index.php | 2 ++ themes/paper-plane/index.php | 2 ++ themes/paw/index.php | 2 ++ themes/sunrise/index.php | 2 ++ thold.php | 2 ++ thold_functions.php | 2 ++ thold_graph.php | 2 ++ thold_notify.php | 2 ++ thold_process.php | 2 ++ thold_templates.php | 2 ++ thold_webapi.php | 2 ++ 57 files changed, 240 insertions(+) create mode 100644 .omc/sessions/13078be2-490d-4463-b1cb-d4f18ed4f17b.json create mode 100644 .omc/sessions/1d8db818-d03e-49db-b914-885d353ec217.json create mode 100644 .omc/sessions/329f355f-e88f-4898-8ed5-0982ae2e7e4d.json create mode 100644 .omc/sessions/3bb2f627-a069-454e-92ae-36433f072136.json create mode 100644 .omc/sessions/4ce27694-4715-413d-b907-b9f5a1265d19.json create mode 100644 .omc/sessions/692e33b9-e73c-4d0f-8f73-2aa864795a7b.json create mode 100644 .omc/sessions/71d55ede-992a-425f-8f99-53fbce80a343.json create mode 100644 .omc/sessions/7f1e4ef4-707d-49b3-b57d-16f7220a8d12.json create mode 100644 .omc/sessions/827ec296-29cc-4cd8-8331-f73fdd756f37.json create mode 100644 .omc/sessions/9641f786-5142-4ae1-9e18-b11f5e6fb816.json create mode 100644 .omc/sessions/96a4b59a-d5a8-43cd-af25-0597cbf12107.json create mode 100644 .omc/sessions/a408d1a5-f516-4379-9a1e-35398aa29599.json create mode 100644 .omc/sessions/a5b592a5-38aa-4b11-bf0a-5d0d087615b5.json create mode 100644 .omc/sessions/bf809b2e-0eed-4a7e-b895-01510e5d6b9d.json create mode 100644 .omc/sessions/cbf69f79-e236-4d9c-9289-4333f5f3c545.json create mode 100644 .omc/sessions/cf3ccfa8-c9cf-42df-876d-cbe0cd78ad2f.json create mode 100644 .omc/sessions/d541a73b-f1aa-4e3c-a6c6-6f00f7f2a58a.json create mode 100644 .omc/sessions/d6e019bb-7a92-4df7-a0f5-34964c37bd3d.json create mode 100644 .omc/sessions/e783cff2-839b-4686-bbc3-c8758d9c7b6c.json create mode 100644 .omc/sessions/f7263a26-c009-490e-992e-53a418b29eec.json create mode 100644 .omc/sessions/f945f45a-c0d4-4a7e-b89f-0b41c163869a.json diff --git a/.omc/sessions/13078be2-490d-4463-b1cb-d4f18ed4f17b.json b/.omc/sessions/13078be2-490d-4463-b1cb-d4f18ed4f17b.json new file mode 100644 index 0000000..6cfe93f --- /dev/null +++ b/.omc/sessions/13078be2-490d-4463-b1cb-d4f18ed4f17b.json @@ -0,0 +1,8 @@ +{ + "session_id": "13078be2-490d-4463-b1cb-d4f18ed4f17b", + "ended_at": "2026-03-20T09:00:16.101Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/1d8db818-d03e-49db-b914-885d353ec217.json b/.omc/sessions/1d8db818-d03e-49db-b914-885d353ec217.json new file mode 100644 index 0000000..14c4e08 --- /dev/null +++ b/.omc/sessions/1d8db818-d03e-49db-b914-885d353ec217.json @@ -0,0 +1,8 @@ +{ + "session_id": "1d8db818-d03e-49db-b914-885d353ec217", + "ended_at": "2026-04-09T00:35:12.552Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/329f355f-e88f-4898-8ed5-0982ae2e7e4d.json b/.omc/sessions/329f355f-e88f-4898-8ed5-0982ae2e7e4d.json new file mode 100644 index 0000000..fc00a1b --- /dev/null +++ b/.omc/sessions/329f355f-e88f-4898-8ed5-0982ae2e7e4d.json @@ -0,0 +1,8 @@ +{ + "session_id": "329f355f-e88f-4898-8ed5-0982ae2e7e4d", + "ended_at": "2026-03-20T09:01:27.725Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/3bb2f627-a069-454e-92ae-36433f072136.json b/.omc/sessions/3bb2f627-a069-454e-92ae-36433f072136.json new file mode 100644 index 0000000..14eaa8c --- /dev/null +++ b/.omc/sessions/3bb2f627-a069-454e-92ae-36433f072136.json @@ -0,0 +1,8 @@ +{ + "session_id": "3bb2f627-a069-454e-92ae-36433f072136", + "ended_at": "2026-03-20T09:00:07.165Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/4ce27694-4715-413d-b907-b9f5a1265d19.json b/.omc/sessions/4ce27694-4715-413d-b907-b9f5a1265d19.json new file mode 100644 index 0000000..ce2bcda --- /dev/null +++ b/.omc/sessions/4ce27694-4715-413d-b907-b9f5a1265d19.json @@ -0,0 +1,8 @@ +{ + "session_id": "4ce27694-4715-413d-b907-b9f5a1265d19", + "ended_at": "2026-04-09T00:34:04.604Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/692e33b9-e73c-4d0f-8f73-2aa864795a7b.json b/.omc/sessions/692e33b9-e73c-4d0f-8f73-2aa864795a7b.json new file mode 100644 index 0000000..e94c870 --- /dev/null +++ b/.omc/sessions/692e33b9-e73c-4d0f-8f73-2aa864795a7b.json @@ -0,0 +1,8 @@ +{ + "session_id": "692e33b9-e73c-4d0f-8f73-2aa864795a7b", + "ended_at": "2026-03-20T08:58:36.240Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/71d55ede-992a-425f-8f99-53fbce80a343.json b/.omc/sessions/71d55ede-992a-425f-8f99-53fbce80a343.json new file mode 100644 index 0000000..f111af1 --- /dev/null +++ b/.omc/sessions/71d55ede-992a-425f-8f99-53fbce80a343.json @@ -0,0 +1,8 @@ +{ + "session_id": "71d55ede-992a-425f-8f99-53fbce80a343", + "ended_at": "2026-03-20T09:08:58.080Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/7f1e4ef4-707d-49b3-b57d-16f7220a8d12.json b/.omc/sessions/7f1e4ef4-707d-49b3-b57d-16f7220a8d12.json new file mode 100644 index 0000000..cdcc3ea --- /dev/null +++ b/.omc/sessions/7f1e4ef4-707d-49b3-b57d-16f7220a8d12.json @@ -0,0 +1,8 @@ +{ + "session_id": "7f1e4ef4-707d-49b3-b57d-16f7220a8d12", + "ended_at": "2026-03-20T09:12:42.138Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/827ec296-29cc-4cd8-8331-f73fdd756f37.json b/.omc/sessions/827ec296-29cc-4cd8-8331-f73fdd756f37.json new file mode 100644 index 0000000..3d4ae31 --- /dev/null +++ b/.omc/sessions/827ec296-29cc-4cd8-8331-f73fdd756f37.json @@ -0,0 +1,8 @@ +{ + "session_id": "827ec296-29cc-4cd8-8331-f73fdd756f37", + "ended_at": "2026-03-20T09:06:13.250Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/9641f786-5142-4ae1-9e18-b11f5e6fb816.json b/.omc/sessions/9641f786-5142-4ae1-9e18-b11f5e6fb816.json new file mode 100644 index 0000000..698d904 --- /dev/null +++ b/.omc/sessions/9641f786-5142-4ae1-9e18-b11f5e6fb816.json @@ -0,0 +1,8 @@ +{ + "session_id": "9641f786-5142-4ae1-9e18-b11f5e6fb816", + "ended_at": "2026-03-20T09:04:54.035Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/96a4b59a-d5a8-43cd-af25-0597cbf12107.json b/.omc/sessions/96a4b59a-d5a8-43cd-af25-0597cbf12107.json new file mode 100644 index 0000000..d2f0ba7 --- /dev/null +++ b/.omc/sessions/96a4b59a-d5a8-43cd-af25-0597cbf12107.json @@ -0,0 +1,8 @@ +{ + "session_id": "96a4b59a-d5a8-43cd-af25-0597cbf12107", + "ended_at": "2026-03-20T09:09:46.449Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/a408d1a5-f516-4379-9a1e-35398aa29599.json b/.omc/sessions/a408d1a5-f516-4379-9a1e-35398aa29599.json new file mode 100644 index 0000000..4970978 --- /dev/null +++ b/.omc/sessions/a408d1a5-f516-4379-9a1e-35398aa29599.json @@ -0,0 +1,8 @@ +{ + "session_id": "a408d1a5-f516-4379-9a1e-35398aa29599", + "ended_at": "2026-03-20T09:15:19.129Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/a5b592a5-38aa-4b11-bf0a-5d0d087615b5.json b/.omc/sessions/a5b592a5-38aa-4b11-bf0a-5d0d087615b5.json new file mode 100644 index 0000000..5f7086f --- /dev/null +++ b/.omc/sessions/a5b592a5-38aa-4b11-bf0a-5d0d087615b5.json @@ -0,0 +1,8 @@ +{ + "session_id": "a5b592a5-38aa-4b11-bf0a-5d0d087615b5", + "ended_at": "2026-03-20T08:58:27.595Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/bf809b2e-0eed-4a7e-b895-01510e5d6b9d.json b/.omc/sessions/bf809b2e-0eed-4a7e-b895-01510e5d6b9d.json new file mode 100644 index 0000000..c4a0698 --- /dev/null +++ b/.omc/sessions/bf809b2e-0eed-4a7e-b895-01510e5d6b9d.json @@ -0,0 +1,8 @@ +{ + "session_id": "bf809b2e-0eed-4a7e-b895-01510e5d6b9d", + "ended_at": "2026-04-09T00:38:16.535Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/cbf69f79-e236-4d9c-9289-4333f5f3c545.json b/.omc/sessions/cbf69f79-e236-4d9c-9289-4333f5f3c545.json new file mode 100644 index 0000000..729cf33 --- /dev/null +++ b/.omc/sessions/cbf69f79-e236-4d9c-9289-4333f5f3c545.json @@ -0,0 +1,8 @@ +{ + "session_id": "cbf69f79-e236-4d9c-9289-4333f5f3c545", + "ended_at": "2026-03-20T09:11:26.115Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/cf3ccfa8-c9cf-42df-876d-cbe0cd78ad2f.json b/.omc/sessions/cf3ccfa8-c9cf-42df-876d-cbe0cd78ad2f.json new file mode 100644 index 0000000..65fa992 --- /dev/null +++ b/.omc/sessions/cf3ccfa8-c9cf-42df-876d-cbe0cd78ad2f.json @@ -0,0 +1,8 @@ +{ + "session_id": "cf3ccfa8-c9cf-42df-876d-cbe0cd78ad2f", + "ended_at": "2026-04-09T00:39:19.607Z", + "reason": "other", + "agents_spawned": 1, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/d541a73b-f1aa-4e3c-a6c6-6f00f7f2a58a.json b/.omc/sessions/d541a73b-f1aa-4e3c-a6c6-6f00f7f2a58a.json new file mode 100644 index 0000000..e90593a --- /dev/null +++ b/.omc/sessions/d541a73b-f1aa-4e3c-a6c6-6f00f7f2a58a.json @@ -0,0 +1,8 @@ +{ + "session_id": "d541a73b-f1aa-4e3c-a6c6-6f00f7f2a58a", + "ended_at": "2026-03-20T09:01:00.877Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/d6e019bb-7a92-4df7-a0f5-34964c37bd3d.json b/.omc/sessions/d6e019bb-7a92-4df7-a0f5-34964c37bd3d.json new file mode 100644 index 0000000..6dc907b --- /dev/null +++ b/.omc/sessions/d6e019bb-7a92-4df7-a0f5-34964c37bd3d.json @@ -0,0 +1,8 @@ +{ + "session_id": "d6e019bb-7a92-4df7-a0f5-34964c37bd3d", + "ended_at": "2026-03-20T09:04:49.218Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/e783cff2-839b-4686-bbc3-c8758d9c7b6c.json b/.omc/sessions/e783cff2-839b-4686-bbc3-c8758d9c7b6c.json new file mode 100644 index 0000000..d6c6ca1 --- /dev/null +++ b/.omc/sessions/e783cff2-839b-4686-bbc3-c8758d9c7b6c.json @@ -0,0 +1,8 @@ +{ + "session_id": "e783cff2-839b-4686-bbc3-c8758d9c7b6c", + "ended_at": "2026-03-20T09:08:39.117Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/f7263a26-c009-490e-992e-53a418b29eec.json b/.omc/sessions/f7263a26-c009-490e-992e-53a418b29eec.json new file mode 100644 index 0000000..aac7d0c --- /dev/null +++ b/.omc/sessions/f7263a26-c009-490e-992e-53a418b29eec.json @@ -0,0 +1,8 @@ +{ + "session_id": "f7263a26-c009-490e-992e-53a418b29eec", + "ended_at": "2026-04-09T00:34:13.090Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/.omc/sessions/f945f45a-c0d4-4a7e-b89f-0b41c163869a.json b/.omc/sessions/f945f45a-c0d4-4a7e-b89f-0b41c163869a.json new file mode 100644 index 0000000..3c1617b --- /dev/null +++ b/.omc/sessions/f945f45a-c0d4-4a7e-b89f-0b41c163869a.json @@ -0,0 +1,8 @@ +{ + "session_id": "f945f45a-c0d4-4a7e-b89f-0b41c163869a", + "ended_at": "2026-03-20T09:03:33.793Z", + "reason": "other", + "agents_spawned": 0, + "agents_completed": 0, + "modes_used": [] +} \ No newline at end of file diff --git a/cli_import.php b/cli_import.php index f799ad7..cec184b 100644 --- a/cli_import.php +++ b/cli_import.php @@ -1,4 +1,6 @@ Date: Thu, 9 Apr 2026 14:03:33 -0700 Subject: [PATCH 2/4] refactor: safe PHP 7.4 modernization (arrays, null coalescing) --- cli_import.php | 4 ++-- includes/polling.php | 2 +- setup.php | 12 ++++++------ thold_functions.php | 44 ++++++++++++++++++++++---------------------- thold_templates.php | 2 +- thold_webapi.php | 2 +- 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/cli_import.php b/cli_import.php index cec184b..575313d 100644 --- a/cli_import.php +++ b/cli_import.php @@ -105,9 +105,9 @@ // validate good xml $data = file_get_contents($filename); -$xml = xml2array($data); +$xml = xml2[$data]; -if (!is_array($xml) || !cacti_sizeof($xml)) { +if (!is_[$xml] || !cacti_sizeof($xml)) { print 'ERROR: The filename \'' . $filename . '\' is not a valid thold XML file.' . PHP_EOL . PHP_EOL; display_help(); exit(-1); diff --git a/includes/polling.php b/includes/polling.php index 2481be7..f97f466 100644 --- a/includes/polling.php +++ b/includes/polling.php @@ -867,7 +867,7 @@ function thold_update_host_status() { foreach ($hosts as $host) { // hosts in recovery status record only if they was in failed status - if (($host['status'] != HOST_RECOVERING) || ($host['status'] == HOST_RECOVERING && (is_array($failed) && array_search($host['id'], array_column($failed, 'host_id'), true) !== false))) { + if (($host['status'] != HOST_RECOVERING) || ($host['status'] == HOST_RECOVERING && (is_[$failed] && array_search($host['id'], array_column($failed, 'host_id'), true) !== false))) { $failed_ids .= ($failed_ids != '' ? '), (' : '(') . $host['id']; } } diff --git a/setup.php b/setup.php index 7e44d71..a2a3faa 100644 --- a/setup.php +++ b/setup.php @@ -292,7 +292,7 @@ function thold_rrd_graph_graph_options($g) { // map the data_template_rrd_id's to the datasource names $defs = explode("\\\n", $g['graph_defs'], -1); - if (is_array($defs)) { + if (is_[$defs]) { foreach ($defs as $def) { if (!substr_count($def, 'CDEF') && !substr_count($def, 'VDEF')) { $ddef = thold_multiexplode(['"', "'"], $def); @@ -409,7 +409,7 @@ function thold_rrd_graph_graph_options($g) { $i = 0; $unsets = []; - if (is_array($replacements)) { + if (is_[$replacements]) { foreach ($txt_items as $item) { foreach ($replacements as $key => $replace) { // cacti_log('Key:' . $key . ', Replace:' . $replace, false); @@ -732,7 +732,7 @@ function thold_device_action_prepare($save) { return $save; } -function thold_device_action_array($device_action_array) { +function thold_device_action_[$device_action_array] { $device_action_array['thold'] = 'Apply Thresholds'; return $device_action_array; @@ -1019,7 +1019,7 @@ function thold_data_source_action_prepare($save) { } } -function thold_data_source_action_array($action) { +function thold_data_source_action_[$action] { $action['plugin_thold_create'] = __('Create Threshold from Template', 'thold'); return $action; @@ -1183,7 +1183,7 @@ function thold_graphs_action_prepare($save) { } } -function thold_graphs_action_array($action) { +function thold_graphs_action_[$action] { $action['plugin_thold_create'] = __('Create Threshold from Template', 'thold'); return $action; @@ -1681,7 +1681,7 @@ function thold_data_source_remove($data_ids) { return $data_ids; } -function thold_clog_regex_array($regex_array) { +function thold_clog_regex_[$regex_array] { $regex_array[] = ['name' => 'TH', 'regex' => '( TH\[)([, \d]+)(\])', 'func' => 'thold_clog_regex_threshold']; return $regex_array; diff --git a/thold_functions.php b/thold_functions.php index 10a1bac..bd2d29e 100644 --- a/thold_functions.php +++ b/thold_functions.php @@ -555,13 +555,13 @@ function thold_expression_compare_rpn($operator, &$stack) { $v[0] = thold_expression_rpn_pop($stack); $v[1] = thold_expression_rpn_pop($stack); - if (in_array('INF', $v, true)) { + if (in_['INF', $v, true]) { array_push($stack, 'INF'); - } elseif (in_array('NEGINF', $v, true)) { + } elseif (in_['NEGINF', $v, true]) { array_push($stack, 'NEGINF'); - } elseif (in_array('U', $v, true)) { + } elseif (in_['U', $v, true]) { array_push($stack, 'U'); - } elseif (in_array('NAN', $v, true)) { + } elseif (in_['NAN', $v, true]) { array_push($stack, 'NAN'); } elseif ($operator == 'MAX') { array_push($stack, max($v)); @@ -1020,28 +1020,28 @@ function thold_calculate_expression($thold, $currentval, &$rrd_reindexed, &$rrd_ } elseif (array_key_exists($operator, $data_sources)) { // cacti_log("NOTE: DS Value '$operator'", false, "THOLD"); thold_expression_ds_value($operator, $stack, $data_sources); - } elseif (in_array($operator, $comparison, true)) { + } elseif (in_[$operator, $comparison, true]) { // cacti_log("NOTE: Compare '$operator'", false, "THOLD"); thold_expression_compare_rpn($operator, $stack); - } elseif (in_array($operator, $boolean, true)) { + } elseif (in_[$operator, $boolean, true]) { // cacti_log("NOTE: Boolean '$operator'", false, "THOLD"); thold_expression_boolean_rpn($operator, $stack); - } elseif (in_array($operator, $math, true)) { + } elseif (in_[$operator, $math, true]) { // cacti_log("NOTE: Math '$operator'", false, "THOLD"); thold_expression_math_rpn($operator, $stack); - } elseif (in_array($operator, $setops, true)) { + } elseif (in_[$operator, $setops, true]) { // cacti_log("NOTE: SetOps '$operator'", false, "THOLD"); thold_expression_setops_rpn($operator, $stack); - } elseif (in_array($operator, $specvals, true)) { + } elseif (in_[$operator, $specvals, true]) { // cacti_log("NOTE: SpecVals '$operator'", false, "THOLD"); thold_expression_specvals_rpn($operator, $stack, $cursor + 2); - } elseif (in_array($operator, $stackops, true)) { + } elseif (in_[$operator, $stackops, true]) { // cacti_log("NOTE: StackOps '$operator'", false, "THOLD"); thold_expression_stackops_rpn($operator, $stack); - } elseif (in_array($operator, $time, true)) { + } elseif (in_[$operator, $time, true]) { // cacti_log("NOTE: Time '$operator'", false, "THOLD"); thold_expression_time_rpn($operator, $stack); - } elseif (in_array($operator, $spectypes, true)) { + } elseif (in_[$operator, $spectypes, true]) { // cacti_log("NOTE: SpecialTypes '$operator'", false, "THOLD"); thold_expression_specialtype_rpn($operator, $stack, $thold['local_data_id'], $currentval); } else { @@ -1130,7 +1130,7 @@ function thold_substitute_host_data($string, $l_escape_string, $r_escape_string, * @return - the original string with all of the variable substitutions made */ function thold_substitute_custom_data($string, $l_escape, $r_escape, $local_data_id) { - if (is_array($local_data_id)) { + if (is_[$local_data_id]) { $local_data_ids = $local_data_id; } elseif ($local_data_id == '') { return; @@ -2212,7 +2212,7 @@ function thold_check_threshold(&$thold_data) { } // don't alert for this host if it's selected for maintenance - if (api_plugin_is_enabled('maint') || in_array('maint', $plugins, true)) { + if (api_plugin_is_enabled('maint') || in_['maint', $plugins, true]) { include_once($config['base_path'] . '/plugins/maint/functions.php'); } @@ -4591,7 +4591,7 @@ function thold_cdef_select_usable_names() { if (cacti_sizeof($cdefs)) { foreach ($cdefs as $cdef) { - if (in_array($cdef['id'], $ids, true)) { + if (in_[$cdef['id'], $ids, true]) { $cdef_names[$cdef['id']] = $cdef['name']; } } @@ -6390,11 +6390,11 @@ function autocreate($device_ids, $graph_ids = '', $graph_template_id = '', $thol $sql_where .= ($sql_where != '' ? ' AND ' : 'WHERE ') . 'gl.graph_template_id = ' . $graph_template_id; } - if (is_array($graph_ids) && cacti_sizeof($graph_ids)) { + if (is_[$graph_ids] && cacti_sizeof($graph_ids)) { $sql_where .= ($sql_where != '' ? ' AND ' : 'WHERE ') . 'gti.local_graph_id IN(' . implode(', ', $graph_ids) . ')'; } - if (is_array($device_ids)) { + if (is_[$device_ids]) { $sql_where .= ($sql_where != '' ? ' AND ' : 'WHERE ') . 'gl.host_id IN(' . implode($device_ids) . ')'; } elseif ($device_ids > 0) { $device_id = $device_ids; @@ -6521,7 +6521,7 @@ function autocreate($device_ids, $graph_ids = '', $graph_template_id = '', $thol } function thold_create_from_template($local_data_id, $local_graph_id, $data_template_rrd_id, $template_or_id, &$message) { - if (is_array($template_or_id)) { + if (is_[$template_or_id]) { $template = $template_or_id; } else { $template = db_fetch_row_prepared('SELECT * @@ -6637,7 +6637,7 @@ function thold_mail($to_email, $bcc_email, $from_email, $subject, $message, $fil $notification_queue = read_config_option('thold_notification_queue'); - if (is_array($filename) && sizeof($filename) && strstr($message, '') !== 0) { + if (is_[$filename] && sizeof($filename) && strstr($message, '') !== 0) { if (isset($filename['local_data_id'])) { $tmp = []; $tmp[] = $filename; @@ -6732,7 +6732,7 @@ function thold_mail($to_email, $bcc_email, $from_email, $subject, $message, $fil FROM plugin_config WHERE directory='thold'"); - if (!is_array($headers)) { + if (!is_[$headers]) { $headers = []; } @@ -8043,7 +8043,7 @@ function ia2xml($array) { if (cacti_sizeof($array)) { foreach ($array as $key=>$value) { - if (is_array($value)) { + if (is_[$value]) { $xml .= "\t<$key>" . ia2xml($value) . "\n"; } else { $xml .= "\t<$key>" . html_escape($value) . "\n"; @@ -8328,7 +8328,7 @@ function thold_template_import($xml_data) { if ($xml_data != '') { // obtain debug information if it's set - $xml_array = xml2array($xml_data); + $xml_array = xml2[$xml_data]; if (cacti_sizeof($xml_array)) { foreach ($xml_array as $template => $contents) { diff --git a/thold_templates.php b/thold_templates.php index 2cae07b..a193952 100644 --- a/thold_templates.php +++ b/thold_templates.php @@ -2430,7 +2430,7 @@ function import() { form_start('thold_templates.php', 'chk', true); - if ((isset($_SESSION['import_debug_info'])) && (is_array($_SESSION['import_debug_info']))) { + if ((isset($_SESSION['import_debug_info'])) && (is_[$_SESSION['import_debug_info']])) { html_start_box(__('Import Results', 'thold'), '80%', false, '3', 'center', ''); print '' . __('Cacti has imported the following items:', 'thold') . ''; diff --git a/thold_webapi.php b/thold_webapi.php index 2da9665..9ddee36 100644 --- a/thold_webapi.php +++ b/thold_webapi.php @@ -177,7 +177,7 @@ function thold_add_graphs_action_prepare() { bottom_footer(); } -function thold_add_graphs_action_array($action) { +function thold_add_graphs_action_[$action] { $action['plugin_thold_create'] = __('Create Threshold from Template', 'thold'); return $action; From 8ced88dc2fd9567d62aa5be00a83955e20877384 Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Thu, 9 Apr 2026 22:37:02 -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 + .../13078be2-490d-4463-b1cb-d4f18ed4f17b.json | 8 ---- .../1d8db818-d03e-49db-b914-885d353ec217.json | 8 ---- .../329f355f-e88f-4898-8ed5-0982ae2e7e4d.json | 8 ---- .../3bb2f627-a069-454e-92ae-36433f072136.json | 8 ---- .../4ce27694-4715-413d-b907-b9f5a1265d19.json | 8 ---- .../692e33b9-e73c-4d0f-8f73-2aa864795a7b.json | 8 ---- .../71d55ede-992a-425f-8f99-53fbce80a343.json | 8 ---- .../7f1e4ef4-707d-49b3-b57d-16f7220a8d12.json | 8 ---- .../827ec296-29cc-4cd8-8331-f73fdd756f37.json | 8 ---- .../9641f786-5142-4ae1-9e18-b11f5e6fb816.json | 8 ---- .../96a4b59a-d5a8-43cd-af25-0597cbf12107.json | 8 ---- .../a408d1a5-f516-4379-9a1e-35398aa29599.json | 8 ---- .../a5b592a5-38aa-4b11-bf0a-5d0d087615b5.json | 8 ---- .../bf809b2e-0eed-4a7e-b895-01510e5d6b9d.json | 8 ---- .../cbf69f79-e236-4d9c-9289-4333f5f3c545.json | 8 ---- .../cf3ccfa8-c9cf-42df-876d-cbe0cd78ad2f.json | 8 ---- .../d541a73b-f1aa-4e3c-a6c6-6f00f7f2a58a.json | 8 ---- .../d6e019bb-7a92-4df7-a0f5-34964c37bd3d.json | 8 ---- .../e783cff2-839b-4686-bbc3-c8758d9c7b6c.json | 8 ---- .../f7263a26-c009-490e-992e-53a418b29eec.json | 8 ---- .../f945f45a-c0d4-4a7e-b89f-0b41c163869a.json | 8 ---- cli_import.php | 4 +- includes/polling.php | 2 +- setup.php | 4 +- thold_functions.php | 44 +++++++++---------- thold_templates.php | 2 +- 27 files changed, 29 insertions(+), 196 deletions(-) delete mode 100644 .omc/sessions/13078be2-490d-4463-b1cb-d4f18ed4f17b.json delete mode 100644 .omc/sessions/1d8db818-d03e-49db-b914-885d353ec217.json delete mode 100644 .omc/sessions/329f355f-e88f-4898-8ed5-0982ae2e7e4d.json delete mode 100644 .omc/sessions/3bb2f627-a069-454e-92ae-36433f072136.json delete mode 100644 .omc/sessions/4ce27694-4715-413d-b907-b9f5a1265d19.json delete mode 100644 .omc/sessions/692e33b9-e73c-4d0f-8f73-2aa864795a7b.json delete mode 100644 .omc/sessions/71d55ede-992a-425f-8f99-53fbce80a343.json delete mode 100644 .omc/sessions/7f1e4ef4-707d-49b3-b57d-16f7220a8d12.json delete mode 100644 .omc/sessions/827ec296-29cc-4cd8-8331-f73fdd756f37.json delete mode 100644 .omc/sessions/9641f786-5142-4ae1-9e18-b11f5e6fb816.json delete mode 100644 .omc/sessions/96a4b59a-d5a8-43cd-af25-0597cbf12107.json delete mode 100644 .omc/sessions/a408d1a5-f516-4379-9a1e-35398aa29599.json delete mode 100644 .omc/sessions/a5b592a5-38aa-4b11-bf0a-5d0d087615b5.json delete mode 100644 .omc/sessions/bf809b2e-0eed-4a7e-b895-01510e5d6b9d.json delete mode 100644 .omc/sessions/cbf69f79-e236-4d9c-9289-4333f5f3c545.json delete mode 100644 .omc/sessions/cf3ccfa8-c9cf-42df-876d-cbe0cd78ad2f.json delete mode 100644 .omc/sessions/d541a73b-f1aa-4e3c-a6c6-6f00f7f2a58a.json delete mode 100644 .omc/sessions/d6e019bb-7a92-4df7-a0f5-34964c37bd3d.json delete mode 100644 .omc/sessions/e783cff2-839b-4686-bbc3-c8758d9c7b6c.json delete mode 100644 .omc/sessions/f7263a26-c009-490e-992e-53a418b29eec.json delete mode 100644 .omc/sessions/f945f45a-c0d4-4a7e-b89f-0b41c163869a.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/13078be2-490d-4463-b1cb-d4f18ed4f17b.json b/.omc/sessions/13078be2-490d-4463-b1cb-d4f18ed4f17b.json deleted file mode 100644 index 6cfe93f..0000000 --- a/.omc/sessions/13078be2-490d-4463-b1cb-d4f18ed4f17b.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "13078be2-490d-4463-b1cb-d4f18ed4f17b", - "ended_at": "2026-03-20T09:00:16.101Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/1d8db818-d03e-49db-b914-885d353ec217.json b/.omc/sessions/1d8db818-d03e-49db-b914-885d353ec217.json deleted file mode 100644 index 14c4e08..0000000 --- a/.omc/sessions/1d8db818-d03e-49db-b914-885d353ec217.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "1d8db818-d03e-49db-b914-885d353ec217", - "ended_at": "2026-04-09T00:35:12.552Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/329f355f-e88f-4898-8ed5-0982ae2e7e4d.json b/.omc/sessions/329f355f-e88f-4898-8ed5-0982ae2e7e4d.json deleted file mode 100644 index fc00a1b..0000000 --- a/.omc/sessions/329f355f-e88f-4898-8ed5-0982ae2e7e4d.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "329f355f-e88f-4898-8ed5-0982ae2e7e4d", - "ended_at": "2026-03-20T09:01:27.725Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/3bb2f627-a069-454e-92ae-36433f072136.json b/.omc/sessions/3bb2f627-a069-454e-92ae-36433f072136.json deleted file mode 100644 index 14eaa8c..0000000 --- a/.omc/sessions/3bb2f627-a069-454e-92ae-36433f072136.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "3bb2f627-a069-454e-92ae-36433f072136", - "ended_at": "2026-03-20T09:00:07.165Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/4ce27694-4715-413d-b907-b9f5a1265d19.json b/.omc/sessions/4ce27694-4715-413d-b907-b9f5a1265d19.json deleted file mode 100644 index ce2bcda..0000000 --- a/.omc/sessions/4ce27694-4715-413d-b907-b9f5a1265d19.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "4ce27694-4715-413d-b907-b9f5a1265d19", - "ended_at": "2026-04-09T00:34:04.604Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/692e33b9-e73c-4d0f-8f73-2aa864795a7b.json b/.omc/sessions/692e33b9-e73c-4d0f-8f73-2aa864795a7b.json deleted file mode 100644 index e94c870..0000000 --- a/.omc/sessions/692e33b9-e73c-4d0f-8f73-2aa864795a7b.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "692e33b9-e73c-4d0f-8f73-2aa864795a7b", - "ended_at": "2026-03-20T08:58:36.240Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/71d55ede-992a-425f-8f99-53fbce80a343.json b/.omc/sessions/71d55ede-992a-425f-8f99-53fbce80a343.json deleted file mode 100644 index f111af1..0000000 --- a/.omc/sessions/71d55ede-992a-425f-8f99-53fbce80a343.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "71d55ede-992a-425f-8f99-53fbce80a343", - "ended_at": "2026-03-20T09:08:58.080Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/7f1e4ef4-707d-49b3-b57d-16f7220a8d12.json b/.omc/sessions/7f1e4ef4-707d-49b3-b57d-16f7220a8d12.json deleted file mode 100644 index cdcc3ea..0000000 --- a/.omc/sessions/7f1e4ef4-707d-49b3-b57d-16f7220a8d12.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "7f1e4ef4-707d-49b3-b57d-16f7220a8d12", - "ended_at": "2026-03-20T09:12:42.138Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/827ec296-29cc-4cd8-8331-f73fdd756f37.json b/.omc/sessions/827ec296-29cc-4cd8-8331-f73fdd756f37.json deleted file mode 100644 index 3d4ae31..0000000 --- a/.omc/sessions/827ec296-29cc-4cd8-8331-f73fdd756f37.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "827ec296-29cc-4cd8-8331-f73fdd756f37", - "ended_at": "2026-03-20T09:06:13.250Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/9641f786-5142-4ae1-9e18-b11f5e6fb816.json b/.omc/sessions/9641f786-5142-4ae1-9e18-b11f5e6fb816.json deleted file mode 100644 index 698d904..0000000 --- a/.omc/sessions/9641f786-5142-4ae1-9e18-b11f5e6fb816.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "9641f786-5142-4ae1-9e18-b11f5e6fb816", - "ended_at": "2026-03-20T09:04:54.035Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/96a4b59a-d5a8-43cd-af25-0597cbf12107.json b/.omc/sessions/96a4b59a-d5a8-43cd-af25-0597cbf12107.json deleted file mode 100644 index d2f0ba7..0000000 --- a/.omc/sessions/96a4b59a-d5a8-43cd-af25-0597cbf12107.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "96a4b59a-d5a8-43cd-af25-0597cbf12107", - "ended_at": "2026-03-20T09:09:46.449Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/a408d1a5-f516-4379-9a1e-35398aa29599.json b/.omc/sessions/a408d1a5-f516-4379-9a1e-35398aa29599.json deleted file mode 100644 index 4970978..0000000 --- a/.omc/sessions/a408d1a5-f516-4379-9a1e-35398aa29599.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "a408d1a5-f516-4379-9a1e-35398aa29599", - "ended_at": "2026-03-20T09:15:19.129Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/a5b592a5-38aa-4b11-bf0a-5d0d087615b5.json b/.omc/sessions/a5b592a5-38aa-4b11-bf0a-5d0d087615b5.json deleted file mode 100644 index 5f7086f..0000000 --- a/.omc/sessions/a5b592a5-38aa-4b11-bf0a-5d0d087615b5.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "a5b592a5-38aa-4b11-bf0a-5d0d087615b5", - "ended_at": "2026-03-20T08:58:27.595Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/bf809b2e-0eed-4a7e-b895-01510e5d6b9d.json b/.omc/sessions/bf809b2e-0eed-4a7e-b895-01510e5d6b9d.json deleted file mode 100644 index c4a0698..0000000 --- a/.omc/sessions/bf809b2e-0eed-4a7e-b895-01510e5d6b9d.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "bf809b2e-0eed-4a7e-b895-01510e5d6b9d", - "ended_at": "2026-04-09T00:38:16.535Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/cbf69f79-e236-4d9c-9289-4333f5f3c545.json b/.omc/sessions/cbf69f79-e236-4d9c-9289-4333f5f3c545.json deleted file mode 100644 index 729cf33..0000000 --- a/.omc/sessions/cbf69f79-e236-4d9c-9289-4333f5f3c545.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "cbf69f79-e236-4d9c-9289-4333f5f3c545", - "ended_at": "2026-03-20T09:11:26.115Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/cf3ccfa8-c9cf-42df-876d-cbe0cd78ad2f.json b/.omc/sessions/cf3ccfa8-c9cf-42df-876d-cbe0cd78ad2f.json deleted file mode 100644 index 65fa992..0000000 --- a/.omc/sessions/cf3ccfa8-c9cf-42df-876d-cbe0cd78ad2f.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "cf3ccfa8-c9cf-42df-876d-cbe0cd78ad2f", - "ended_at": "2026-04-09T00:39:19.607Z", - "reason": "other", - "agents_spawned": 1, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/d541a73b-f1aa-4e3c-a6c6-6f00f7f2a58a.json b/.omc/sessions/d541a73b-f1aa-4e3c-a6c6-6f00f7f2a58a.json deleted file mode 100644 index e90593a..0000000 --- a/.omc/sessions/d541a73b-f1aa-4e3c-a6c6-6f00f7f2a58a.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "d541a73b-f1aa-4e3c-a6c6-6f00f7f2a58a", - "ended_at": "2026-03-20T09:01:00.877Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/d6e019bb-7a92-4df7-a0f5-34964c37bd3d.json b/.omc/sessions/d6e019bb-7a92-4df7-a0f5-34964c37bd3d.json deleted file mode 100644 index 6dc907b..0000000 --- a/.omc/sessions/d6e019bb-7a92-4df7-a0f5-34964c37bd3d.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "d6e019bb-7a92-4df7-a0f5-34964c37bd3d", - "ended_at": "2026-03-20T09:04:49.218Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/e783cff2-839b-4686-bbc3-c8758d9c7b6c.json b/.omc/sessions/e783cff2-839b-4686-bbc3-c8758d9c7b6c.json deleted file mode 100644 index d6c6ca1..0000000 --- a/.omc/sessions/e783cff2-839b-4686-bbc3-c8758d9c7b6c.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "e783cff2-839b-4686-bbc3-c8758d9c7b6c", - "ended_at": "2026-03-20T09:08:39.117Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/f7263a26-c009-490e-992e-53a418b29eec.json b/.omc/sessions/f7263a26-c009-490e-992e-53a418b29eec.json deleted file mode 100644 index aac7d0c..0000000 --- a/.omc/sessions/f7263a26-c009-490e-992e-53a418b29eec.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "f7263a26-c009-490e-992e-53a418b29eec", - "ended_at": "2026-04-09T00:34:13.090Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/.omc/sessions/f945f45a-c0d4-4a7e-b89f-0b41c163869a.json b/.omc/sessions/f945f45a-c0d4-4a7e-b89f-0b41c163869a.json deleted file mode 100644 index 3c1617b..0000000 --- a/.omc/sessions/f945f45a-c0d4-4a7e-b89f-0b41c163869a.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "f945f45a-c0d4-4a7e-b89f-0b41c163869a", - "ended_at": "2026-03-20T09:03:33.793Z", - "reason": "other", - "agents_spawned": 0, - "agents_completed": 0, - "modes_used": [] -} \ No newline at end of file diff --git a/cli_import.php b/cli_import.php index 575313d..cec184b 100644 --- a/cli_import.php +++ b/cli_import.php @@ -105,9 +105,9 @@ // validate good xml $data = file_get_contents($filename); -$xml = xml2[$data]; +$xml = xml2array($data); -if (!is_[$xml] || !cacti_sizeof($xml)) { +if (!is_array($xml) || !cacti_sizeof($xml)) { print 'ERROR: The filename \'' . $filename . '\' is not a valid thold XML file.' . PHP_EOL . PHP_EOL; display_help(); exit(-1); diff --git a/includes/polling.php b/includes/polling.php index f97f466..2481be7 100644 --- a/includes/polling.php +++ b/includes/polling.php @@ -867,7 +867,7 @@ function thold_update_host_status() { foreach ($hosts as $host) { // hosts in recovery status record only if they was in failed status - if (($host['status'] != HOST_RECOVERING) || ($host['status'] == HOST_RECOVERING && (is_[$failed] && array_search($host['id'], array_column($failed, 'host_id'), true) !== false))) { + if (($host['status'] != HOST_RECOVERING) || ($host['status'] == HOST_RECOVERING && (is_array($failed) && array_search($host['id'], array_column($failed, 'host_id'), true) !== false))) { $failed_ids .= ($failed_ids != '' ? '), (' : '(') . $host['id']; } } diff --git a/setup.php b/setup.php index a2a3faa..fec2935 100644 --- a/setup.php +++ b/setup.php @@ -292,7 +292,7 @@ function thold_rrd_graph_graph_options($g) { // map the data_template_rrd_id's to the datasource names $defs = explode("\\\n", $g['graph_defs'], -1); - if (is_[$defs]) { + if (is_array($defs)) { foreach ($defs as $def) { if (!substr_count($def, 'CDEF') && !substr_count($def, 'VDEF')) { $ddef = thold_multiexplode(['"', "'"], $def); @@ -409,7 +409,7 @@ function thold_rrd_graph_graph_options($g) { $i = 0; $unsets = []; - if (is_[$replacements]) { + if (is_array($replacements)) { foreach ($txt_items as $item) { foreach ($replacements as $key => $replace) { // cacti_log('Key:' . $key . ', Replace:' . $replace, false); diff --git a/thold_functions.php b/thold_functions.php index bd2d29e..21ca7b6 100644 --- a/thold_functions.php +++ b/thold_functions.php @@ -555,13 +555,13 @@ function thold_expression_compare_rpn($operator, &$stack) { $v[0] = thold_expression_rpn_pop($stack); $v[1] = thold_expression_rpn_pop($stack); - if (in_['INF', $v, true]) { + if (in_array('INF', $v, true)) { array_push($stack, 'INF'); - } elseif (in_['NEGINF', $v, true]) { + } elseif (in_array('NEGINF', $v, true)) { array_push($stack, 'NEGINF'); - } elseif (in_['U', $v, true]) { + } elseif (in_array('U', $v, true)) { array_push($stack, 'U'); - } elseif (in_['NAN', $v, true]) { + } elseif (in_array('NAN', $v, true)) { array_push($stack, 'NAN'); } elseif ($operator == 'MAX') { array_push($stack, max($v)); @@ -1020,28 +1020,28 @@ function thold_calculate_expression($thold, $currentval, &$rrd_reindexed, &$rrd_ } elseif (array_key_exists($operator, $data_sources)) { // cacti_log("NOTE: DS Value '$operator'", false, "THOLD"); thold_expression_ds_value($operator, $stack, $data_sources); - } elseif (in_[$operator, $comparison, true]) { + } elseif (in_array($operator, $comparison, true)) { // cacti_log("NOTE: Compare '$operator'", false, "THOLD"); thold_expression_compare_rpn($operator, $stack); - } elseif (in_[$operator, $boolean, true]) { + } elseif (in_array($operator, $boolean, true)) { // cacti_log("NOTE: Boolean '$operator'", false, "THOLD"); thold_expression_boolean_rpn($operator, $stack); - } elseif (in_[$operator, $math, true]) { + } elseif (in_array($operator, $math, true)) { // cacti_log("NOTE: Math '$operator'", false, "THOLD"); thold_expression_math_rpn($operator, $stack); - } elseif (in_[$operator, $setops, true]) { + } elseif (in_array($operator, $setops, true)) { // cacti_log("NOTE: SetOps '$operator'", false, "THOLD"); thold_expression_setops_rpn($operator, $stack); - } elseif (in_[$operator, $specvals, true]) { + } elseif (in_array($operator, $specvals, true)) { // cacti_log("NOTE: SpecVals '$operator'", false, "THOLD"); thold_expression_specvals_rpn($operator, $stack, $cursor + 2); - } elseif (in_[$operator, $stackops, true]) { + } elseif (in_array($operator, $stackops, true)) { // cacti_log("NOTE: StackOps '$operator'", false, "THOLD"); thold_expression_stackops_rpn($operator, $stack); - } elseif (in_[$operator, $time, true]) { + } elseif (in_array($operator, $time, true)) { // cacti_log("NOTE: Time '$operator'", false, "THOLD"); thold_expression_time_rpn($operator, $stack); - } elseif (in_[$operator, $spectypes, true]) { + } elseif (in_array($operator, $spectypes, true)) { // cacti_log("NOTE: SpecialTypes '$operator'", false, "THOLD"); thold_expression_specialtype_rpn($operator, $stack, $thold['local_data_id'], $currentval); } else { @@ -1130,7 +1130,7 @@ function thold_substitute_host_data($string, $l_escape_string, $r_escape_string, * @return - the original string with all of the variable substitutions made */ function thold_substitute_custom_data($string, $l_escape, $r_escape, $local_data_id) { - if (is_[$local_data_id]) { + if (is_array($local_data_id)) { $local_data_ids = $local_data_id; } elseif ($local_data_id == '') { return; @@ -2212,7 +2212,7 @@ function thold_check_threshold(&$thold_data) { } // don't alert for this host if it's selected for maintenance - if (api_plugin_is_enabled('maint') || in_['maint', $plugins, true]) { + if (api_plugin_is_enabled('maint') || in_array('maint', $plugins, true)) { include_once($config['base_path'] . '/plugins/maint/functions.php'); } @@ -4591,7 +4591,7 @@ function thold_cdef_select_usable_names() { if (cacti_sizeof($cdefs)) { foreach ($cdefs as $cdef) { - if (in_[$cdef['id'], $ids, true]) { + if (in_array($cdef['id'), $ids, true]) { $cdef_names[$cdef['id']] = $cdef['name']; } } @@ -6390,11 +6390,11 @@ function autocreate($device_ids, $graph_ids = '', $graph_template_id = '', $thol $sql_where .= ($sql_where != '' ? ' AND ' : 'WHERE ') . 'gl.graph_template_id = ' . $graph_template_id; } - if (is_[$graph_ids] && cacti_sizeof($graph_ids)) { + if (is_array($graph_ids) && cacti_sizeof($graph_ids)) { $sql_where .= ($sql_where != '' ? ' AND ' : 'WHERE ') . 'gti.local_graph_id IN(' . implode(', ', $graph_ids) . ')'; } - if (is_[$device_ids]) { + if (is_array($device_ids)) { $sql_where .= ($sql_where != '' ? ' AND ' : 'WHERE ') . 'gl.host_id IN(' . implode($device_ids) . ')'; } elseif ($device_ids > 0) { $device_id = $device_ids; @@ -6521,7 +6521,7 @@ function autocreate($device_ids, $graph_ids = '', $graph_template_id = '', $thol } function thold_create_from_template($local_data_id, $local_graph_id, $data_template_rrd_id, $template_or_id, &$message) { - if (is_[$template_or_id]) { + if (is_array($template_or_id)) { $template = $template_or_id; } else { $template = db_fetch_row_prepared('SELECT * @@ -6637,7 +6637,7 @@ function thold_mail($to_email, $bcc_email, $from_email, $subject, $message, $fil $notification_queue = read_config_option('thold_notification_queue'); - if (is_[$filename] && sizeof($filename) && strstr($message, '') !== 0) { + if (is_array($filename) && sizeof($filename) && strstr($message, '') !== 0) { if (isset($filename['local_data_id'])) { $tmp = []; $tmp[] = $filename; @@ -6732,7 +6732,7 @@ function thold_mail($to_email, $bcc_email, $from_email, $subject, $message, $fil FROM plugin_config WHERE directory='thold'"); - if (!is_[$headers]) { + if (!is_array($headers)) { $headers = []; } @@ -8043,7 +8043,7 @@ function ia2xml($array) { if (cacti_sizeof($array)) { foreach ($array as $key=>$value) { - if (is_[$value]) { + if (is_array($value)) { $xml .= "\t<$key>" . ia2xml($value) . "\n"; } else { $xml .= "\t<$key>" . html_escape($value) . "\n"; @@ -8328,7 +8328,7 @@ function thold_template_import($xml_data) { if ($xml_data != '') { // obtain debug information if it's set - $xml_array = xml2[$xml_data]; + $xml_array = xml2array($xml_data); if (cacti_sizeof($xml_array)) { foreach ($xml_array as $template => $contents) { diff --git a/thold_templates.php b/thold_templates.php index a193952..d1c30c0 100644 --- a/thold_templates.php +++ b/thold_templates.php @@ -2430,7 +2430,7 @@ function import() { form_start('thold_templates.php', 'chk', true); - if ((isset($_SESSION['import_debug_info'])) && (is_[$_SESSION['import_debug_info']])) { + if ((isset($_SESSION['import_debug_info'])) && (is_array($_SESSION['import_debug_info')])) { html_start_box(__('Import Results', 'thold'), '80%', false, '3', 'center', ''); print '' . __('Cacti has imported the following items:', 'thold') . ''; From 907391e30e6c2a4b77676083a1e32620e7632ba5 Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Fri, 10 Apr 2026 01:37:01 -0700 Subject: [PATCH 4/4] fix: restore corrupted is_array($_SESSION['import_debug_info']) calls Signed-off-by: Thomas Vincent --- setup.php | 8 ++++---- thold_functions.php | 2 +- thold_templates.php | 2 +- thold_webapi.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/setup.php b/setup.php index fec2935..7e44d71 100644 --- a/setup.php +++ b/setup.php @@ -732,7 +732,7 @@ function thold_device_action_prepare($save) { return $save; } -function thold_device_action_[$device_action_array] { +function thold_device_action_array($device_action_array) { $device_action_array['thold'] = 'Apply Thresholds'; return $device_action_array; @@ -1019,7 +1019,7 @@ function thold_data_source_action_prepare($save) { } } -function thold_data_source_action_[$action] { +function thold_data_source_action_array($action) { $action['plugin_thold_create'] = __('Create Threshold from Template', 'thold'); return $action; @@ -1183,7 +1183,7 @@ function thold_graphs_action_prepare($save) { } } -function thold_graphs_action_[$action] { +function thold_graphs_action_array($action) { $action['plugin_thold_create'] = __('Create Threshold from Template', 'thold'); return $action; @@ -1681,7 +1681,7 @@ function thold_data_source_remove($data_ids) { return $data_ids; } -function thold_clog_regex_[$regex_array] { +function thold_clog_regex_array($regex_array) { $regex_array[] = ['name' => 'TH', 'regex' => '( TH\[)([, \d]+)(\])', 'func' => 'thold_clog_regex_threshold']; return $regex_array; diff --git a/thold_functions.php b/thold_functions.php index 21ca7b6..10a1bac 100644 --- a/thold_functions.php +++ b/thold_functions.php @@ -4591,7 +4591,7 @@ function thold_cdef_select_usable_names() { if (cacti_sizeof($cdefs)) { foreach ($cdefs as $cdef) { - if (in_array($cdef['id'), $ids, true]) { + if (in_array($cdef['id'], $ids, true)) { $cdef_names[$cdef['id']] = $cdef['name']; } } diff --git a/thold_templates.php b/thold_templates.php index d1c30c0..2cae07b 100644 --- a/thold_templates.php +++ b/thold_templates.php @@ -2430,7 +2430,7 @@ function import() { form_start('thold_templates.php', 'chk', true); - if ((isset($_SESSION['import_debug_info'])) && (is_array($_SESSION['import_debug_info')])) { + if ((isset($_SESSION['import_debug_info'])) && (is_array($_SESSION['import_debug_info']))) { html_start_box(__('Import Results', 'thold'), '80%', false, '3', 'center', ''); print '' . __('Cacti has imported the following items:', 'thold') . ''; diff --git a/thold_webapi.php b/thold_webapi.php index 9ddee36..2da9665 100644 --- a/thold_webapi.php +++ b/thold_webapi.php @@ -177,7 +177,7 @@ function thold_add_graphs_action_prepare() { bottom_footer(); } -function thold_add_graphs_action_[$action] { +function thold_add_graphs_action_array($action) { $action['plugin_thold_create'] = __('Create Threshold from Template', 'thold'); return $action;