From 68654804b4be4d8e4f2e2b1412f88c0ac8193047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gonz=C3=A1lez?= Date: Wed, 14 Sep 2022 17:18:39 +0200 Subject: [PATCH] Fixed minor issue --- pandora_console/include/functions.php | 28 +++++++++++++++++++ .../operation/agentes/status_monitor.php | 27 ------------------ 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index ca958dd4a3..f206800c61 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -6217,3 +6217,31 @@ function notify_reporting_console_node() return $return; } + + +/** + * Auxiliar Ordenation function + * + * @param string $sort Direction of sort. + * @param string $sortField Field for perform the sorting. + * + * @return mixed + */ +function arrayOutputSorting($sort, $sortField) +{ + return function ($a, $b) use ($sort, $sortField) { + if ($sort === 'up') { + if (is_string($a[$sortField]) === true) { + return strnatcmp($a[$sortField], $b[$sortField]); + } else { + return ($a[$sortField] - $b[$sortField]); + } + } else { + if (is_string($a[$sortField]) === true) { + return strnatcmp($b[$sortField], $a[$sortField]); + } else { + return ($a[$sortField] + $b[$sortField]); + } + } + }; +} diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index c39b2cabf3..bff5c006f3 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -1216,33 +1216,6 @@ if ($autosearch) { $result = array_merge($result, $result_server); } - - /** - * Auxiliar Ordenation function - * - * @param string $sort Direction of sort. - * @param string $sortField Field for perform the sorting. - */ - function arrayOutputSorting($sort, $sortField) - { - return function ($a, $b) use ($sort, $sortField) { - if ($sort === 'up') { - if (is_string($a[$sortField]) === true) { - return strnatcmp($a[$sortField], $b[$sortField]); - } else { - return ($a[$sortField] - $b[$sortField]); - } - } else { - if (is_string($a[$sortField]) === true) { - return strnatcmp($b[$sortField], $a[$sortField]); - } else { - return ($a[$sortField] + $b[$sortField]); - } - } - }; - } - - usort($result, arrayOutputSorting($sort, $sortField)); metaconsole_restore_db();