From 0f832c7aec8893359406f56b66020cd1ab11588d Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Tue, 30 May 2023 10:48:46 +0200 Subject: [PATCH 001/103] #11351 We added the required property in the Enterprise String, Custom Value/OID, SNMP Agent(IP) fields --- pandora_console/godmode/snmpconsole/snmp_alert.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index 2b28ae4e94..570b49b8c4 100755 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -786,7 +786,7 @@ if ($create_alert || $update_alert) { 2, 2, $custom_value, - 'class="w100p"', + 'class="w100p" required="required"', true ) ); @@ -804,6 +804,8 @@ if ($create_alert || $update_alert) { '', 50, 255, + true, + false, true ) ); @@ -818,6 +820,8 @@ if ($create_alert || $update_alert) { '', 20, 255, + true, + false, true ) ); From f4826e5634641c00cf82618bc07d2549a10910a4 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Wed, 31 May 2023 16:13:26 +0200 Subject: [PATCH 002/103] #11377 Modify db_get_all_rows_filter when send group All --- .../godmode/massive/massive_delete_profiles.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/massive/massive_delete_profiles.php b/pandora_console/godmode/massive/massive_delete_profiles.php index 46824e90ba..22cb04b632 100644 --- a/pandora_console/godmode/massive/massive_delete_profiles.php +++ b/pandora_console/godmode/massive/massive_delete_profiles.php @@ -68,7 +68,21 @@ if (is_ajax()) { $id_group = get_parameter('id_group'); $id_profile = get_parameter('id_profile'); - $profile_data = db_get_all_rows_filter('tusuario_perfil', ['id_perfil' => $id_profile[0], 'id_grupo' => $id_group[0]]); + if ($id_group[0] === '0' || $id_group[0] === '') { + $profile_data = db_get_all_rows_filter( + 'tusuario_perfil', + ['id_perfil' => $id_profile[0]] + ); + } else { + $profile_data = db_get_all_rows_filter( + 'tusuario_perfil', + [ + 'id_perfil' => $id_profile[0], + 'id_grupo' => $id_group[0], + ] + ); + } + if (!users_is_admin()) { foreach ($profile_data as $user => $values) { if (users_is_admin($values['id_usuario'])) { From 4b4e2b02660019eccad9e6d7288a442d5998a6cd Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Mon, 5 Jun 2023 16:05:38 +0200 Subject: [PATCH 003/103] #10875 add mw250px to comment column --- pandora_console/operation/events/events.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index d1d653777a..8b734743f8 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -2393,6 +2393,14 @@ try { ]; } + $user_comment = array_search('user_comment', $fields); + if ($user_comment !== false) { + $fields[$user_comment] = [ + 'text' => 'user_comment', + 'class' => 'mw250px', + ]; + } + // Always add options column. $fields = array_merge( $fields, From a59f29f557f8f2f112bf896a41735e1ac8edb0bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Su=C3=A1rez?= Date: Thu, 8 Jun 2023 10:14:54 -0600 Subject: [PATCH 004/103] Remove transactional_agent references --- pandora_console/pandoradb.sql | 2 -- pandora_server/lib/PandoraFMS/Core.pm | 20 -------------------- pandora_server/lib/PandoraFMS/DataServer.pm | 12 ------------ 3 files changed, 34 deletions(-) diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 8706e37fed..5083e060a6 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -85,7 +85,6 @@ CREATE TABLE IF NOT EXISTS `tagente` ( `update_alert_count` TINYINT NOT NULL DEFAULT 0, `update_secondary_groups` TINYINT NOT NULL DEFAULT 0, `alias` VARCHAR(600) NOT NULL DEFAULT '', - `transactional_agent` TINYINT NOT NULL DEFAULT 0, `alias_as_name` TINYINT NOT NULL DEFAULT 0, `safe_mode_module` INT UNSIGNED NOT NULL DEFAULT 0, `cps` INT NOT NULL DEFAULT 0, @@ -3431,7 +3430,6 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` ( `update_module_count` TINYINT NOT NULL DEFAULT 0, `update_alert_count` TINYINT NOT NULL DEFAULT 0, `update_secondary_groups` TINYINT NOT NULL DEFAULT 0, - `transactional_agent` TINYINT NOT NULL DEFAULT 0, `alias` VARCHAR(600) NOT NULL DEFAULT '', `alias_as_name` TINYINT NOT NULL DEFAULT 0, `safe_mode_module` INT UNSIGNED NOT NULL DEFAULT 0, diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 06deaa4331..5b5e60a1f9 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -257,7 +257,6 @@ our @EXPORT = qw( pandora_update_server pandora_update_table_from_hash pandora_update_template_module - pandora_mark_transactional_agent pandora_group_statistics pandora_server_statistics pandora_self_monitoring @@ -3280,25 +3279,6 @@ sub pandora_update_agent ($$$$$$$;$$$) { db_do ($dbh, "UPDATE tagente SET $set WHERE id_agente = ?", @{$values}, $agent_id); } - -########################################################################## -=head2 C<< pandora_mark_transactional_agent (I<$id_agente>) >> - -Set an agent as transactional agent - -=cut -########################################################################## -sub pandora_mark_transactional_agent($$) { - my ($dbh, $id_agente) = @_; - - if ( (!(defined($id_agente))) || (!(defined($dbh))) ) { - return; - } - - db_do ($dbh, "UPDATE tagente SET transactional_agent=1 WHERE id_agente = ?", $id_agente); -} - - ########################################################################## =head2 C<< pandora_update_gis_data (I<$pa_config>, I<$dbh>, I<$agent_id>, I<$longitude>, I<$latitude>, I<$altitude>) >> diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index ac4364dca1..f3bc720a34 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -759,13 +759,6 @@ sub process_module_data ($$$$$$$$$$) { # Name XML tag and column name don't match $module_conf->{'nombre'} = safe_input($module_name); - # Check if module is 'Transactional subsystem status' - my $enable_transactional_subsystem = 0; - if ($module_conf->{'name'} eq "Transactional subsystem status") { - $enable_transactional_subsystem = 1; - } - delete $module_conf->{'name'}; - # Calculate the module interval in seconds if (defined($module_conf->{'cron_interval'})) { $module_conf->{'module_interval'} = $module_conf->{'cron_interval'}; @@ -826,11 +819,6 @@ sub process_module_data ($$$$$$$$$$) { delete $module_conf->{'module_group'}; } - if ($enable_transactional_subsystem == 1) { - # Defines current agent as transactional agent - pandora_mark_transactional_agent($dbh, $agent->{'id_agente'}); - } - $module_conf->{'id_modulo'} = 1; $module_conf->{'id_agente'} = $agent->{'id_agente'}; From 8e92f612fdf59c89be9e8bba25d3788d19e17c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Su=C3=A1rez?= Date: Sun, 11 Jun 2023 14:06:29 -0600 Subject: [PATCH 005/103] Restore module_conf name --- pandora_server/lib/PandoraFMS/DataServer.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index f3bc720a34..7139f28a53 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -759,6 +759,8 @@ sub process_module_data ($$$$$$$$$$) { # Name XML tag and column name don't match $module_conf->{'nombre'} = safe_input($module_name); + delete $module_conf->{'name'}; + # Calculate the module interval in seconds if (defined($module_conf->{'cron_interval'})) { $module_conf->{'module_interval'} = $module_conf->{'cron_interval'}; From b6c3cd5149eaf2ec356e018acd167fae6d0fe8c6 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 20 Jun 2023 14:55:12 +0200 Subject: [PATCH 006/103] #11629 netflow group filter all enable --- pandora_console/godmode/netflow/nf_edit_form.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/netflow/nf_edit_form.php b/pandora_console/godmode/netflow/nf_edit_form.php index 135739c446..c136c1db1d 100644 --- a/pandora_console/godmode/netflow/nf_edit_form.php +++ b/pandora_console/godmode/netflow/nf_edit_form.php @@ -261,8 +261,8 @@ $table->data['first_line'][] = html_print_label_input_block( 'assign_group', $assign_group, '', - '', - -1, + __('All'), + 0, true, false, false, From bc2bd6868934829a8eb7a6047da30171eeeb129a Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 21 Jun 2023 13:49:34 +0200 Subject: [PATCH 007/103] #11571 text QR --- pandora_console/godmode/users/user_management.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/users/user_management.php b/pandora_console/godmode/users/user_management.php index b03c79f374..d0a06c81a6 100644 --- a/pandora_console/godmode/users/user_management.php +++ b/pandora_console/godmode/users/user_management.php @@ -764,10 +764,12 @@ $userManagementTable->data['fields_addSettings'][1] .= html_print_div( if (isset($CodeQRTable) === true || isset($apiTokenContent) === true) { // QR Code and API Token advice. + $titleQr = ''.__('Contact details (QR)').''; + $titleApi = '
'.__('API Token credentials').''; html_print_div( [ 'id' => 'api_qrcode_display', - 'content' => $CodeQRTable.$apiTokenContent, + 'content' => $titleQr.$CodeQRTable.$titleApi.$apiTokenContent, ] ); } From 42a8685586681c3bedc82a8f05829a8415578706 Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Thu, 22 Jun 2023 15:30:55 +0200 Subject: [PATCH 008/103] #9866 fixed display of notifications with very long text strings --- pandora_console/include/functions_notifications.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php index eab3ff5067..e4cd748210 100644 --- a/pandora_console/include/functions_notifications.php +++ b/pandora_console/include/functions_notifications.php @@ -1096,6 +1096,11 @@ function notifications_print_dropdown_element($message_info) $message_info['subject'] = io_safe_input($img); } + if (strlen($body_preview) >= 170) { + $body_preview = substr($body_preview, 0, 150); + $body_preview .= __('. Read More...'); + } + return sprintf( " Date: Tue, 27 Jun 2023 16:04:00 +0200 Subject: [PATCH 009/103] #11645 Fixed the error message in the SLA items --- pandora_console/godmode/reporting/reporting_builder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index e93f87a672..9e56115ead 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -3832,7 +3832,7 @@ if ($resultOperationDB !== null) { break; case 'SLA': - $err .= 'You must enter some character in SLA limit field'; + $err .= 'No changes found.'; default: $err .= ''; break; @@ -3841,7 +3841,7 @@ if ($resultOperationDB !== null) { ui_print_result_message( $resultOperationDB, __('Successfull action'), - __('Unsuccessful action

'.$err) + __($err) ); } From 53eef0d7d6de0a3c65eec84aee41b4b5d58ecb4d Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Tue, 27 Jun 2023 16:41:15 +0200 Subject: [PATCH 010/103] #11668 Add blacktheme style to news --- .../include/styles/pandora_black.css | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/pandora_console/include/styles/pandora_black.css b/pandora_console/include/styles/pandora_black.css index 68f179a210..a29f0cd44b 100644 --- a/pandora_console/include/styles/pandora_black.css +++ b/pandora_console/include/styles/pandora_black.css @@ -1615,3 +1615,78 @@ a.pandora_pagination, #visual-console-container a p { color: #3f3f3f; } +/* News Blacktheme */ +.new-board { + background-color: #222; + border: 1px solid #333; + border-radius: 4px; + margin-bottom: 15px; +} + +.new-board-header { + background-image: linear-gradient(180deg, #1a1a1a 0%, #222 100%); + border-radius: 4px 4px 0 0; + width: 100%; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: space-between; +} + +.new-board-title { + font-weight: 600; + font-size: 16px; + line-height: 24px; + color: #fff; + margin: 15px; +} + +.new-board-author { + color: #fff; + margin: 15px; +} + +.new.content { + padding: 0 15px 15px; +} + +.default-new { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + align-items: center; +} + +.default-new > div > img { + width: 100%; + max-width: 430px; + height: auto; +} + +.default-new > div.default-text-new { + margin-left: 20px; + width: 400px; +} + +.default-new > div.default-text-new > p { + color: #fff; + font-size: 15px; + line-height: 24px; +} + +.default-new > div.default-text-new > p:first-child { + margin-top: 0px; +} + +.default-new > div.default-text-new > span { + color: #fff; + font-size: 11px; + line-height: 20px; +} + +@media screen and (max-width: 1430px) { + .default-new > div.default-text-new > p { + font-size: 12px; + line-height: 18px; + } +} From 1d5fdbf6e6df05c79a500a2c2a254e629dad92b6 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Wed, 28 Jun 2023 12:16:46 +0200 Subject: [PATCH 011/103] #11668 Add blacktheme style in news text editor --- .../include/styles/pandora_black.css | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/pandora_console/include/styles/pandora_black.css b/pandora_console/include/styles/pandora_black.css index a29f0cd44b..e30fad7fc1 100644 --- a/pandora_console/include/styles/pandora_black.css +++ b/pandora_console/include/styles/pandora_black.css @@ -1690,3 +1690,125 @@ a.pandora_pagination, line-height: 18px; } } + +/*tox tinymce blacktheme*/ +.tox { + border: 2px solid #333; + background-color: #333 !important; +} + +.tox-tinymce { + border: 2px solid #333 !important; + background-color: #333 !important; +} + +.tox .tox-editor-container { + background-color: #333 !important; +} + +.tox .tox-editor-header { + background-color: #333 !important; +} + +.tox .tox-menubar { + background-color: #333 !important; +} + +.tox .tox-mbtn, +.tox-collection__item-label, +.tox-collection__item-accessory, +.tox-menu-nav__js, +.tox-collection__group, +.tox-menu, +.tox-collection, +.tox-collection--list { + color: #fff !important; + background-color: #333 !important; +} + +.tox .tox-mbtn:hover { + color: #fff !important; + background-color: #000 !important; +} + +.tox .tox-menu-nav__js:hover > div, +.tox-menu-nav__js:hover { + color: #fff !important; + background-color: #000 !important; +} + +.tox .tox-mbtn--active { + background-color: #000 !important; +} + +.tox-insert-table-picker__label { + color: #fff !important; +} + +.tox .tox-toolbar-overlord > div, +.tox-toolbar-overlord { + color: #fff !important; + background-color: #333 !important; +} + +.tox .tox-toolbar__group > button { + color: #fff !important; + background-color: #333 !important; +} + +.tox .tox-toolbar__group > button:hover { + color: #fff !important; + background-color: #000 !important; +} + +.tox .tox-toolbar__group .tox-tbtn--bespoke { + border-style: solid; + border-color: #fff; + border-width: 1px; +} + +.tox .tox-toolbar__group .tox-tbtn--bespoke:hover { + border-style: solid; + border-color: #000; + border-width: 1px; +} + +:root { + --white: #fff; + --grey: #333; + --black: #000; +} + +.tox .tox-toolbar__group svg { + filter: invert(100%); +} + +.tox .tox-sidebar-wrap > div, +.tox-sidebar-wrap { + color: #fff !important; + background-color: #333 !important; +} + +.tox .tox-edit-area__iframe { + color: #fff !important; + background-color: #666 !important; +} + +.tox .tox-statusbar { + color: #fff !important; + background-color: #333 !important; +} + +.tox .tox-statusbar__text-container { + color: #fff !important; + background-color: #333 !important; +} + +.tox .tox-statusbar__path > div { + color: #fff !important; + background-color: #333 !important; +} + +.tox .tox-statusbar__resize-handle > svg { + filter: invert(100%); +} From f5e87f9d8d690f88f83c82b77a038b433164b560 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 5 Jul 2023 16:36:08 +0200 Subject: [PATCH 012/103] #11694 fatal error intval "/" unsuported --- pandora_console/include/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index f0a5115d6f..a5301065a0 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -324,7 +324,7 @@ function human_milliseconds_to_string($seconds) } // get the seconds - $seconds = (intval($seconds / 100) % 60); + $seconds = ((intval($seconds) / 100) % 60); if ($seconds > 0) { $ret .= "$seconds seconds"; } From 444dbb459960beface852be457e6257eb2efbeaf Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Thu, 6 Jul 2023 13:15:45 +0200 Subject: [PATCH 013/103] #11386 Fix modal event sound --- .../include/javascript/pandora_events.js | 330 +++++++++++++++++- .../include/styles/js/jquery-ui_custom.css | 32 +- pandora_console/include/styles/pandora.css | 2 +- pandora_console/index.php | 2 +- pandora_console/operation/events/events.php | 39 ++- .../operation/events/sound_events.php | 4 +- 6 files changed, 400 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index 7916b921d6..d307cc7b9f 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -55,7 +55,7 @@ function show_event_dialog(event, dialog_page) { title: event.evento, resizable: true, draggable: true, - modal: true, + modal: false, minWidth: 875, minHeight: 600, close: function() { @@ -943,6 +943,105 @@ function process_buffers(buffers) { } } +function openSoundEventsDialog(settings) { + settings = JSON.parse(atob(settings)); + + // Check modal exists and is open. + if ( + $("#modal-sound").hasClass("ui-dialog-content") && + $("#modal-sound").dialog("isOpen") + ) { + return; + } + // Initialize modal. + $("#modal-sound") + .empty() + .dialog({ + title: settings.title, + resizable: false, + modal: false, + width: 600, + height: 600, + open: function() { + $.ajax({ + method: "post", + url: settings.url, + data: { + page: settings.page, + drawConsoleSound: 1 + }, + dataType: "html", + success: function(data) { + $("#modal-sound").append(data); + $("#tabs-sound-modal").tabs({ + disabled: [1] + }); + + // Test sound. + $("#button-melody_sound").click(function() { + var sound = false; + if ($("#id_sound_event").length == 0) { + sound = true; + } + + test_sound_button(sound, settings.urlSound); + }); + + // Play Stop. + $("#button-start-search").click(function() { + var mode = $("#hidden-mode_alert").val(); + var action = false; + if (mode == 0) { + action = true; + } + + action_events_sound(action, settings); + }); + + // Silence Alert. + $("#button-no-alerts").click(function() { + if ($("#button-no-alerts").hasClass("silence-alerts") === true) { + // Remove audio. + remove_audio(); + + // Clean events. + $("#tabs-sound-modal .elements-discovered-alerts ul").empty(); + $("#tabs-sound-modal .empty-discovered-alerts").removeClass( + "invisible_important" + ); + + // Clean progress. + $("#progressbar_time").empty(); + + // Change img button. + $("#button-no-alerts") + .removeClass("silence-alerts") + .addClass("alerts"); + // Change value button. + $("#button-no-alerts").val(settings.noAlert); + $("#button-no-alerts > span").text(settings.noAlert); + + // Background button. + $(".container-button-alert").removeClass("fired"); + + // New progress. + listen_event_sound(settings); + } + }); + }, + error: function(error) { + console.error(error); + } + }); + }, + close: function() { + remove_audio(); + $(this).dialog("destroy"); + } + }) + .show(); +} + function openSoundEventModal(settings) { if ($("#hidden-metaconsole_activated").val() === "1") { var win = open( @@ -1045,10 +1144,12 @@ function add_audio(urlSound) { sound + "' autoplay='true' hidden='true' loop='false'>" ); + $("#button-sound_events_button").addClass("animation-blink"); } function remove_audio() { $(".actions-sound-modal audio").remove(); + $("#button-sound_events_button").removeClass("animation-blink"); } function listen_event_sound(settings) { @@ -1229,3 +1330,230 @@ function removeElement(name_select, id_modal) { .append(option); }); } +/* +############################################################################# +## +## + Compacts the Modal Sound Dialog to a tiny toolbar +## + Dynamically adds a button which can reduce/reapply the dialog size +## + If alarm gets raised & minimized, the dialog window maximizes and the toolbar flashes red for 10 seconds. +## - Works fine until a link/action gets clicked. The Toolbar shifts to the bottom of the Modal-Sound Dialog. +## +############################################################################# +*/ + +$(document).ajaxSend(function(event, jqXHR, ajaxOptions) { + const requestBody = ajaxOptions.data; + if (requestBody && requestBody.includes("drawConsoleSound=1")) { + console.log("AJAX request sent with drawConsoleSound=1:", ajaxOptions.url); + + // Find the dialog element by the aria-describedby attribute + var dialog = $('[aria-describedby="modal-sound"]'); + + // Select the close button within the dialog + var closeButton = dialog.find(".ui-dialog-titlebar-close"); + + // Add the minimize button before the close button + var minimizeButton = $("