From 74b80f68a531a9fc43c57b55163ada3e180cbb24 Mon Sep 17 00:00:00 2001 From: samucarc Date: Thu, 25 Oct 2018 16:52:39 +0200 Subject: [PATCH 01/95] Fixed minor bug in pandora flot js --- pandora_console/include/graphs/flot/pandora.flot.js | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 95985cb874..fabfa030a2 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -866,6 +866,7 @@ function pandoraFlotArea( graph_id, values, legend, var unit = params.unit ? params.unit : ''; var homeurl = params.homeurl; var font_size = parseInt(params.font_size); + if (font != undefined) var font = params.font.split("/").pop().split(".").shift(); var width = params.width; var height = params.height; From c05b4c53e82efcd5df56415aae2eb2000ff81ac6 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Fri, 7 Dec 2018 15:12:09 +0100 Subject: [PATCH 02/95] fix bug when updating path of ssl certificate in general setup Former-commit-id: dfe466e64e18c7e3ea949f7786e0ef6343334260 --- pandora_console/godmode/setup/setup_general.php | 5 +++++ pandora_console/include/functions_config.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index b935f4fc13..285ae1451b 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -292,6 +292,11 @@ $(document).ready (function () { $("#zone").attr("hidden", false); $("#timezone").attr("hidden", false); }); + + if ($("input[name=use_cert]").is(':checked')) { + $('#setup_general-13').show(); + } + $("input[name=use_cert]").change(function () { if( $(this).is(":checked") ){ var val = $(this).val(); diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index e773224c16..ec6d791d62 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -136,7 +136,7 @@ function config_update_config () { $error_update[] = __('Time source'); if (!config_update_value ('autoupdate', (bool) get_parameter ('autoupdate'))) $error_update[] = __('Automatic check for updates'); - if (!config_update_value ('cert_path', (bool) get_parameter ('cert_path'))) + if (!config_update_value ('cert_path', get_parameter ('cert_path'))) $error_update[] = __('SSL cert path'); if (!config_update_value ('https', (bool) get_parameter ('https'))) $error_update[] = __('Enforce https'); From 0670eb0d29bae1a57e1583111d5c9d34867aca5a Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Mon, 10 Dec 2018 11:04:21 +0100 Subject: [PATCH 03/95] disable double authentication option on user edit when disabled in authentication setup Former-commit-id: 3718da22ded115ae7de492ffbd200d972704865f --- pandora_console/operation/users/user_edit.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 2c33acdea6..0626c4de3b 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -376,9 +376,12 @@ $table->data[] = $data; // Double auth $double_auth_enabled = (bool) db_get_value('id', 'tuser_double_auth', 'id_user', $config['id_user']); $data = array(); -$data[0] = ''.__('Double authentication').''; -$data[0] .= $jump; -$data[0] .= ''.html_print_checkbox('double_auth', 1, $double_auth_enabled, true).''; +if ($config['double_auth_enabled']) { + $data[0] = ''.__('Double authentication').''; + $data[0] .= $jump; + $data[0] .= ''.html_print_checkbox('double_auth', 1, $double_auth_enabled, true).''; +} + if ($double_auth_enabled) { $data[0] .= $jump; $data[0] .= html_print_button(__('Show information'), 'show_info', false, 'javascript:show_double_auth_info();', '', true); From 279e94f452dc3b86caf2e35b606239e3bf0a697b Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Tue, 11 Dec 2018 10:30:24 +0100 Subject: [PATCH 04/95] agent named replaced by agent alias in mobile console's alerts view Former-commit-id: 4140bddcf5785f76a948bbe1ba0f694a58c9b50a --- pandora_console/mobile/operation/alerts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/mobile/operation/alerts.php b/pandora_console/mobile/operation/alerts.php index cf9c89272f..b6a71dddba 100644 --- a/pandora_console/mobile/operation/alerts.php +++ b/pandora_console/mobile/operation/alerts.php @@ -263,7 +263,7 @@ class Alerts { $row = array(); if (isset($this->columns['agent']) && $this->columns['agent']) { - $row[__('Agent')] = sprintf($disabled_style, io_safe_output($alert['agent_name'])); + $row[__('Agent')] = sprintf($disabled_style, io_safe_output($alert['agent_alias'])); } $row[__('Module')] = sprintf($disabled_style, io_safe_output($alert['module_name'])); From dd6c8ca87082f67156a07f68d394926d80a3dc1f Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Tue, 11 Dec 2018 16:43:52 +0100 Subject: [PATCH 05/95] Fixed bug in metaconsole custom fields2 Former-commit-id: f96e08279f779d5d64d1ce88f23787f15ac3d144 --- pandora_console/include/functions_events.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 591f3ae89d..2ccc38079c 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -39,7 +39,7 @@ function events_get_all_fields() { $columns['estado'] = __('Status'); $columns['timestamp'] = __('Timestamp'); $columns['event_type'] = __('Event type'); - $columns['id_agentmodule'] = __('Agent module'); + $columns['id_agentmodule'] = __('Module name'); $columns['id_alert_am'] = __('Alert'); $columns['criticity'] = __('Severity'); $columns['user_comment'] = __('Comment'); From c5c5ba94034a38d6eea7718f4fb339f4d1dc99f6 Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Wed, 12 Dec 2018 12:21:52 +0100 Subject: [PATCH 06/95] Fixed bug in diagnostic info Former-commit-id: 0318eabdf8cbf60267667ba1b4d74d8e476d0b3d --- pandora_console/extras/pandora_diag.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/pandora_console/extras/pandora_diag.php b/pandora_console/extras/pandora_diag.php index 29e83182fe..b961c30091 100644 --- a/pandora_console/extras/pandora_diag.php +++ b/pandora_console/extras/pandora_diag.php @@ -122,8 +122,8 @@ function get_logs_size($file){ function get_status_logs($path){ $status_server_log = ""; - $size_server_log = get_logs_size($path); - if ($size_server_log <= 10240){ + $size_server_log = number_format(get_logs_size($path)); + if ($size_server_log <= 1048576){ $status_server_log = "Normal Status   You have less than 10 MB of logs"; }else{ $status_server_log = "Warning Status   You have more than 10 MB of logs"; @@ -344,11 +344,7 @@ render_info_data ("SELECT COUNT(*) FROM tagente","Total agents"); render_info_data ("SELECT COUNT(*) FROM tagente_modulo","Total modules"); render_info_data ("SELECT COUNT(*) FROM tgrupo","Total groups"); render_info_data ("SELECT COUNT(*) FROM tagente_datos","Total module data records"); -// render_info_data ("SELECT COUNT(*) FROM tagente_datos_string","Total module string data records"); -// render_info_data ("SELECT COUNT(*) FROM tagente_datos_log4x","Total module log4x data records"); render_info_data ("SELECT COUNT(*) FROM tagent_access","Total agent access record"); -// render_info ("tagente_estado"); -// render_info ("talert_template_modules"); render_info_data ("SELECT COUNT(*) FROM tevento","Total events"); if($config['enterprise_installed']) @@ -560,7 +556,7 @@ render_row(status_values($read_buffer_size_min_rec_value,$read_buffer_size), 'Re render_row(status_values($read_rnd_buffer_size_min_rec_value,$read_rnd_buffer_size), 'Read rnd-buffer size ','Read rnd-buffer size '); render_row(status_values($query_cache_min_res_unit_min_rec_value,$query_cache_min_res_unit), 'Query cache min-res-unit ','Query cache min-res-unit '); render_row(status_values($innodb_file_per_table_min_rec_value,$innodb_file_per_table), 'InnoDB file per table ','InnoDB file per table '); -echo "".__("Tables fragmentation in the PandoraFMS database").""; +echo "".__("Tables fragmentation in the Pandora FMS database").""; @@ -568,14 +564,14 @@ render_row ($tables_fragmentation_max_rec_value . "%", "Tables fragmentation (ma render_row (number_format($tables_fragmentation, 2) . "%", "Tables fragmentation (current value)"); render_row (status_fragmentation_tables($tables_fragmentation_max_rec_value, $tables_fragmentation), "Status fragmentation tables"); -echo "".__(" PandoraFMS logs dates").""; +echo "".__(" Pandora FMS logs dates").""; -render_row(number_format(get_logs_size($path_server_logs)/1024, 2) . "M", 'Size server logs (current value)'); +render_row(number_format(get_logs_size($path_server_logs)/1048576, 3) . "M", 'Size server logs (current value)'); render_row(get_status_logs($path_server_logs),'Status server logs'); -render_row(number_format(get_logs_size($path_console_logs)/1024, 2) . "M", 'Size console logs (current value)'); +render_row(number_format(get_logs_size($path_console_logs)/1048576, 3) . "M", 'Size console logs (current value)'); render_row(get_status_logs($path_console_logs),'Status console logs'); -echo "".__(" PandoraFMS Licence Information").""; +echo "".__(" Pandora FMS Licence Information").""; render_row( html_print_textarea ('keys[customer_key]', 10, 255, $settings->customer_key, 'style="height:40px; width:450px;"', true),'Customer key'); render_row( $license['expiry_date'],'Expires'); From bc36bb053411dc4b6c4b403aa8e59e481595c127 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Mon, 17 Dec 2018 15:39:44 +0100 Subject: [PATCH 07/95] Add support for exact matches to SNMP alerts. Ref pandora_enterprise#3214. Former-commit-id: 35aa55d4d2ae236e614be7f4db50a9eb9f62aafa --- pandora_console/godmode/snmpconsole/snmp_alert.php | 2 +- pandora_server/lib/PandoraFMS/Core.pm | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index 870597bee5..b223d8dafe 100755 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -634,7 +634,7 @@ if ($create_alert || $update_alert) { // OID echo '' . - '' . __('Enterprise String') . '' . + '' . __('Enterprise String') . ui_print_help_tip (__('Matches substrings. End the string with $ for exact matches.'), true) . '' . ''; html_print_input_text ("oid", $oid, '', 50, 255); echo ''; diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index c986eb0510..f4485e789b 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -3400,7 +3400,16 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) { $alert->{'oid'} = decode_entities($alert->{'oid'}); my $oid = $alert->{'oid'}; if ($oid ne '') { - next if (index ($trap_oid, $oid) == -1 && index ($trap_oid_text, $oid) == -1); + my $term = substr($oid, -1); + # Strict match. + if ($term eq '$') { + chop($oid); + next if ($trap_oid ne $oid && $trap_oid_text ne $oid); + } + # Partial match. + else { + next if (index ($trap_oid, $oid) == -1 && index ($trap_oid_text, $oid) == -1); + } $alert_data .= "OID: $oid "; } From e6049870f78f1f84d115667cb0ab44c0dcf89947 Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Tue, 18 Dec 2018 12:52:01 +0100 Subject: [PATCH 08/95] Fixed validations and changed alert by dialog Former-commit-id: 4c38c7f665cd328708bca48f997794b9a8586840 --- .../visual_console_builder.editor.js | 498 ++++++++++++++---- .../include/functions_visual_map_editor.php | 95 +++- 2 files changed, 469 insertions(+), 124 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index bc573e1b92..f367d6aeaa 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -213,6 +213,20 @@ function is_metaconsole() { return false; } +function dialog_message(message_id){ + $(message_id).css('display', 'inline').dialog({ + modal: true, + show: "blind", + hide: "blind", + buttons:{ + "Close": function(){ + $(this).dialog("close"); + } + } + }); + +} + function update_button_palette_callback() { var values = {}; @@ -223,16 +237,11 @@ function update_button_palette_callback() { switch (selectedItem) { case 'background': if(values['width'] < 1024 || values['height'] < 768){ - alert('Min allowed size is 1024x768'); + dialog_message("#message_min_allowed_size"); return false; } - - if(values['width'] == 0 && values['height'] == 0) { - values['width'] = - $("#hidden-background_original_width").val(); - values['height'] = - $("#hidden-background_original_height").val(); - } + $("#hidden-background_width").val(values['width']); + $("#hidden-background_height").val(values['height']); $("#background").css('width', values['width']); $("#background").css('height', values['height']); @@ -244,11 +253,19 @@ function update_button_palette_callback() { break; case 'box_item': if($('input[name=width_box]').val() == ''){ - alert('Undefined width'); + dialog_message("#message_alert_no_width"); + return false; + } + if (parseInt($("input[name='width_box']").val()) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); return false; } if($('input[name=height_box]').val() == ''){ - alert('Undefined height'); + dialog_message("#message_alert_no_height"); + return false; + } + if (parseInt($("input[name='height_box']").val()) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_height"); return false; } @@ -267,7 +284,7 @@ function update_button_palette_callback() { break; case 'group_item': if((values['image'] == '' || values['image'] == 'none') && (values['label'] == '') && (values['show_statistics'] == false)){ - alert('Undefined image'); + dialog_message("#message_alert_no_image"); return false; } @@ -385,15 +402,31 @@ function update_button_palette_callback() { break; case 'static_graph': if($('input[name=width]').val() == ''){ - alert('Undefined width'); + dialog_message("#message_alert_no_width"); + return false; + } + if (parseInt($("input[name='width']").val()) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); return false; } if($('input[name=height]').val() == ''){ - alert('Undefined height'); + dialog_message("#message_alert_no_height"); + return false; + } + if (parseInt($("input[name='height']").val()) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_height"); + return false; + } + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module"); + return false; + } + if ((values['agent'] == '')) { + dialog_message("#message_alert_no_agent"); return false; } if(((values['image'] == '' || values['image'] == 'none') && (values['label'] == ''))){ - alert('Undefined image'); + dialog_message("#message_alert_no_image"); return false; } @@ -485,13 +518,24 @@ function update_button_palette_callback() { break; case 'percentile_bar': case 'percentile_item': - if($('input[name=width_percentile]').val() == ''){ - alert('Undefined width'); + if($('input[name=height_percentile]').val() == ''){ + dialog_message("#message_alert_no_height"); return false; } - - if($('input[name=height_percentile]').val() == ''){ - alert('Undefined height'); + if($('input[name=width_percentile]').val() == ''){ + dialog_message("#message_alert_no_width"); + return false; + } + if($('input[name=width_percentile]').val() > parseInt($("#hidden-background_width").val())){ + dialog_message("#message_alert_max_width"); + return false; + } + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module"); + return false; + } + if ((values['agent'] == '')) { + dialog_message("#message_alert_no_agent"); return false; } @@ -516,31 +560,42 @@ function update_button_palette_callback() { if($('#dir_items').html() == 'horizontal'){ if(parseInt($('#text-left').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width')) || parseInt($('#text-left').val()) + (parseInt($('input[name=width_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('width'))){ - alert($('#count_items').html()+' joined graph items are wider than background'); return false; - } } - if($('#dir_items').html() == 'vertical'){ if(parseInt($('#text-top').val()) + (parseInt($('input[name=height_module_graph]').val() * $('#count_items').html())) > parseInt($('#background').css('height'))){ alert($('#count_items').html()+' joined graph items are higher than background'); return false; - } } - + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module"); + return false; + } + if ((values['agent'] == '')) { + dialog_message("#message_alert_no_agent"); + return false; + } if($('input[name=width_module_graph]').val() == ''){ - alert('Undefined width'); + dialog_message("#message_alert_no_width"); return false; } if($('input[name=height_module_graph]').val() == ''){ - alert('Undefined height'); + dialog_message("#message_alert_no_height"); + return false; + } + if (parseInt(values['width_module_graph']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + return false; + } + if (parseInt($('input[name=height_module_graph]').val()) > parseInt($("#hidden-background_height").val())) { + dialog_message("#message_alert_max_height"); return false; } if($('#custom_graph_row').css('display') != 'none' && $("#custom_graph option:selected").html() == 'None'){ - alert('Undefined graph'); + dialog_message("#message_alert_no_custom_graph"); return false; } @@ -550,12 +605,19 @@ function update_button_palette_callback() { break; case 'bars_graph': if($('input[name=width_percentile]').val() == ''){ - alert('Undefined width'); + dialog_message("#message_alert_no_width"); return false; } - if($('input[name=bars_graph_height]').val() == ''){ - alert('Undefined height'); + dialog_message("#message_alert_no_height"); + return false; + } + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module"); + return false; + } + if ((values['agent_string'] == '')) { + dialog_message("#message_alert_no_agent"); return false; } @@ -566,6 +628,10 @@ function update_button_palette_callback() { break; case 'clock': + if (parseInt(values['width_percentile']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + return false; + } $("#text_" + idItem).html(values['label']); $("#image_" + idItem).attr("src", "images/spinner.gif"); @@ -573,12 +639,28 @@ function update_button_palette_callback() { break; case 'auto_sla_graph': - if($('input[name=width]').val() == ''){ - alert('Undefined width'); + if (values['height'] == '') { + dialog_message("#message_alert_no_height"); return false; } - if($('input[name=height]').val() == ''){ - alert('Undefined height'); + if (parseInt(values['height']) > parseInt($("#hidden-background_height").val())) { + dialog_message("#message_alert_max_height"); + return false; + } + if (values['width'] == '') { + dialog_message("#message_alert_no_width"); + return false; + } + if (parseInt(values['width']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + return false; + } + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module"); + return false; + } + if ((values['agent'] == '')) { + dialog_message("#message_alert_no_agent"); return false; } $("#text_" + idItem).html(values['label']); @@ -587,8 +669,19 @@ function update_button_palette_callback() { setEventsBar(idItem, values); break; case 'donut_graph': + if (parseInt(values['width_percentile']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + return false; + } + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module_string_type"); + return false; + } + if ((values['agent_string'] == '')) { + dialog_message("#message_alert_no_agent"); + return false; + } $("#image_" + idItem).attr("src", "images/spinner.gif"); - setDonutsGraph(idItem, values); break; case 'simple_value': @@ -606,21 +699,41 @@ function update_button_palette_callback() { '
'+values["label"]+'
' ) } + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module"); + return false; + } + if ((values['agent'] == '')) { + dialog_message("#message_alert_no_agent"); + return false; + } break; case 'label': + if ((values['label'] == '')) { + dialog_message("#message_alert_no_label"); + return false; + } $("#text_" + idItem).html(values['label']); break; case 'icon': if($('input[name=width]').val() == ''){ - alert('Undefined width'); + dialog_message("#message_alert_no_width"); return false; } + if (parseInt($('input[name=width]').val()) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + return false; + } if($('input[name=height]').val() == ''){ - alert('Undefined height'); + dialog_message("#message_alert_no_height"); return false; } + if (parseInt($('input[name=height]').val()) > parseInt($("#hidden-background_height").val())) { + dialog_message("#message_alert_max_height"); + return false; + } if(values['image'] == '' || values['image'] == 'none'){ - alert('Undefined image'); + dialog_message("#message_alert_no_image"); return false; } $("#image_" + idItem).attr('src', "images/spinner.gif"); @@ -653,14 +766,56 @@ function update_button_palette_callback() { var image = values['image'] + ".png"; set_image("image", idItem, image); break; + case 'line_item': + if (parseInt(values['line_width']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + return false; + } + break; + case 'color_cloud': + if (parseInt(values['diameter']) > parseInt($("#hidden-background_height").val())) { + dialog_message("#message_alert_max_height"); + return false; + } + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module"); + return false; + } + if ((values['agent'] == '')) { + dialog_message("#message_alert_no_agent"); + return false; + } + break; + case 'service': + if (values['height'] == '' || values['height_module_graph'] == 0) { + dialog_message("#message_alert_no_height"); + return false; + } + if (parseInt(values['height']) > parseInt($("#hidden-background_height").val())) { + dialog_message("#message_alert_max_height"); + return false; + } + if (values['width'] == '' || values['width_module_graph'] == 0) { + dialog_message("#message_alert_no_width"); + return false; + } + if (parseInt(values['width']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + return false; + } + if($("select[name=service]").val() == '' || $("select[name=service]").val() == 'none'){ + dialog_message("#message_alert_no_service"); + return false; + } + break; default: if($('input[name=width]').val() == ''){ - alert('Undefined width'); - return false; + dialog_message("#message_alert_no_width"); + return false; } if($('input[name=height]').val() == ''){ - alert('Undefined height'); - return false; + dialog_message("#message_alert_no_height"); + return false; } //Maybe save in any Enterprise item. if (typeof(enterprise_update_button_palette_callback) == 'function') { @@ -860,144 +1015,288 @@ function create_button_palette_callback() { var validate = true; switch (creationItem) { case 'box_item': - if (($("input[name='width_box']").val() == '')) { - alert('Undefined width'); + if ($("input[name='width_box']").val() == '') { + dialog_message("#message_alert_no_width"); validate = false; } - if (($("input[name='height_box']").val() == '')) { - alert('Undefined height'); + if (parseInt($("input[name='width_box']").val()) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + validate = false; + } + if ($("input[name='height_box']").val() == '') { + dialog_message("#message_alert_no_height"); + validate = false; + } + if(parseInt($("input[name='height_box']").val()) > parseInt($("#hidden-background_height").val())) { + dialog_message("#message_alert_max_height"); validate = false; } break; case 'group_item': + if (values['height'] == '') { + dialog_message("#message_alert_no_height"); + validate = false; + } + if (parseInt(values['height']) > parseInt($("#hidden-background_height").val())) { + dialog_message("#message_alert_max_height"); + validate = false; + } + if (values['width'] == '') { + dialog_message("#message_alert_no_width"); + validate = false; + } + if (parseInt(values['width']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + validate = false; + } if((values['image'] == '' || values['image'] == 'none') && (values['label'] == '') && (values['show_statistics'] == false)){ - alert('Undefined images'); + dialog_message("#message_alert_no_image"); validate = false; } break; case 'static_graph': - if ((values['width'] == '')) { - alert('Undefined width'); + + if (values['height'] == '') { + dialog_message("#message_alert_no_height"); validate = false; } - if ((values['height'] == '')) { - alert('Undefined height'); + if (parseInt(values['height']) > parseInt($("#hidden-background_height").val())) { + dialog_message("#message_alert_max_height"); + validate = false; + } + if (values['width'] == '') { + dialog_message("#message_alert_no_width"); + validate = false; + } + if (parseInt(values['width']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + validate = false; + } + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module"); + validate = false; + } + if ((values['agent'] == '')) { + dialog_message("#message_alert_no_agent"); validate = false; } if((values['image'] == '' || values['image'] == 'none') && (values['label']) == false){ - alert('Undefined image'); + dialog_message("#message_alert_no_image"); validate = false; } - break; case 'auto_sla_graph': + + if (values['height'] == '') { + dialog_message("#message_alert_no_height"); + validate = false; + } + if (parseInt(values['height']) > parseInt($("#hidden-background_height").val())) { + dialog_message("#message_alert_max_height"); + validate = false; + } + if (values['width'] == '') { + dialog_message("#message_alert_no_width"); + validate = false; + } + if (parseInt(values['width']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + validate = false; + } + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module"); + validate = false; + } if ((values['agent'] == '')) { - alert($("#message_alert_no_agent").html()); + dialog_message("#message_alert_no_agent"); validate = false; } break; case 'donut_graph': + if (parseInt(values['width_percentile']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + validate = false; + } + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module_string_type"); + validate = false; + } if ((values['agent_string'] == '')) { - alert($("#message_alert_no_agent").html()); + dialog_message("#message_alert_no_agent"); validate = false; } break; case 'label': if ((values['label'] == '')) { - alert($("#message_alert_no_label").html()); + dialog_message("#message_alert_no_label"); validate = false; } break; case 'icon': if ((values['width'] == '')) { - alert('Undefined width'); + dialog_message("#message_alert_no_width"); + validate = false; + } + if (parseInt(values['width']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); validate = false; } if ((values['height'] == '')) { - alert('Undefined height'); + dialog_message("#message_alert_no_height"); + validate = false; + } + if (parseInt(values['height']) > parseInt($("#hidden-background_height").val())) { + dialog_message("#message_alert_max_height"); validate = false; } if ((values['image'] == '' || values['image'] == 'none')) { - alert($("#message_alert_no_image").html()); + dialog_message("#message_alert_no_image"); validate = false; } break; case 'percentile_bar': case 'percentile_item': - if ((values['width'] == '')) { - alert('Undefined width'); - validate = false; - } - if ((values['agent'] == '')) { - alert($("#message_alert_no_agent").html()); - validate = false; - } - if ((values['module'] == 0)) { - alert($("#message_alert_no_module").html()); - validate = false; - } - if ((values['max_percentile'] == '')) { - alert($("#message_alert_no_max_percentile").html()); + if (parseInt(values['width_percentile']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); validate = false; } if ((values['width_percentile'] == '')) { - alert($("#message_alert_no_width_percentile").html()); + dialog_message("#message_alert_no_width"); validate = false; } + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module"); + validate = false; + } + if ((values['agent'] == '')) { + dialog_message("#message_alert_no_agent"); + validate = false; + } + + if ((values['max_percentile'] == '')) { + dialog_message("#message_alert_no_max_percentile"); + validate = false; + } + break; case 'module_graph': - if (values['width_module_graph'] == '') { - alert('Undefined width'); - validate = false; - } - if (values['height_module_graph'] == '') { - alert('Undefined height'); + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module"); validate = false; } if (values['id_custom_graph'] == 0) { if ((values['agent'] == '')) { - alert($("#message_alert_no_agent").html()); - validate = false; - } - if ((values['module'] == 0)) { - alert($("#message_alert_no_module").html()); + dialog_message("#message_alert_no_agent"); validate = false; } if ((values['period'] == 0)) { - alert($("#message_alert_no_period").html()); + dialog_message("#message_alert_no_period"); validate = false; } } - break; - case 'bars_graph': - if ((values['agent_string'] == '')) { - alert($("#message_alert_no_agent").html()); + if (values['height_module_graph'] == '' || values['height_module_graph'] == 0) { + dialog_message("#message_alert_no_height"); validate = false; } - if ((values['module'] == 0)) { - alert($("#message_alert_no_module").html()); + if (parseInt(values['height_module_graph']) > parseInt($("#hidden-background_height").val())) { + dialog_message("#message_alert_max_height"); + validate = false; + } + if (values['width_module_graph'] == '' || values['width_module_graph'] == 0) { + dialog_message("#message_alert_no_width"); + validate = false; + } + if (parseInt(values['width_module_graph']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + validate = false; + } + break; + case 'bars_graph': + if ((values['bars_graph_height'] == '')) { + dialog_message("#message_alert_no_height"); + validate = false; + } + if (parseInt(values['bars_graph_height']) > parseInt($("#hidden-background_height").val())) { + dialog_message("#message_alert_max_height"); validate = false; } if ((values['width_percentile'] == '')) { - alert($("#message_alert_no_width_percentile").html()); + dialog_message("#message_alert_no_width"); validate = false; } - if ((values['bars_graph_height'] == '')) { - alert($("#message_alert_no_bars_graph_height").html()); + if (parseInt(values['width_percentile']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + validate = false; + } + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module"); + validate = false; + } + if ((values['agent_string'] == '')) { + dialog_message("#message_alert_no_agent"); validate = false; } break; case 'simple_value': - if ((values['agent'] == '')) { - alert($("#message_alert_no_agent").html()); + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module"); validate = false; } - if ((values['module'] == 0)) { - alert($("#message_alert_no_module").html()); + if ((values['agent'] == '')) { + dialog_message("#message_alert_no_agent"); validate = false; } break; + case 'clock': + if (parseInt(values['width_percentile']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + validate = false; + } + break; + case 'line_item': + if (parseInt(values['line_width']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + validate = false; + } + break; + case 'color_cloud': + if (parseInt(values['diameter']) > parseInt($("#hidden-background_height").val())) { + dialog_message("#message_alert_max_height"); + validate = false; + } + if ((values['module'] == 0)) { + dialog_message("#message_alert_no_module"); + validate = false; + } + if ((values['agent'] == '')) { + dialog_message("#message_alert_no_agent"); + validate = false; + } + break; + case 'service': + if (values['height'] == '' || values['height_module_graph'] == 0) { + dialog_message("#message_alert_no_height"); + validate = false; + } + if (parseInt(values['height']) > parseInt($("#hidden-background_height").val())) { + dialog_message("#message_alert_max_height"); + validate = false; + } + if (values['width'] == '' || values['width_module_graph'] == 0) { + dialog_message("#message_alert_no_width"); + validate = false; + } + if (parseInt(values['width']) > parseInt($("#hidden-background_width").val())) { + dialog_message("#message_alert_max_width"); + validate = false; + } + if($("select[name=service]").val() == '' || $("select[name=service]").val() == 'none'){ + dialog_message("#message_alert_no_service"); + validate = false; + } + break; + default: //Maybe save in any Enterprise item. if (typeof(enterprise_create_button_palette_callback) == 'function') { @@ -3603,7 +3902,6 @@ function createItem(type, values, id_data) { case 'clock': sizeStyle = ''; imageSize = ''; - if(values['label_position'] == 'up'){ item = $('
' + '
' + values['label'] + '
' + diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 4b835d65fc..64d974c131 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -1136,31 +1136,78 @@ function visual_map_editor_print_hack_translate_strings() { echo ''; //Hack to translate messages in javascript - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + echo""; + + echo""; + + echo""; + + echo""; + + echo""; + + echo""; + + echo""; + + echo""; + + echo""; + + echo""; + + echo""; + + echo""; + + echo""; + + echo""; + + echo""; + + echo""; + + echo""; + + echo""; - echo ''; - echo ''; } ?> From f60b55ac2b375b5cda32cd3a9c0eb857b3267caa Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Wed, 19 Dec 2018 13:14:09 +0100 Subject: [PATCH 09/95] fix metaconsole sql items creation Former-commit-id: 68e45006b53599e3f59322fe08cf5a93df747c32 --- .../godmode/reporting/reporting_builder.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 229c5ab56f..4605e9a3d9 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1473,16 +1473,6 @@ switch ($action) { $values['server_name'] = get_parameter ('combo_server'); - if (is_metaconsole()) { - // For SQL Query check if it is setted in the meta - if ($values['type'] == "sql") { - if (empty($values['server_name'])) { - $good_format = false; - } - } - } - - $values['id_agent'] = get_parameter('id_agent'); $values['id_gs'] = get_parameter('id_custom_graph'); if (($values['type'] == 'alert_report_agent') or ($values['type'] == 'event_report_agent') or ($values['type'] == 'agent_configuration') or ($values['type'] == 'group_configuration')) From 91e90a1b26367c812b2515a2e5b972ac91e8f440 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Thu, 20 Dec 2018 13:35:57 +0100 Subject: [PATCH 10/95] remove special characters from agent alias string on creation and trim blank spaces from beginning and end of alias string Former-commit-id: 2294ef705ac0df638bc897f56ff9e9beff8379fc --- pandora_console/godmode/agentes/configurar_agente.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index fab0ad7637..2c4931e267 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -157,7 +157,7 @@ $module_macros = array (); // Create agent if ($create_agent) { $mssg_warning = 0; - $alias = (string) get_parameter_post("alias",''); + $alias = trim (preg_replace('/[\/\\\|%#&$-]/', '', html_entity_decode( str_replace('`','‘',(string) get_parameter_post ("alias", ""))))); $alias_as_name = (int) get_parameter_post("alias_as_name", 0); $direccion_agente = (string) get_parameter_post("direccion",''); @@ -709,7 +709,7 @@ if ($update_agent) { // if modified some agent paramenter $mssg_warning = 0; $id_agente = (int) get_parameter_post ("id_agente"); $nombre_agente = str_replace('`','‘',(string) get_parameter_post ("agente", "")); - $alias = str_replace('`','‘',(string) get_parameter_post ("alias", "")); + $alias = trim (preg_replace('/[\/\\\|%#&$-]/', '', html_entity_decode( str_replace('`','‘',(string) get_parameter_post ("alias", ""))))); $alias_as_name = (int) get_parameter_post ('alias_as_name', 0); $direccion_agente = (string) get_parameter_post ("direccion", ''); //safe_output only validate ip From 5b7f7965101207e42118a2d5efd11c500ba7ee4c Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Fri, 28 Dec 2018 11:45:48 +0100 Subject: [PATCH 11/95] Changed popup windows by tooltips Former-commit-id: 478e63e4bf81bb663898bba1afa76c7ab02ac6d9 --- .../godmode/agentes/module_manager_editor_wmi.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor_wmi.php b/pandora_console/godmode/agentes/module_manager_editor_wmi.php index c177db7790..d97f456d5b 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_wmi.php +++ b/pandora_console/godmode/agentes/module_manager_editor_wmi.php @@ -44,8 +44,8 @@ else { $data = array (); $data[0] = __('Target IP'); $data[1] = html_print_input_text ('ip_target', $ip_target, '', 15, 60, true); -$data[2] = __('Namespace'); -$data[2] .= ui_print_help_icon ('wminamespace', true); +$data[2] = __('Namespace') . + ui_print_help_tip (__("Optional. WMI namespace. If unsure leave blank."), true); $data[3] = html_print_input_text ('tcp_send', $tcp_send, '', 5, 20, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy); push_table_simple ($data, 'target_ip'); @@ -70,12 +70,12 @@ $table_simple->colspan['wmi_query'][1] = 3; push_table_simple ($data, 'wmi_query'); $data = array (); -$data[0] = __('Key string'); -$data[0] .= ui_print_help_icon ('wmikey', true); +$data[0] = __('Key string') . + ui_print_help_tip (__("Optional. Substring to look for in the WQL query result. The module returns 1 if found, 0 if not."), true); $data[1] = html_print_input_text ('snmp_community', $snmp_community, '', 20, 60, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy); -$data[2] = __('Field number'); -$data[2] .= ui_print_help_icon ('wmifield', true); +$data[2] = __('Field number'). + ui_print_help_tip (__("Column number to retrieve from the WQL query result (starting from zero)."), true); $data[3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 15, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy); From 471c01a4c52d2876f7c3eef414652a8aad80cada Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Wed, 9 Jan 2019 10:20:17 +0100 Subject: [PATCH 12/95] fixed bad link to node in metaconsole's custom graph item editor Former-commit-id: 22fb4302de980d8b3e16fb90d087b71c218598a1 --- .../godmode/reporting/reporting_builder.item_editor.php | 2 +- pandora_console/include/ajax/reporting.ajax.php | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index a929740e39..4f4b5e7c22 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -2492,7 +2492,7 @@ function edit_custom_graph() { } }); - window.location.href = server_url + "/index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id=" + id_element_graph + hash_data; + window.location.href = server_url + "index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id=" + id_element_graph + hash_data; Date: Wed, 9 Jan 2019 16:06:08 +0100 Subject: [PATCH 13/95] Visual change in the data of general type reports Former-commit-id: fda11ae1c7233653728da7855fd010983a35d4fe --- .../include/functions_reporting_html.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 182977207d..2e4b2b521a 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2570,6 +2570,15 @@ function reporting_html_general(&$table, $item) { /* End - Order by agent */ foreach ($item['data'] as $row) { + $module_type = db_get_value("id_tipo_modulo", "tagente_modulo","nombre", $row['module']); + if($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2){ + $row['formated_value'] = round($row['formated_value'], 0, PHP_ROUND_HALF_DOWN); + } + if(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $row['formated_value'] == 1){ + $row['formated_value'] = "Up"; + }elseif(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $row['formated_value'] == 0){ + $row['formated_value'] = "Down"; + } if ($item['date']['period'] != 0) { $table1->data[] = array( $row['agent'], @@ -2640,8 +2649,18 @@ function reporting_html_general(&$table, $item) { $row['agent'] = $agent; $table1->style['agent'] = 'text-align: center;'; foreach ($list_modules as $name) { + $module_type = db_get_value("id_tipo_modulo", "tagente_modulo","nombre", $name); + if($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2){ + $modules[$name] = round($modules[$name], 0, PHP_ROUND_HALF_DOWN); + } $table1->style[$name] = 'text-align: center;'; if (isset($modules[$name])) { + if(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $modules[$name] == 1){ + $modules[$name] = "Up"; + }elseif(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $modules[$name] == 0){ + hd( $modules[$name], true); + $modules[$name] = "Down"; + } $row[$name] = $modules[$name]; } else { From 6f65c9876ff8a5788005e5837a8bec13c0367da5 Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Wed, 9 Jan 2019 16:20:24 +0100 Subject: [PATCH 14/95] Added option in setup for unique main IP in agents - #1744 Former-commit-id: f8f9668a14818a01b811a73052e2e7e82e9a8c7a --- .../godmode/agentes/agent_manager.php | 4 +++- .../godmode/agentes/configurar_agente.php | 22 ++++++++++++++++++- .../godmode/setup/setup_general.php | 5 +++++ pandora_console/include/functions_config.php | 10 +++++++-- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index f94cb7737b..40469f75b2 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -228,7 +228,9 @@ if($new_agent){ } $table->data[2][0] = __('IP Address'); -$table->data[2][1] = html_print_input_text ('direccion', $direccion_agente, '', 16, 100, true); +$table->data[2][1] = html_print_input_text ('direccion', $direccion_agente, '', 16, 100, true). + html_print_checkbox ("unique_ip", 1, $config['unique_ip'], true).__('Unique IP') . + ui_print_help_tip (__("Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent"), true); if ($id_agente) { $table->data[2][1] .= '    '; diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index fab0ad7637..92c3cc4b73 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -81,6 +81,7 @@ $alias_as_name = 0; $direccion_agente = get_parameter('direccion', ''); $direccion_agente = trim(io_safe_output($direccion_agente)); $direccion_agente = io_safe_input($direccion_agente); +$unique_ip = 0; $intervalo = SECONDS_5MINUTES; $ff_interval = 0; $quiet_module = 0; @@ -160,6 +161,7 @@ if ($create_agent) { $alias = (string) get_parameter_post("alias",''); $alias_as_name = (int) get_parameter_post("alias_as_name", 0); $direccion_agente = (string) get_parameter_post("direccion",''); + $unique_ip = (int) get_parameter_post("unique_ip", 0); //safe_output only validate ip $direccion_agente = trim(io_safe_output($direccion_agente)); @@ -214,7 +216,12 @@ if ($create_agent) { $nombre_agente = $alias; } - if(!$exists_alias){ + if($unique_ip && $direccion_agente != ''){ + $sql = 'SELECT direccion FROM tagente WHERE direccion = "' . $direccion_agente . '"'; + $exists_ip = db_get_row_sql($sql); + } + + if(!$exists_alias && !$exists_ip){ $id_agente = db_process_sql_insert ( 'tagente', array ( @@ -304,6 +311,9 @@ if ($create_agent) { if($exists_alias){ $agent_creation_error = __('Could not be created, because name already exists'); } + elseif($exists_ip){ + $agent_creation_error = __('Could not be created, because IP already exists'); + } } } } @@ -712,6 +722,7 @@ if ($update_agent) { // if modified some agent paramenter $alias = str_replace('`','‘',(string) get_parameter_post ("alias", "")); $alias_as_name = (int) get_parameter_post ('alias_as_name', 0); $direccion_agente = (string) get_parameter_post ("direccion", ''); + $unique_ip = (int) get_parameter_post ('unique_ip', 0); //safe_output only validate ip $direccion_agente = trim(io_safe_output($direccion_agente)); @@ -795,9 +806,18 @@ if ($update_agent) { // if modified some agent paramenter ui_print_error_message(__('No agent alias specified')); //If there is an agent with the same name, but a different ID } + + if($unique_ip && $direccion_agente != ''){ + $sql = 'SELECT direccion FROM tagente WHERE direccion = "' . $direccion_agente . '"'; + $exists_ip = db_get_row_sql($sql); + } + if ($grupo <= 0) { ui_print_error_message(__('The group id %d is incorrect.', $grupo)); } + elseif($exists_ip){ + ui_print_error_message(__('Duplicate main IP address')); + } else { //If different IP is specified than previous, add the IP if ($direccion_agente != '' && diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index b935f4fc13..aedeec5173 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -230,6 +230,11 @@ $table->data[38][0] = __('Set alias as name by default in agent creation'); $table->data[38][1] = __('Yes').'   '.html_print_radio_button ('alias_as_name', 1, '', $config["alias_as_name"], true).'  '; $table->data[38][1] .= __('No').'   '.html_print_radio_button ('alias_as_name', 0, '', $config["alias_as_name"], true); +$table->data[39][0] = __('Unique IP') . + ui_print_help_tip (__("Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent"), true); +$table->data[39][1] = __('Yes').'   '.html_print_radio_button ('unique_ip', 1, '', $config["unique_ip"], true).'  '; +$table->data[39][1] .= __('No').'   '.html_print_radio_button ('unique_ip', 0, '', $config["unique_ip"], true); + echo '
'; echo "
"; diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index bd0c78bd76..a1f2320d9f 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -204,10 +204,12 @@ function config_update_config () { $error_update[] = __('Identification_reminder'); if (!config_update_value ('include_agents', (bool)get_parameter('include_agents'))) $error_update[] = __('Include_agents'); - if (!config_update_value ('alias_as_name', get_parameter('alias_as_name'))) - $error_update[] = __('alias_as_name'); + if (!config_update_value ('alias_as_name', get_parameter('alias_as_name'))) + $error_update[] = __('alias_as_name'); if (!config_update_value ('auditdir', get_parameter('auditdir'))) $error_update[] = __('Audit log directory'); + if (!config_update_value ('unique_ip', get_parameter('unique_ip'))) + $error_update[] = __('unique_ip'); break; case 'enterprise': if (isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) { @@ -1123,6 +1125,10 @@ function config_process_config () { config_update_value ('limit_parameters_massive', ini_get("max_input_vars") / 2); } + if (!isset ($config["unique_ip"])) { + config_update_value ('unique_ip', 0); + } + /* *Parse the ACL IP list for access API */ From 439f1db62055edd048425ac179d6c2ead9ba000e Mon Sep 17 00:00:00 2001 From: samucarc Date: Wed, 9 Jan 2019 18:11:21 +0100 Subject: [PATCH 15/95] Fixed link in cron job and visual console manager Former-commit-id: 6533fcc628157231c7bd524d878c144faac02447 --- pandora_console/godmode/reporting/map_builder.php | 9 +++++++++ .../godmode/reporting/visual_console_favorite.php | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index a9df342750..cebc0b6c8a 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -43,6 +43,7 @@ else{ $url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite'; $url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template'; $url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard'; + $url_visual_console_manager = 'index.php?sec=screen&sec2=enterprise/extensions/visual_console_manager'; } $pure = (int)get_parameter('pure', 0); @@ -74,6 +75,14 @@ if($is_enterprise && $vconsoles_manage){ 'text' => '' . html_print_image ("images/wand.png", true, array ("title" => __('Visual Console Template Wizard'))) .'' ); + + if ($is_metaconsole) { + $buttons['visual_console_manager'] = array( + 'active' => false, + 'text' => '' . + html_print_image ("images/builder.png", true, array ("title" => __('Visual Console Manager'))) .'' + ); + } } if (!$is_metaconsole) { diff --git a/pandora_console/godmode/reporting/visual_console_favorite.php b/pandora_console/godmode/reporting/visual_console_favorite.php index a660a81007..0031879a32 100644 --- a/pandora_console/godmode/reporting/visual_console_favorite.php +++ b/pandora_console/godmode/reporting/visual_console_favorite.php @@ -42,6 +42,7 @@ else{ $url_visual_console_favorite = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_favorite'; $url_visual_console_template = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_template'; $url_visual_console_template_wizard = 'index.php?sec=screen&sec2=screens/screens&action=visualmap_wizard'; + $url_visual_console_manager = 'index.php?sec=screen&sec2=enterprise/extensions/visual_console_manager'; } $buttons['visual_console'] = array( @@ -68,6 +69,14 @@ if($is_enterprise && $vconsoles_manage){ 'text' => '' . html_print_image ("images/wand.png", true, array ("title" => __('Visual Console Template Wizard'))) .'' ); + + if ($is_metaconsole) { + $buttons['visual_console_manager'] = array( + 'active' => false, + 'text' => '' . + html_print_image ("images/builder.png", true, array ("title" => __('Visual Console Manager'))) .'' + ); + } } if (!$is_metaconsole) { From cc7e9e55375bdf5980784e0f1cab6aac28c11c87 Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Thu, 10 Jan 2019 17:33:24 +0100 Subject: [PATCH 16/95] Visuals changes in the data of general type reports Former-commit-id: 15d0c6f67d2b1cafddd372c96807e8c4201c4f7f --- .../include/functions_reporting.php | 19 +++++++++++++---- .../include/functions_reporting_html.php | 21 ++++--------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 3209a61492..9683fc5158 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -6126,7 +6126,7 @@ function reporting_general($report, $content) { $unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $row['id_agent_module']); - + $id_module_type = db_get_value("id_tipo_modulo", "tagente_modulo","nombre", $mod_name); if ($content['period'] == 0) { $data_res[$index] = modules_get_last_value($row['id_agent_module']); @@ -6167,9 +6167,21 @@ function reporting_general($report, $content) { $agent_name[$index] = $ag_name; $module_name[$index] = $mod_name; $units[$index] = $unit; + $id_module_types[$index] = $id_module_type; $operations[$index] = $row['operation']; break; case REPORT_GENERAL_GROUP_BY_AGENT: + $id_module_types[$index] = $id_module_type; + if($id_module_types[$index] == 2 || $id_module_types[$index] == 6 || $id_module_types[$index] == 9 || $id_module_types[$index] == 18 ){ + $data_res[$index] = round($data_res[$index], 0, PHP_ROUND_HALF_DOWN); + } + if($id_module_types[$index] == 2 || $id_module_types[$index] == 6 || $id_module_types[$index] == 9 || $id_module_types[$index] == 18 ){ + if($data_res[$index] == 1){ + $data_res[$index] = "Up"; + }elseif($data_res[$index] == 0){ + $data_res[$index] = "Down"; + } + } if ($data_res[$index] === false) { $return["data"][$ag_name][$mod_name] = null; } @@ -6178,6 +6190,7 @@ function reporting_general($report, $content) { $return["data"][$ag_name][$mod_name] = $data_res[$index]; } else { + hd($data_res[$index], true); $return["data"][$ag_name][$mod_name] = format_for_graph($data_res[$index], 2) . " " . $unit; } @@ -6267,8 +6280,6 @@ function reporting_general($report, $content) { break; } - - $i = 0; foreach ($data_res as $d) { $data = array(); @@ -6276,7 +6287,7 @@ function reporting_general($report, $content) { $data['module'] = $module_name[$i]; $data['id_agent_module'] = $id_agent_module[$i]; $data['id_agent'] = agents_get_agent_id_by_module_id($id_agent_module[$i]); - + $data['id_module_type'] = $id_module_types[$i]; $data['operator'] = ""; if ($content['period'] != 0) { switch ($operations[$i]) { diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 2e4b2b521a..e9a3f41029 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2568,15 +2568,14 @@ function reporting_html_general(&$table, $item) { array_multisort($aux, SORT_ASC, $item['data']); /* End - Order by agent */ - + foreach ($item['data'] as $row) { - $module_type = db_get_value("id_tipo_modulo", "tagente_modulo","nombre", $row['module']); - if($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2){ + if($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2){ $row['formated_value'] = round($row['formated_value'], 0, PHP_ROUND_HALF_DOWN); } - if(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $row['formated_value'] == 1){ + if(($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) && $row['formated_value'] == 1){ $row['formated_value'] = "Up"; - }elseif(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $row['formated_value'] == 0){ + }elseif(($row['id_module_type'] == 6 || $row['id_module_type'] == 9 || $row['id_module_type'] == 18 || $row['id_module_type'] == 2) && $row['formated_value'] == 0){ $row['formated_value'] = "Down"; } if ($item['date']['period'] != 0) { @@ -2639,28 +2638,16 @@ function reporting_html_general(&$table, $item) { } } $list_modules = array_keys($list_modules); - $table1->width = '99%'; $table1->data = array (); $table1->head = array_merge(array(__('Agent')), $list_modules); foreach ($item['data'] as $agent => $modules) { $row = array(); - $row['agent'] = $agent; $table1->style['agent'] = 'text-align: center;'; foreach ($list_modules as $name) { - $module_type = db_get_value("id_tipo_modulo", "tagente_modulo","nombre", $name); - if($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2){ - $modules[$name] = round($modules[$name], 0, PHP_ROUND_HALF_DOWN); - } $table1->style[$name] = 'text-align: center;'; if (isset($modules[$name])) { - if(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $modules[$name] == 1){ - $modules[$name] = "Up"; - }elseif(($module_type == 6 || $module_type == 9 || $module_type == 18 || $module_type == 2) && $modules[$name] == 0){ - hd( $modules[$name], true); - $modules[$name] = "Down"; - } $row[$name] = $modules[$name]; } else { From 0d48b4573a66e0f51d63d05eba427d3bf938e14f Mon Sep 17 00:00:00 2001 From: samucarc Date: Mon, 14 Jan 2019 18:54:43 +0100 Subject: [PATCH 17/95] Fixed Label in the Console Menu Former-commit-id: eb73f14fa5631dd481b36711ea0bb62943ec43e5 --- pandora_console/general/main_menu.php | 19 +++++++++++++++++-- pandora_console/include/functions_menu.php | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/pandora_console/general/main_menu.php b/pandora_console/general/main_menu.php index 8cb37fa2c4..3c82b4659f 100644 --- a/pandora_console/general/main_menu.php +++ b/pandora_console/general/main_menu.php @@ -324,6 +324,23 @@ $(document).ready( function() { } else { $('div#title_menu').hide(); + if(!click_display){ + $('#menu').mouseenter(function() { + handsInMenu = 1; + openTimeMenu = new Date().getTime(); + $('ul.submenu').css('left', '44px'); + }).mouseleave(function() { + handsInMenu = 0; + setTimeout(function() { + openedMenu = new Date().getTime() - openTimeMenu; + if(openedMenu > 1000 && handsInMenu == 0) { + $('li.menu_icon').removeClass( " no_hidden_menu"); + $('li.menu_icon').find('li').removeClass( " no_hidden_menu" ); + $('ul.submenu').css('left', '44px'); + } + }, 2500); + }); + } } }); /* ]]> */ @@ -336,7 +353,6 @@ $(document).ready( function() { handsIn2 = 0; if(!click_display){ - if (autohidden_menu) { $('.menu_icon').mouseenter(function() { table_hover = $(this); handsIn = 1; @@ -356,7 +372,6 @@ $(document).ready( function() { } }, 2500); }); - } }else{ $(document).ready(function() { if (autohidden_menu) { diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index a07bde5528..3e80acfc9d 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -395,7 +395,7 @@ function menu_print_menu (&$menu) { $seleccionado = ''; //Print out the first level - $output .= '
  • '; + $output .= '
  • '; //onclick="location.href=\'index.php?sec='.$mainsec.'&sec2='.$main["sec2"].($main["refr"] ? '&refr='.$main["refr"] : '').'\'">'; $length = strlen(__($main["text"])); From ff85a4a8d534fb50503877cb89df20ae897c2d14 Mon Sep 17 00:00:00 2001 From: samucarc Date: Tue, 15 Jan 2019 13:10:13 +0100 Subject: [PATCH 18/95] Eliminated message when secondary groups are added Former-commit-id: 07a6e423a66830543126444a5b4f54c196818e63 --- pandora_console/godmode/agentes/configurar_agente.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index fab0ad7637..44e6bf3c00 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -847,7 +847,7 @@ if ($update_agent) { // if modified some agent paramenter $result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agente)); - if ($result == false && $update_custom_result == false) { + if ($result === false && $update_custom_result == false) { ui_print_error_message( __('There was a problem updating the agent')); } From e316977d4b407bd7ae393d087de35bf930c7d947 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Wed, 16 Jan 2019 12:23:19 +0100 Subject: [PATCH 19/95] Refactorize and add two new fields to api_get_groups api function Former-commit-id: 2d59091279c284d549c09744ee61c8fee1e33564 --- pandora_console/include/functions_api.php | 34 +++++++++++------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 53479ae7ed..aa21faad1a 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -283,30 +283,28 @@ function api_get_test_event_replication_db() { //-------------------------DEFINED OPERATIONS FUNCTIONS----------------- function api_get_groups($thrash1, $thrash2, $other, $returnType, $user_in_db) { - if (defined ('METACONSOLE')) { - return; - } - if ($other['type'] == 'string') { - if ($other['data'] != '') { - returnError('error_parameter', 'Error in the parameters.'); - return; - } - else {//Default values - $separator = ';'; - } - } - else if ($other['type'] == 'array') { - $separator = $other['data'][0]; - } - - $groups = users_get_groups ($user_in_db, "IR"); + $returnAllGroup = true; + $returnAllColumns = false; + + if (isset($other['data'][1])) + $returnAllGroup = ( $other['data'][1] == '1' ? true : false); + + if (isset($other['data'][2])) + $returnAllColumns = ( $other['data'][2] == '1' ? true : false); + + $groups = users_get_groups ($user_in_db, "IR", $returnAllGroup, $returnAllColumns); $data_groups = array(); foreach ($groups as $id => $group) { $data_groups[] = array($id, $group); } - + + if (!isset($other['data'][0])) + $separator = ';'; // by default + else + $separator = $other['data'][0]; + $data['type'] = 'array'; $data['data'] = $data_groups; From fd2dcb3281f08a1c0b529c79aea6ccb65144e00d Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Thu, 17 Jan 2019 17:28:23 +0100 Subject: [PATCH 20/95] Changed radio buttons by toogle switch checkbox Former-commit-id: d4b46db05fa38e268e0c6f82979bca52fec36e78 --- pandora_console/godmode/setup/performance.php | 9 +-- pandora_console/godmode/setup/setup_auth.php | 15 +--- .../godmode/setup/setup_ehorus.php | 4 +- .../godmode/setup/setup_general.php | 65 ++++++++-------- .../godmode/setup/setup_visuals.php | 36 +++++---- pandora_console/include/functions_html.php | 77 +++++++++++++++++++ pandora_console/include/styles/pandora.css | 74 +++++++++++++----- 7 files changed, 190 insertions(+), 90 deletions(-) diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index ceeae084c8..ae8777dfa6 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -115,22 +115,19 @@ $table_other->data[3][0] = __('Default hours for event view'); $table_other->data[3][1] = html_print_input_text ('event_view_hr', $config["event_view_hr"], '', 5, 5, true); $table_other->data[5][0] = __('Use realtime statistics'); -$table_other->data[5][1] = __('Yes').' '.html_print_radio_button ('realtimestats', 1, '', $config["realtimestats"], true).'  '; -$table_other->data[5][1] .= __('No').' '.html_print_radio_button ('realtimestats', 0, '', $config["realtimestats"], true); +$table_other->data[5][1] = html_print_checkbox_toogle_switch ('realtimestats', 1, $config["realtimestats"], true); $table_other->data[6][0] = __('Batch statistics period (secs)') . ui_print_help_tip(__('If realtime statistics are disabled, statistics interval resfresh will be set here.'), true); $table_other->data[6][1] = html_print_input_text ('stats_interval', $config["stats_interval"], '', 5, 5, true); $table_other->data[7][0] = __('Use agent access graph') . ui_print_help_icon("agent_access", true); -$table_other->data[7][1] = __('Yes').' '.html_print_radio_button ('agentaccess', 1, '', $config["agentaccess"], true).'  '; -$table_other->data[7][1] .= __('No').' '.html_print_radio_button ('agentaccess', 0, '', $config["agentaccess"], true); +$table_other->data[7][1] = html_print_checkbox_toogle_switch ('agentaccess', 1, $config["agentaccess"], true); $table_other->data[8][0] = __('Max. recommended number of files in attachment directory') . ui_print_help_tip(__('This number is the maximum number of files in attachment directory. If this number is reached then a warning message will appear in the header notification space.'), true); $table_other->data[8][1] = html_print_input_text ('num_files_attachment', $config["num_files_attachment"], '', 5, 5, true); $table_other->data[9][0] = __('Delete not init modules'); -$table_other->data[9][1] = __('Yes').' '.html_print_radio_button ('delete_notinit', 1, '', $config["delete_notinit"], true).'  '; -$table_other->data[9][1] .= __('No').' '.html_print_radio_button ('delete_notinit', 0, '', $config["delete_notinit"], true); +$table_other->data[9][1] = html_print_checkbox_toogle_switch ('delete_notinit', 1, $config["delete_notinit"], true); $table_other->data[10][0] = __('Big Operation Step to purge old data') . ui_print_help_tip(__('The number of blocks that a time interval is split into. A bigger value means bigger blocks, which is faster but heavier on the database. Default is 100.'), true); $table_other->data[10][1] = html_print_input_text ('big_operation_step_datos_purge', $config["big_operation_step_datos_purge"], '', 5, 5, true); diff --git a/pandora_console/godmode/setup/setup_auth.php b/pandora_console/godmode/setup/setup_auth.php index 3adf8adf8a..d09449dd1a 100644 --- a/pandora_console/godmode/setup/setup_auth.php +++ b/pandora_console/godmode/setup/setup_auth.php @@ -48,16 +48,14 @@ if (is_ajax ()) { $row = array(); $row['name'] = __('Fallback to local authentication') . ui_print_help_tip(__("Enable this option if you want to fallback to local authentication when remote (ldap etc...) authentication failed."), true); - $row['control'] = __('Yes').' '.html_print_radio_button('fallback_local_auth', 1, '', $config['fallback_local_auth'], true).'  '; - $row['control'] .= __('No').' '.html_print_radio_button('fallback_local_auth', 0, '', $config['fallback_local_auth'], true); + $row['control'] = html_print_checkbox_toogle_switch ('fallback_local_auth', 1, $config['fallback_local_auth'], true); $table->data['fallback_local_auth'] = $row; if (enterprise_installed()) { // Autocreate remote users $row = array(); $row['name'] = __('Autocreate remote users'); - $row['control'] = __('Yes').' '.html_print_radio_button_extended('autocreate_remote_users', 1, '', $config['autocreate_remote_users'], false, '', '', true).'  '; - $row['control'] .= __('No').' '.html_print_radio_button_extended('autocreate_remote_users', 0, '', $config['autocreate_remote_users'], false, '', '', true); + $row['control'] = html_print_checkbox_toogle_switch_extended('autocreate_remote_users', 1, $config['autocreate_remote_users'], false, '', '', true).'  '; $table->data['autocreate_remote_users'] = $row; add_enterprise_auth_autocreate_profiles($table, $type_auth); @@ -91,8 +89,7 @@ if (is_ajax ()) { // Start TLS $row = array(); $row['name'] = __('Start TLS'); - $row['control'] = __('Yes').' '.html_print_radio_button ('ldap_start_tls', 1, '', $config['ldap_start_tls'], true).'  '; - $row['control'] .= __('No').' '.html_print_radio_button ('ldap_start_tls', 0, '', $config['ldap_start_tls'], true); + $row['control'] = html_print_checkbox_toogle_switch ('ldap_start_tls', 1, $config['ldap_start_tls'], true); $table->data['ldap_start_tls'] = $row; // Base DN @@ -138,11 +135,7 @@ if (is_ajax ()) { $row = array(); $row['name'] = __('Double authentication') . ui_print_help_tip(__("If this option is enabled, the users can use double authentication with their accounts"), true); - $row['control'] = __('Yes') . ' '; - $row['control'] .= html_print_radio_button('double_auth_enabled', 1, '', $config['double_auth_enabled'], true); - $row['control'] .= '  '; - $row['control'] .= __('No') .' '; - $row['control'] .= html_print_radio_button('double_auth_enabled', 0, '', $config['double_auth_enabled'], true); + $row['control'] = html_print_checkbox_toogle_switch('double_auth_enabled', 1, $config['double_auth_enabled'], true); $table->data['double_auth_enabled'] = $row; // Session timeout diff --git a/pandora_console/godmode/setup/setup_ehorus.php b/pandora_console/godmode/setup/setup_ehorus.php index 14d4d35215..bc3a5c220e 100644 --- a/pandora_console/godmode/setup/setup_ehorus.php +++ b/pandora_console/godmode/setup/setup_ehorus.php @@ -52,8 +52,8 @@ $table_enable->style['name'] = 'font-weight: bold'; // Enable eHorus $row = array(); $row['name'] = __('Enable eHorus'); -$row['control'] = __('Yes').' '.html_print_radio_button ('ehorus_enabled', 1, '', $config['ehorus_enabled'], true).'  '; -$row['control'] .= __('No').' '.html_print_radio_button ('ehorus_enabled', 0, '', $config['ehorus_enabled'], true); +$row['control'] = __('Enabled').' '.html_print_radio_button ('ehorus_enabled', 1, '', $config['ehorus_enabled'], true).'  '; +$row['control'] .= __('Disabled').' '.html_print_radio_button ('ehorus_enabled', 0, '', $config['ehorus_enabled'], true); $row['button'] = html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"', true); $table_enable->data['ehorus_enabled'] = $row; diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index b935f4fc13..02bce13696 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -72,16 +72,17 @@ $sources["sql"] = __('Database'); $table->data[9][1] = html_print_select ($sources, 'timesource', $config["timesource"], '', '', '', true); $table->data[10][0] = __('Automatic check for updates'); -$table->data[10][1] = __('Yes').'   '.html_print_radio_button ('autoupdate', 1, '', $config["autoupdate"], true).'  '; -$table->data[10][1] .= __('No').'   '.html_print_radio_button ('autoupdate', 0, '', $config["autoupdate"], true); +$table->data[10][1] = html_print_checkbox_toogle_switch('autoupdate', 1, $config["autoupdate"], true); + +echo""; $table->data[11][0] = __('Enforce https'); -$table->data[11][1] = __('Yes').'   '.html_print_radio_button_extended ('https', 1, '', $config["https"], false, "if (! confirm ('" . __('If SSL is not properly configured you will lose access to %s Console. Do you want to continue?', get_product_name()) . "')) return false", '', true) .'  '; -$table->data[11][1] .= __('No').'   '.html_print_radio_button ('https', 0, '', $config["https"], true); +$table->data[11][1] = html_print_checkbox_toogle_switch_extended ('https', 1, $config["https"], false, '', '', true) ; $table->data[12][0] = __('Use cert of SSL'); -$table->data[12][1] = __('Yes').'   '.html_print_radio_button_extended ('use_cert', 1, '', $config["use_cert"], false, '', '', true) .'  '; -$table->data[12][1] .= __('No').'   '.html_print_radio_button ('use_cert', 0, '', $config["use_cert"], true); +$table->data[12][1] = html_print_checkbox_toogle_switch_extended ('use_cert', 1, $config["use_cert"], false, '', '', true); $table->rowstyle[13] = 'display: none;'; $table->data[13][0] = __('Path of SSL Cert.') . ui_print_help_tip (__("Path where you put your cert and name of this cert. Remember your cert only in .pem extension."), true); @@ -104,8 +105,7 @@ $table->data[16][0] = __('API password') . $table->data[16][1] = html_print_input_password('api_password', io_output_password($config['api_password']), '', 25, 255, true); $table->data[17][0] = __('Enable GIS features'); -$table->data[17][1] = __('Yes').'   '.html_print_radio_button ('activate_gis', 1, '', $config["activate_gis"], true).'  '; -$table->data[17][1] .= __('No').'   '.html_print_radio_button ('activate_gis', 0, '', $config["activate_gis"], true); +$table->data[17][1] = html_print_checkbox_toogle_switch ('activate_gis', 1, $config["activate_gis"], true); $table->data[19][0] = __('Enable Netflow'); $rbt_disabled = false; @@ -113,8 +113,7 @@ if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { $rbt_disabled = true; $table->data[19][0] .= ui_print_help_tip (__('Not supported in Windows systems'), true); } -$table->data[19][1] = __('Yes').'   '.html_print_radio_button_extended ('activate_netflow', 1, '', $config["activate_netflow"], $rbt_disabled, '', '', true).'  '; -$table->data[19][1] .= __('No').'   '.html_print_radio_button_extended ('activate_netflow', 0, '', $config["activate_netflow"], $rbt_disabled, '', '', true); +$table->data[19][1] = html_print_checkbox_toogle_switch_extended ('activate_netflow', 1, $config["activate_netflow"], $rbt_disabled, '', '', true); $zone_name = array('Africa' => __('Africa'), 'America' => __('America'), 'Antarctica' => __('Antarctica'), 'Arctic' => __('Arctic'), 'Asia' => __('Asia'), 'Atlantic' => __('Atlantic'), 'Australia' => __('Australia'), 'Europe' => __('Europe'), 'Indian' => __('Indian'), 'Pacific' => __('Pacific'), 'UTC' => __('UTC')); @@ -168,25 +167,16 @@ $table->data[28][1] = html_print_input_text ('public_url', $config['public_url'] $table->data[29][0] = __('Referer security'); $table->data[29][0] .= ui_print_help_tip(__("If enabled, actively checks if the user comes from %s's URL", get_product_name()), true); -$table->data[29][1] = __('Yes') . '   ' . - html_print_radio_button ('referer_security', 1, '', $config["referer_security"], true) . - '  '; -$table->data[29][1] .= __('No') . '   ' . - html_print_radio_button ('referer_security', 0, '', $config["referer_security"], true); +$table->data[29][1] = html_print_checkbox_toogle_switch ('referer_security', 1, $config["referer_security"], true); $table->data[30][0] = __('Event storm protection'); $table->data[30][0] .= ui_print_help_tip(__('If set to yes no events or alerts will be generated, but agents will continue receiving data.'), true); -$table->data[30][1] = __('Yes') . '   ' . - html_print_radio_button ('event_storm_protection', 1, '', $config["event_storm_protection"], true) . - '  '; -$table->data[30][1] .= __('No') . '   ' . - html_print_radio_button ('event_storm_protection', 0, '', $config["event_storm_protection"], true); +$table->data[30][1] = html_print_checkbox_toogle_switch ('event_storm_protection', 1, $config["event_storm_protection"], true); $table->data[31][0] = __('Command Snapshot') . ui_print_help_tip(__('The string modules with several lines show as command output'), true); -$table->data[31][1] = __('Yes').'   '.html_print_radio_button ('command_snapshot', 1, '', $config["command_snapshot"], true).'  '; -$table->data[31][1] .= __('No').'   '.html_print_radio_button ('command_snapshot', 0, '', $config["command_snapshot"], true); +$table->data[31][1] = html_print_checkbox_toogle_switch ('command_snapshot', 1, $config["command_snapshot"], true); $table->data[32][0] = __('Server logs directory') . ui_print_help_tip (__("Directory where the server logs are stored."), true); $table->data[32][1] = html_print_input_text ('server_log_dir', @@ -210,8 +200,7 @@ $table->data['tutorial_mode'][1] = $config["past_planned_downtimes"] = isset($config["past_planned_downtimes"]) ? $config["past_planned_downtimes"] : 1; $table->data[34][0] = __('Allow create planned downtimes in the past') . ui_print_help_tip(__('The planned downtimes created in the past will affect the SLA reports'), true); -$table->data[34][1] = __('Yes').'   '.html_print_radio_button ('past_planned_downtimes', 1, '', $config["past_planned_downtimes"], true).'  '; -$table->data[34][1] .= __('No').'   '.html_print_radio_button ('past_planned_downtimes', 0, '', $config["past_planned_downtimes"], true); +$table->data[34][1] =html_print_checkbox_toogle_switch ('past_planned_downtimes', 1, $config["past_planned_downtimes"], true); $table->data[35][0] = __('Limit for bulk operations') . ui_print_help_tip(__('Your PHP environment is set to 1000 max_input_vars. This parameter should have the same value or lower.', ini_get("max_input_vars")), true); @@ -219,17 +208,14 @@ $table->data[35][1] = html_print_input_text('limit_parameters_massive', $config['limit_parameters_massive'], '', 10, 10, true); $table->data[36][0] = __('Include agents manually disabled'); -$table->data[36][1] = __('Yes').'   '.html_print_radio_button ('include_agents', 1, '', $config["include_agents"], true).'  '; -$table->data[36][1] .= __('No').'   '.html_print_radio_button ('include_agents', 0, '', $config["include_agents"], true); +$table->data[36][1] = html_print_checkbox_toogle_switch ('include_agents', 1, $config["include_agents"], true); $table->data[37][0] = __('Audit log directory') . ui_print_help_tip (__("Directory where audit log is stored."), true); $table->data[37][1] = html_print_input_text ('auditdir', io_safe_output($config["auditdir"]), '', 30, 100, true); $table->data[38][0] = __('Set alias as name by default in agent creation'); -$table->data[38][1] = __('Yes').'   '.html_print_radio_button ('alias_as_name', 1, '', $config["alias_as_name"], true).'  '; -$table->data[38][1] .= __('No').'   '.html_print_radio_button ('alias_as_name', 0, '', $config["alias_as_name"], true); - +$table->data[38][1] = html_print_checkbox_toogle_switch ('alias_as_name', 1, $config["alias_as_name"], true); echo ''; echo "
    "; @@ -293,15 +279,24 @@ $(document).ready (function () { $("#timezone").attr("hidden", false); }); $("input[name=use_cert]").change(function () { - if( $(this).is(":checked") ){ - var val = $(this).val(); - if (val == 1) { + if( $(this).is(":checked") ) $('#setup_general-13').show(); - } else $('#setup_general-13').hide(); - } + }); + $("input[name=https]").change(function (){ + if($("input[name=https]").prop('checked')) { + $("#dialog").css({'display': 'inline', 'font-weight': 'bold'}).dialog({ + modal: true, + buttons:{ + "": function(){ + $(this).dialog("close"); + } + } + }); + } + }) }); +?> \ No newline at end of file diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index d8902f2bc0..05b2c44da5 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -78,12 +78,12 @@ $table_behaviour->data[$row][1] = html_print_select ($values, 'vc_refr', $config $row++; $table_behaviour->data[$row][0] = __('Paginated module view'); -$table_behaviour->data[$row][1] = html_print_checkbox('paginate_module', 1, +$table_behaviour->data[$row][1] = html_print_checkbox_toogle_switch('paginate_module', 1, $config['paginate_module'], true); $row++; $table_behaviour->data[$row][0] = __('Display data of proc modules in other format'); -$table_behaviour->data[$row][1] = html_print_checkbox('render_proc', 1, +$table_behaviour->data[$row][1] = html_print_checkbox_toogle_switch('render_proc', 1, $config['render_proc'], true); $row++; @@ -98,7 +98,7 @@ $row++; //Daniel maya 02/06/2016 Display menu with click --INI $table_behaviour->data[$row][0] = __('Click to display lateral menus'). ui_print_help_tip(__('When enabled, the lateral menus are shown when left clicking them, instead of hovering over them'), true); -$table_behaviour->data[$row][1] = html_print_checkbox('click_display', 1, +$table_behaviour->data[$row][1] = html_print_checkbox_toogle_switch('click_display', 1, $config['click_display'], true); $row++; //Daniel maya 02/06/2016 Display menu with click --END @@ -116,7 +116,7 @@ if (enterprise_installed()) { $table_behaviour->data[$row][0] = __('Classic menu mode'). ui_print_help_tip(__('Text menu options always visible, don\'t hide'), true); -$table_behaviour->data[$row][1] = html_print_checkbox('classic_menu', 1, +$table_behaviour->data[$row][1] = html_print_checkbox_toogle_switch('classic_menu', 1, $config['classic_menu'], true); $row++; @@ -385,7 +385,7 @@ if(enterprise_installed()) { if (enterprise_installed()){ $table_styles->data[$row][0] = __('Disable logo in graphs'); - $table_styles->data[$row][1] = html_print_checkbox('fixed_graph', 1, + $table_styles->data[$row][1] = html_print_checkbox_toogle_switch('fixed_graph', 1, $config['fixed_graph'], true); $row++; } @@ -396,27 +396,27 @@ You can of course remove the warnings, that's why we include the source and do n */ $table_styles->data[$row][0] = __('Disable helps'); -$table_styles->data[$row][1] = html_print_checkbox('disable_help', 1, +$table_styles->data[$row][1] = html_print_checkbox_toogle_switch('disable_help', 1, $config['disable_help'], true); $row++; $table_styles->data[$row][0] = __('Fixed header'); -$table_styles->data[$row][1] = html_print_checkbox('fixed_header', 1, +$table_styles->data[$row][1] = html_print_checkbox_toogle_switch('fixed_header', 1, $config['fixed_header'], true); $row++; $table_styles->data[$row][0] = __('Fixed menu'); -$table_styles->data[$row][1] = html_print_checkbox('fixed_menu', 1, +$table_styles->data[$row][1] = html_print_checkbox_toogle_switch('fixed_menu', 1, $config['fixed_menu'], true); $row++; // For 5.1 Autohidden menu feature $table_styles->data['autohidden'][0] = __('Autohidden menu'); -$table_styles->data['autohidden'][1] = html_print_checkbox('autohidden_menu', +$table_styles->data['autohidden'][1] = html_print_checkbox_toogle_switch('autohidden_menu', 1, $config['autohidden_menu'], true); $table_styles->data[$row][0] = __('Visual effects and animation'); -$table_styles->data[$row][1] = html_print_checkbox('visual_animation', 1, +$table_styles->data[$row][1] = html_print_checkbox_toogle_switch('visual_animation', 1, $config['visual_animation'], true); echo "
    "; @@ -437,7 +437,7 @@ $table_gis->data = array (); $table_gis->data[$row][0] = __('GIS Labels') . ui_print_help_tip(__('This enabling this, you get a label with agent name in GIS maps. If you have lots of agents in the map, will be unreadable. Disabled by default.'), true); -$table_gis->data[$row][1] = html_print_checkbox('gis_label', 1, +$table_gis->data[$row][1] = html_print_checkbox_toogle_switch('gis_label', 1, $config['gis_label'], true); $row++; @@ -528,7 +528,7 @@ $row++; $table_font->data[$row][0] = __('Show unit along with value in reports') . ui_print_help_tip(__('This enabling this, max, min and avg values will be shown with units.'), true); -$table_font->data[$row][1] = html_print_checkbox('simple_module_value', 1, +$table_font->data[$row][1] = html_print_checkbox_toogle_switch('simple_module_value', 1, $config['simple_module_value'], true); $row++; @@ -615,7 +615,7 @@ $table_chars->data[$row][1] = html_print_input_text ('custom_graph_width', $row++; $table_chars->data[$row][0] = __('Use round corners'); -$table_chars->data[$row][1] = html_print_checkbox('round_corner', 1, +$table_chars->data[$row][1] = html_print_checkbox_toogle_switch('round_corner', 1, $config['round_corner'], true); $row++; @@ -765,7 +765,7 @@ $table_other->data = array (); $table_other->data[$row][0] = __('Show report info with description') . ui_print_help_tip( __('Custom report description info. It will be applied to all reports and templates by default.'), true); -$table_other->data[$row][1] = html_print_checkbox('custom_report_info', 1, +$table_other->data[$row][1] = html_print_checkbox_toogle_switch('custom_report_info', 1, $config['custom_report_info'], true); $row++; @@ -777,6 +777,7 @@ $table_other->data[$row][0] = __('Custom report front page') . __('Custom report front page. It will be applied to all reports and templates by default.'), true); $table_other->data[$row][1] = html_print_checkbox('custom_report_front', 1, $config['custom_report_front'], true); + $row++; //---------------------------------------------------------------------- @@ -844,7 +845,7 @@ $table_other->data['custom_report_front-footer'][1] = html_print_textarea('custo $table_other->data[$row][0] = __('Show QR Code icon in the header'); -$table_other->data[$row][1] = html_print_checkbox('show_qr_code_header', 1, +$table_other->data[$row][1] = html_print_checkbox_toogle_switch('show_qr_code_header', 1, $config['show_qr_code_header'], true); $row++; @@ -865,7 +866,7 @@ $row++; $table_other->data[$row][0] = __('Show only the group name'); $table_other->data[$row][0] .= ui_print_help_tip( __('Show the group name instead the group icon.'), true); -$table_other->data[$row][1] = html_print_checkbox('show_group_name', 1, +$table_other->data[$row][1] = html_print_checkbox_toogle_switch('show_group_name', 1, $config['show_group_name'], true); $row++; @@ -1184,6 +1185,7 @@ $(document).ready (function () { .prop('checked'); display_custom_report_front(custom_report,$(this).parent().parent().parent().parent().attr('id')); }); + $(".databox.filters").css('margin-bottom','-10px'); }); // Change the favicon preview when is changed @@ -1353,4 +1355,4 @@ $("#button-status_set_preview").click (function (e) { } }); - + \ No newline at end of file diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 06257a5457..7f66131e86 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1956,6 +1956,83 @@ function html_print_checkbox ($name, $value, $checked = false, $return = false, return $output; } +/** + * Render a checkbox button input toogle switch type. Extended version, use html_print_checkbox_toogle_switch() to simplify. + * + * @param string Input name. + * @param string Input value. + * @param string Set the button to be marked (optional, unmarked by default). + * @param bool Disable the button (optional, button enabled by default). + * @param string Script to execute when onClick event is triggered (optional). + * @param string Optional HTML attributes. It's a free string which will be + inserted into the HTML tag, use it carefully (optional). + * @param bool Whether to return an output string or echo now (optional, echo by default). + * + * @return string HTML code if return parameter is true. + */ + +function html_print_checkbox_toogle_switch_extended ($name, $value, $checked, $disabled, $script, $attributes, $return = false, $id='') { + static $idcounter = array (); + + //If duplicate names exist, it will start numbering. Otherwise it won't + if (isset ($idcounter[$name])) { + $idcounter[$name]++; + } + else { + $idcounter[$name] = 0; + } + + $id_aux = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.($idcounter[$name] ? $idcounter[$name] : '')); + + $output = '
  • '; echo $html; } @@ -397,9 +397,20 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) } -function reporting_html_SLA($table, $item, $mini) +function reporting_html_SLA($table, $item, $mini, $pdf=0) { - $style = db_get_value('style', 'treport_content', 'id_rc', $item['id_rc']); + if ($table === false) { + $table = new stdClass(); + $table->width = '99%'; + $table->class = 'table_beauty'; + } + + $style = db_get_value( + 'style', + 'treport_content', + 'id_rc', + $item['id_rc'] + ); $style = json_decode(io_safe_output($style), true); $same_agent_in_resume = ''; @@ -423,7 +434,9 @@ function reporting_html_SLA($table, $item, $mini) $table->data['sla']['cell'] = $item['failed']; } else { if (!empty($item['planned_downtimes'])) { - $downtimes_table = reporting_html_planned_downtimes_table($item['planned_downtimes']); + $downtimes_table = reporting_html_planned_downtimes_table( + $item['planned_downtimes'] + ); if (!empty($downtimes_table)) { $table->colspan['planned_downtime']['cell'] = 3; @@ -459,7 +472,7 @@ function reporting_html_SLA($table, $item, $mini) $table1->headstyle[4] = 'text-align: right'; $table1->headstyle[5] = 'text-align: right'; - // second_table for time globals + // Second_table for time globals. $table2 = new stdClass(); $table2->width = '99%'; @@ -490,7 +503,7 @@ function reporting_html_SLA($table, $item, $mini) $table2->headstyle[5] = 'text-align: right'; $table2->headstyle[6] = 'text-align: right'; - // third_table for time globals + // Third_table for time globals. $table3 = new stdClass(); $table3->width = '99%'; @@ -520,15 +533,23 @@ function reporting_html_SLA($table, $item, $mini) foreach ($item['data'] as $sla) { if (isset($sla)) { - $the_first_men_time = get_agent_first_time(io_safe_output($sla['agent'])); + $the_first_men_time = get_agent_first_time( + io_safe_output($sla['agent']) + ); - // first_table + // First_table. $row = []; $row[] = $sla['agent']; $row[] = $sla['module']; if (is_numeric($sla['dinamic_text'])) { - $row[] = sla_truncate($sla['max'], $config['graph_precision']).' / '.sla_truncate($sla['min'], $config['graph_precision']); + $row[] = sla_truncate( + $sla['max'], + $config['graph_precision'] + ).' / '.sla_truncate( + $sla['min'], + $config['graph_precision'] + ); } else { $row[] = $sla['dinamic_text']; } @@ -550,47 +571,64 @@ function reporting_html_SLA($table, $item, $mini) $row[] = ''.__('Fail').''; } - // second table for time globals + // Second table for time globals. $row2 = []; $row2[] = $sla['agent'].' -- ['.$sla['module'].']'; if ($sla['time_total'] != 0) { - $row2[] = human_time_description_raw($sla['time_total']); + $row2[] = human_time_description_raw( + $sla['time_total'] + ); } else { $row2[] = '--'; } if ($sla['time_error'] != 0) { - $row2[] = ''.human_time_description_raw($sla['time_error'], true).''; + $row2[] = ''.human_time_description_raw( + $sla['time_error'], + true + ).''; } else { $row2[] = '--'; } if ($sla['time_ok'] != 0) { - $row2[] = ''.human_time_description_raw($sla['time_ok'], true).''; + $row2[] = ''.human_time_description_raw( + $sla['time_ok'], + true + ).''; } else { $row2[] = '--'; } if ($sla['time_unknown'] != 0) { - $row2[] = ''.human_time_description_raw($sla['time_unknown'], true).''; + $row2[] = ''.human_time_description_raw( + $sla['time_unknown'], + true + ).''; } else { $row2[] = '--'; } if ($sla['time_not_init'] != 0) { - $row2[] = ''.human_time_description_raw($sla['time_not_init'], true).''; + $row2[] = ''.human_time_description_raw( + $sla['time_not_init'], + true + ).''; } else { $row2[] = '--'; } if ($sla['time_downtime'] != 0) { - $row2[] = ''.human_time_description_raw($sla['time_downtime'], true).''; + $row2[] = ''.human_time_description_raw( + $sla['time_downtime'], + true + ).''; } else { $row2[] = '--'; } - // third table for checks globals + // Third table for checks globals. $row3 = []; $row3[] = $sla['agent'].' -- ['.$sla['module'].']'; $row3[] = $sla['checks_total']; @@ -605,11 +643,20 @@ function reporting_html_SLA($table, $item, $mini) } $table->colspan['sla']['cell'] = 2; - $table->data['sla']['cell'] = html_print_table($table1, true); + $table->data['sla']['cell'] = html_print_table( + $table1, + true + ); $table->colspan['time_global']['cell'] = 2; - $table->data['time_global']['cell'] = html_print_table($table2, true); + $table->data['time_global']['cell'] = html_print_table( + $table2, + true + ); $table->colspan['checks_global']['cell'] = 2; - $table->data['checks_global']['cell'] = html_print_table($table3, true); + $table->data['checks_global']['cell'] = html_print_table( + $table3, + true + ); } else { $table->colspan['error']['cell'] = 3; $table->data['error']['cell'] = __('There are no Agent/Modules defined'); @@ -631,9 +678,12 @@ function reporting_html_SLA($table, $item, $mini) } $table->colspan['charts']['cell'] = 2; - $table->data['charts']['cell'] = html_print_table($table1, true); + $table->data['charts']['cell'] = html_print_table( + $table1, + true + ); - // table_legend_graphs; + // Table_legend_graphs. $table1 = new stdClass(); $table1->width = '99%'; $table1->data = []; @@ -669,9 +719,16 @@ function reporting_html_SLA($table, $item, $mini) $table1->data[0][11] = ''.__('Ignore time').''; $table->colspan['legend']['cell'] = 2; - $table->data['legend']['cell'] = html_print_table($table1, true); + $table->data['legend']['cell'] = html_print_table( + $table1, + true + ); } } + + if ($pdf !== 0) { + return html_print_table($table, true); + } } @@ -794,7 +851,7 @@ function reporting_html_event_report_group($table, $item, $pdf=0) } foreach ($item['data'] as $k => $event) { - // First pass along the class of this row + // First pass along the class of this row. if ($item['show_summary_group']) { $table1->cellclass[$k][1] = $table1->cellclass[$k][2] = $table1->cellclass[$k][4] = $table1->cellclass[$k][5] = $table1->cellclass[$k][6] = $table1->cellclass[$k][7] = get_priority_class($event['criticity']); } else { @@ -1559,53 +1616,53 @@ function reporting_html_group_report($table, $item) $table->colspan['group_report']['cell'] = 3; $table->cellstyle['group_report']['cell'] = 'text-align: center;'; $table->data['group_report']['cell'] = " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ".__('Total')."
    ".__('Unknown')."
    ".__('Agents')."
    ".$item['data']['group_stats']['total_agents']."
    ".$item['data']['group_stats']['agents_unknown']."
    ".__('Total')."
    ".__('Normal')."
    ".__('Critical')."
    ".__('Warning')."
    ".__('Unknown')."
    ".__('Not init')."
    ".__('Monitors')."
    ".$item['data']['group_stats']['monitor_checks']."
    ".$item['data']['group_stats']['monitor_ok']."
    ".$item['data']['group_stats']['monitor_critical']."
    ".$item['data']['group_stats']['monitor_warning']."
    ".$item['data']['group_stats']['monitor_unknown']."
    ".$item['data']['group_stats']['monitor_not_init']."
    ".__('Defined')."
    ".__('Fired')."
    ".__('Alerts')."
    ".$item['data']['group_stats']['monitor_alerts']."
    ".$item['data']['group_stats']['monitor_alerts_fired']."
    ".__('Last %s', human_time_description_raw($item['date']['period']))."
    ".__('Events')."
    ".$item['data']['count_events'].'
    '; + + +
    ".__('Total')."
    +
    ".__('Unknown')."
    + + +
    ".__('Agents')."
    +
    ".$item['data']['group_stats']['total_agents']."
    +
    ".$item['data']['group_stats']['agents_unknown']."
    + + + +
    ".__('Total')."
    +
    ".__('Normal')."
    +
    ".__('Critical')."
    +
    ".__('Warning')."
    +
    ".__('Unknown')."
    +
    ".__('Not init')."
    + + +
    ".__('Monitors')."
    +
    ".$item['data']['group_stats']['monitor_checks']."
    +
    ".$item['data']['group_stats']['monitor_ok']."
    +
    ".$item['data']['group_stats']['monitor_critical']."
    +
    ".$item['data']['group_stats']['monitor_warning']."
    +
    ".$item['data']['group_stats']['monitor_unknown']."
    +
    ".$item['data']['group_stats']['monitor_not_init']."
    + + + +
    ".__('Defined')."
    +
    ".__('Fired')."
    + + +
    ".__('Alerts')."
    +
    ".$item['data']['group_stats']['monitor_alerts']."
    +
    ".$item['data']['group_stats']['monitor_alerts_fired']."
    + + + +
    ".__('Last %s', human_time_description_raw($item['date']['period']))."
    + + +
    ".__('Events')."
    +
    ".$item['data']['count_events'].'
    + + '; } @@ -2302,15 +2359,15 @@ function reporting_html_url(&$table, $item, $key) $table->colspan['data']['cell'] = 3; $table->cellstyle['data']['cell'] = 'text-align: left;'; $table->data['data']['cell'] = ' - '; + '; // TODO: make this dynamic and get the height if the iframe to resize this item $table->data['data']['cell'] .= ' - '; + '; } @@ -2635,8 +2692,8 @@ function get_agent_first_time($agent_name) $utimestamp = db_get_all_rows_sql( 'SELECT utimestamp FROM tagente_datos WHERE id_agente_modulo IN - (SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = '.$id.') - ORDER BY utimestamp ASC LIMIT 1' + (SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = '.$id.') + ORDER BY utimestamp ASC LIMIT 1' ); $utimestamp = $utimestamp[0]['utimestamp']; @@ -2878,7 +2935,7 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) $table_sum->data[] = $tdata; $output = '
    - '.__('Summary').''.html_print_table($table_sum, true).'
    '; + '.__('Summary').''.html_print_table($table_sum, true).''; return $output; } @@ -3459,12 +3516,12 @@ function reporting_get_agents_by_status($data, $graph_width=250, $graph_height=1 if (!defined('METACONSOLE')) { $agents_data = '
    - '.__('Agents by status').''.html_print_table($table_agent, true).'
    '; + '.__('Agents by status').''.html_print_table($table_agent, true).''; } else { $table_agent->style = []; $table_agent->class = 'tactical_view'; $agents_data = '
    - '.__('Agents by status').''.html_print_table($table_agent, true).'
    '; + '.__('Agents by status').''.html_print_table($table_agent, true).''; } return $agents_data; @@ -3487,7 +3544,7 @@ function reporting_get_total_agents_and_monitors($data, $graph_width=250, $graph $total_data[3] = $total_module <= 0 ? '-' : $total_module; $table_total->data[] = $total_data; $total_agent_module = '
    - '.__('Total agents and monitors').''.html_print_table($table_total, true).'
    '; + '.__('Total agents and monitors').''.html_print_table($table_total, true).''; return $total_agent_module; } @@ -3506,12 +3563,12 @@ function reporting_get_total_servers($num_servers) if (!defined('METACONSOLE')) { $node_overview = '
    - '.__('Node overview').''.html_print_table($table_node, true).'
    '; + '.__('Node overview').''.html_print_table($table_node, true).''; } else { $table_node->style = []; $table_node->class = 'tactical_view'; $node_overview = '
    - '.__('Node overview').''.html_print_table($table_node, true).'
    '; + '.__('Node overview').''.html_print_table($table_node, true).''; } return $node_overview; @@ -3555,7 +3612,7 @@ function reporting_get_events($data, $links=false) if (!defined('METACONSOLE')) { $event_view = '
    - '.__('Events by severity').''.html_print_table($table_events, true).'
    '; + '.__('Events by severity').''.html_print_table($table_events, true).''; } else { $table_events->class = 'tactical_view'; $table_events->styleTable = 'text-align:center;'; @@ -3565,7 +3622,7 @@ function reporting_get_events($data, $links=false) $table_events->size[3] = '10%'; $event_view = '
    - '.__('Important Events by Criticity').''.html_print_table($table_events, true).'
    '; + '.__('Important Events by Criticity').''.html_print_table($table_events, true).''; } return $event_view; @@ -3597,9 +3654,9 @@ function reporting_get_last_activity() case 'mysql': $sql = sprintf( 'SELECT id_usuario,accion,fecha,ip_origen,descripcion,utimestamp - FROM tsesion - WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.") - AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 5", + FROM tsesion + WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - '.SECONDS_1WEEK.") + AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 5", $config['id_user'] ); break; @@ -3607,9 +3664,9 @@ function reporting_get_last_activity() case 'postgresql': $sql = sprintf( "SELECT \"id_usuario\", accion, fecha, \"ip_origen\", descripcion, utimestamp - FROM tsesion - WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_1WEEK.") - AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 5", + FROM tsesion + WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_1WEEK.") + AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 5", $config['id_user'] ); break; @@ -3617,9 +3674,9 @@ function reporting_get_last_activity() case 'oracle': $sql = sprintf( "SELECT id_usuario, accion, fecha, ip_origen, descripcion, utimestamp - FROM tsesion - WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_1WEEK.") - AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC", + FROM tsesion + WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_1WEEK.") + AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC", $config['id_user'] ); break; @@ -3797,7 +3854,7 @@ function reporting_get_event_histogram($events, $text_header_event=false) if (!defined('METACONSOLE')) { if (!$text_header_event) { $event_graph = '
    - '.$text_header_event.''.html_print_table($table, true).'
    '; + '.$text_header_event.''.html_print_table($table, true).''; } else { $table->class = 'noclass'; $event_graph = html_print_table($table, true); @@ -3895,9 +3952,9 @@ function reporting_get_event_histogram_meta($width) $time_condition = 'utimestamp > '.$bottom.' AND utimestamp < '.$top; $sql = sprintf( 'SELECT criticity,utimestamp - FROM tmetaconsole_event - WHERE %s %s %s - ORDER BY criticity DESC', + FROM tmetaconsole_event + WHERE %s %s %s + ORDER BY criticity DESC', $time_condition, $groups_condition, $status_condition @@ -3981,7 +4038,7 @@ function reporting_get_event_histogram_meta($width) if (!$text_header_event) { $event_graph = '
    - '.$text_header_event.''.html_print_table($table, true).'
    '; + '.$text_header_event.''.html_print_table($table, true).''; } else { $table->class = 'noclass'; $event_graph = html_print_table($table, true); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index f42c64f70a..cd5a3d8eaf 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -1,24 +1,30 @@ -/* -Author: The Pandora FMS team -Name: Default theme -Description: The default Pandora FMS theme layout - -// Pandora FMS - http://pandorafms.com -// ========================================================== -// Copyright (c) 2004-2011 Artica Soluciones Tecnológicas S.L - -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; version 2 - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ +/** + * Extension to manage a list of gateways and the node address where they should + * point to. + * + * @category Extensions + * @package Pandora FMS + * @subpackage Community + * @version 1.0.0 + * @license See below + * + * ______ ___ _______ _______ ________ + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| + * + * ============================================================================ + * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas + * Please see http://pandorafms.org for full contribution list + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation for version 2. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * ============================================================================ + */ /* Tree view styles */ @import url(tree.css); diff --git a/pandora_console/include/styles/pandoraPDF.css b/pandora_console/include/styles/pandoraPDF.css new file mode 100644 index 0000000000..10dc892ec6 --- /dev/null +++ b/pandora_console/include/styles/pandoraPDF.css @@ -0,0 +1,71 @@ +/** + * Extension to manage a list of gateways and the node address where they should + * point to. + * + * @category Extensions + * @package Pandora FMS + * @subpackage Community + * @version 1.0.0 + * @license See below + * + * ______ ___ _______ _______ ________ + * | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __| + * | __/| _ | | _ || _ | _| _ | | ___| |__ | + * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| + * + * ============================================================================ + * Copyright (c) 2005-2019 Artica Soluciones Tecnologicas + * Please see http://pandorafms.org for full contribution list + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation for version 2. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * ============================================================================ + */ + +.content_table { + width: 100%; + font-size: 20pt !important; + page-break-inside: avoid; + border-collapse: collapse; +} + +.content_table tr th, +.content_table tr td { + padding: 10px; +} + +thead.header_tr tr { + background: #e6e6e6; +} +thead.header_tr tr th { + font-weight: normal; + text-align: right; +} +thead.header_tr tr th.th_first { + font-weight: bold; + text-align: left; +} + +.table_beauty { + font-size: 20pt !important; + border-collapse: collapse; + width: 100%; +} + +.table_beauty tr td { + font-size: 20pt !important; + padding: 5px; + border: 0.1pt solid #acacac; +} + +.table_beauty tr td table { + font-size: 20pt !important; +} + +.table_beauty tr td table tr td { + font-size: 20pt !important; +} diff --git a/pandora_console/index.php b/pandora_console/index.php index ad4b93465a..321b5956dc 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -1363,4 +1363,3 @@ require 'include/php_to_js_values.php'; if (__PAN_XHPROF__ === 1) { pandora_xhprof_display_result('node_index'); } - From 418d497291f8ee971be4ea0c8516bf1a9e1a74b5 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 5 Feb 2019 10:40:24 +0100 Subject: [PATCH 34/95] fixed errors pdf Former-commit-id: f7ad69f6b5e0910e5f31464ddfe94593529ef6a7 --- .../include/functions_reporting_html.php | 317 +++++++++++------- pandora_console/include/styles/pandoraPDF.css | 47 +-- 2 files changed, 226 insertions(+), 138 deletions(-) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 84396cfb91..d79afa08e8 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -1,25 +1,32 @@ '.__('Description').': '.io_safe_output($report['description']).' - '.''; + '.''; echo $html; } @@ -153,8 +160,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) $label = ''; } - // $aux = explode("-",$item['subtitle']); - // $item['subtitle'] = db_get_value ("alias","tagente","nombre",$item['agent_name']) .' -'. $aux[1]; reporting_html_header( $table, $mini, @@ -177,6 +182,7 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) switch ($item['type']) { case 'availability': + default: reporting_html_availability($table, $item); break; @@ -380,7 +386,11 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) break; case 'module_histogram_graph': - reporting_enterprise_html_module_histogram_graph($table, $item, $mini); + reporting_enterprise_html_module_histogram_graph( + $table, + $item, + $mini + ); break; } @@ -399,11 +409,7 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) function reporting_html_SLA($table, $item, $mini, $pdf=0) { - if ($table === false) { - $table = new stdClass(); - $table->width = '99%'; - $table->class = 'table_beauty'; - } + $return_pdf = ''; $style = db_get_value( 'style', @@ -411,6 +417,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) 'id_rc', $item['id_rc'] ); + $style = json_decode(io_safe_output($style), true); $same_agent_in_resume = ''; @@ -447,7 +454,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) if (isset($item['data'])) { $table1 = new stdClass(); $table1->width = '99%'; - + $table1->class = 'content_table databox'; $table1->align = []; $table1->align[0] = 'left'; $table1->align[1] = 'left'; @@ -475,6 +482,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) // Second_table for time globals. $table2 = new stdClass(); $table2->width = '99%'; + $table2->class = 'content_table'; $table2->align = []; $table2->align[0] = 'left'; @@ -506,6 +514,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) // Third_table for time globals. $table3 = new stdClass(); $table3->width = '99%'; + $table3->class = 'content_table'; $table3->align = []; $table3->align[0] = 'left'; @@ -562,12 +571,12 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) } else if (reporting_sla_is_ignored_from_array($sla)) { $row[] = ''.__('N/A').''; $row[] = ''.__('No data').''; - // Normal calculation + // Normal calculation. } else if ($sla['sla_status']) { - $row[] = ''.sla_truncate($sla['sla_value'], $config['graph_precision']).'%'.''; + $row[] = ''.sla_truncate($sla['sla_value'], $config['graph_precision']).'%'; $row[] = ''.__('OK').''; } else { - $row[] = ''.sla_truncate($sla['sla_value'], $config['graph_precision']).'%'.''; + $row[] = ''.sla_truncate($sla['sla_value'], $config['graph_precision']).'%'; $row[] = ''.__('Fail').''; } @@ -642,92 +651,131 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) } } - $table->colspan['sla']['cell'] = 2; - $table->data['sla']['cell'] = html_print_table( - $table1, - true - ); - $table->colspan['time_global']['cell'] = 2; - $table->data['time_global']['cell'] = html_print_table( - $table2, - true - ); - $table->colspan['checks_global']['cell'] = 2; - $table->data['checks_global']['cell'] = html_print_table( - $table3, - true - ); + if ($pdf === 0) { + $table->colspan['sla']['cell'] = 2; + $table->data['sla']['cell'] = html_print_table( + $table1, + true + ); + $table->colspan['time_global']['cell'] = 2; + $table->data['time_global']['cell'] = html_print_table( + $table2, + true + ); + $table->colspan['checks_global']['cell'] = 2; + $table->data['checks_global']['cell'] = html_print_table( + $table3, + true + ); + } else { + $return_pdf .= ''; + $return_pdf .= html_print_table( + $table1, + true + ); + $return_pdf .= ''; + + $return_pdf .= ''; + $return_pdf .= html_print_table( + $table2, + true + ); + $return_pdf .= ''; + + $return_pdf .= ''; + $return_pdf .= html_print_table( + $table3, + true + ); + $return_pdf .= ''; + } } else { $table->colspan['error']['cell'] = 3; $table->data['error']['cell'] = __('There are no Agent/Modules defined'); } if (!empty($item['charts'])) { - $table1 = new stdClass(); - $table1->width = '99%'; - $table1->size = []; - $table1->size[0] = '10%'; + /* + $table1 = new stdClass(); + $table1->width = '99%'; + $table1->size = []; + $table1->size[0] = '10%'; - $table1->data = []; + $table1->data = []; - foreach ($item['charts'] as $chart) { + foreach ($item['charts'] as $chart) { $table1->data[] = [ $chart['agent'].'
    '.$chart['module'], $chart['chart'], ]; - } + } - $table->colspan['charts']['cell'] = 2; - $table->data['charts']['cell'] = html_print_table( - $table1, - true - ); + if ($pdf === 0) { + $table->colspan['charts']['cell'] = 2; + $table->data['charts']['cell'] = html_print_table( + $table1, + true + ); + } else { + $return_pdf .= html_print_table( + $table1, + true + ); + } - // Table_legend_graphs. - $table1 = new stdClass(); - $table1->width = '99%'; - $table1->data = []; - $table1->size = []; - $table1->size[0] = '2%'; - $table1->data[0][0] = ''; - $table1->size[1] = '14%'; - $table1->data[0][1] = ''.__('OK').''; + // Table_legend_graphs. + $table1 = new stdClass(); + $table1->width = '99%'; + $table1->data = []; + $table1->size = []; + $table1->size[0] = '2%'; + $table1->data[0][0] = ''; + $table1->size[1] = '14%'; + $table1->data[0][1] = ''.__('OK').''; - $table1->size[2] = '2%'; - $table1->data[0][2] = ''; - $table1->size[3] = '14%'; - $table1->data[0][3] = ''.__('Critical').''; + $table1->size[2] = '2%'; + $table1->data[0][2] = ''; + $table1->size[3] = '14%'; + $table1->data[0][3] = ''.__('Critical').''; - $table1->size[4] = '2%'; - $table1->data[0][4] = ''; - $table1->size[5] = '14%'; - $table1->data[0][5] = ''.__('Unknow').''; + $table1->size[4] = '2%'; + $table1->data[0][4] = ''; + $table1->size[5] = '14%'; + $table1->data[0][5] = ''.__('Unknow').''; - $table1->size[6] = '2%'; - $table1->data[0][6] = ''; - $table1->size[7] = '14%'; - $table1->data[0][7] = ''.__('Not Init').''; + $table1->size[6] = '2%'; + $table1->data[0][6] = ''; + $table1->size[7] = '14%'; + $table1->data[0][7] = ''.__('Not Init').''; - $table1->size[8] = '2%'; - $table1->data[0][8] = ''; - $table1->size[9] = '14%'; - $table1->data[0][9] = ''.__('Downtimes').''; + $table1->size[8] = '2%'; + $table1->data[0][8] = ''; + $table1->size[9] = '14%'; + $table1->data[0][9] = ''.__('Downtimes').''; - $table1->size[10] = '2%'; - $table1->data[0][10] = ''; - $table1->size[11] = '15%'; - $table1->data[0][11] = ''.__('Ignore time').''; + $table1->size[10] = '2%'; + $table1->data[0][10] = ''; + $table1->size[11] = '15%'; + $table1->data[0][11] = ''.__('Ignore time').''; - $table->colspan['legend']['cell'] = 2; - $table->data['legend']['cell'] = html_print_table( - $table1, - true - ); + if ($pdf === 0) { + $table->colspan['legend']['cell'] = 2; + $table->data['legend']['cell'] = html_print_table( + $table1, + true + ); + } else { + $return_pdf .= html_print_table( + $table1, + true + ); + } + */ } } if ($pdf !== 0) { - return html_print_table($table, true); + return $return_pdf; } } @@ -860,7 +908,7 @@ function reporting_html_event_report_group($table, $item, $pdf=0) $data = []; - // Colored box + // Colored box. switch ($event['estado']) { case 0: $img_st = 'images/star.png'; @@ -1075,9 +1123,10 @@ function reporting_html_event_report_module($table, $item, $pdf=0) $table1->cellclass[$i][1] = $table1->cellclass[$i][3] = $table1->cellclass[$i][4] = get_priority_class($event['criticity']); } - // Colored box + // Colored box. switch ($event['estado']) { case 0: + default: $img_st = 'images/star.png'; $title_st = __('New event'); break; @@ -1233,8 +1282,10 @@ function reporting_html_inventory_changes($table, $item) foreach ($item['data'] as $module_item) { $table1 = null; $table1->width = '99%'; + $table1->cellstyle = []; - $table1->cellstyle[0][0] = $table1->cellstyle[0][1] = 'background: #373737; color: #FFF;'; + $table1->cellstyle[0][0] = 'background: #373737; color: #FFF;'; + $table1->cellstyle[0][1] = 'background: #373737; color: #FFF;'; $table1->data[0][0] = $module_item['agent']; $table1->data[0][1] = $module_item['module']; @@ -1700,9 +1751,10 @@ function reporting_html_event_report_agent($table, $item, $pdf=0) } $data = []; - // Colored box + // Colored box. switch ($event['status']) { case 0: + default: $img_st = 'images/star.png'; $title_st = __('New event'); break; @@ -1738,7 +1790,7 @@ function reporting_html_event_report_agent($table, $item, $pdf=0) false, true ); - // $data[] = $event['event_type']; + $data[] = events_print_type_img($event['type'], true); $data[] = get_priority_name($event['criticity']); @@ -2361,7 +2413,7 @@ function reporting_html_url(&$table, $item, $key) $table->data['data']['cell'] = ' '; - // TODO: make this dynamic and get the height if the iframe to resize this item + // TODO: make this dynamic and get the height if the iframe to resize this item. $table->data['data']['cell'] .= ' @@ -723,872 +1040,928 @@ else { var limit_parameters_massive = ; $(document).ready (function () { - $("#form_edit").submit(function() { - var get_parameters_count = window.location.href.slice( - window.location.href.indexOf('?') + 1).split('&').length; - var post_parameters_count = $("#form_edit").serializeArray().length; - - var count_parameters = - get_parameters_count + post_parameters_count; - - if (count_parameters > limit_parameters_massive) { - alert(""); - return false; - } - }); - - $("#text-custom_ip_target").hide(); - - $("#id_agents").change(agent_changed_by_multiple_agents); - $("#module_name").change(module_changed_by_multiple_modules); - - clean_lists(); - - $(".select_modules_row").css('display', ''); - $(".select_agents_row").css('display', ''); - $(".select_modules_row_2").css('display', 'none'); - - // Trigger change to refresh selection when change selection mode - $("#agents_selection_mode").change (function() { - $("#module_name").trigger('change'); - }); - $("#modules_selection_mode").change (function() { - $("#id_agents").trigger('change'); - }); - - $("#module_type").change (function () { - $('input[type=checkbox]').attr('checked', false); - if (this.value < 0) { - clean_lists(); - $(".select_modules_row_2").css('display', 'none'); - return; - } - else { - $("#module").html(''); - $("#module_name").html(''); - $('input[type=checkbox]').removeAttr('disabled'); - $(".select_modules_row_2").css('display', ''); - } - - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10, " + - "tr#delete_table-edit101, " + - "tr#delete_table-edit102, " + - "tr#delete_table-edit11, " + - "tr#delete_table-edit12, " + - "tr#delete_table-edit13, " + - "tr#delete_table-edit14, " + - "tr#delete_table-edit16, " + - "tr#delete_table-edit17, " + - "tr#delete_table-edit18, " + - "tr#delete_table-edit19, " + - "tr#delete_table-edit20, " + - "tr#delete_table-edit21, " + - "tr#delete_table-edit22, " + - "tr#delete_table-edit15").hide (); - - var params = { - "page" : "operation/agentes/ver_agente", - "get_agent_modules_json" : 1, - "get_distinct_name" : 1, - "indexed" : 0 - }; - - if (this.value != '0') - params['id_tipo_modulo'] = this.value; - - var status_module = $('#status_module').val(); - if (status_module != '-1') - params['status_module'] = status_module; + $("#form_edit").submit(function() { + var get_parameters_count = window.location.href.slice( + window.location.href.indexOf('?') + 1).split('&').length; + var post_parameters_count = $("#form_edit").serializeArray().length; + + var count_parameters = + get_parameters_count + post_parameters_count; + + if (count_parameters > limit_parameters_massive) { + alert(""); + return false; + } + }); + + $("#text-custom_ip_target").hide(); + + $("#id_agents").change(agent_changed_by_multiple_agents); + $("#module_name").change(module_changed_by_multiple_modules); + + clean_lists(); + + $(".select_modules_row").css('display', ''); + $(".select_agents_row").css('display', ''); + $(".select_modules_row_2").css('display', 'none'); + + // Trigger change to refresh selection when change selection mode + $("#agents_selection_mode").change (function() { + $("#module_name").trigger('change'); + }); + $("#modules_selection_mode").change (function() { + $("#id_agents").trigger('change'); + }); + + $("#module_type").change (function () { + $('input[type=checkbox]').attr('checked', false); + if (this.value < 0) { + clean_lists(); + $(".select_modules_row_2").css('display', 'none'); + return; + } + else { + $("#module").html(''); + $("#module_name").html(''); + $('input[type=checkbox]').removeAttr('disabled'); + $(".select_modules_row_2").css('display', ''); + } + + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10, " + + "tr#delete_table-edit101, " + + "tr#delete_table-edit102, " + + "tr#delete_table-edit11, " + + "tr#delete_table-edit12, " + + "tr#delete_table-edit13, " + + "tr#delete_table-edit14, " + + "tr#delete_table-edit16, " + + "tr#delete_table-edit17, " + + "tr#delete_table-edit18, " + + "tr#delete_table-edit19, " + + "tr#delete_table-edit20, " + + "tr#delete_table-edit21, " + + "tr#delete_table-edit22, " + + "tr#delete_table-edit15").hide (); + + var params = { + "page" : "operation/agentes/ver_agente", + "get_agent_modules_json" : 1, + "get_distinct_name" : 1, + "indexed" : 0 + }; + + if (this.value != '0') + params['id_tipo_modulo'] = this.value; + + var status_module = $('#status_module').val(); + if (status_module != '-1') + params['status_module'] = status_module; - var tags_to_search = $('#tags').val(); - if (tags_to_search != null) { - if (tags_to_search[0] != -1) { - params['tags'] = tags_to_search; - } - } - - $("#module_loading").show (); - $("tr#delete_table-edit1, tr#delete_table-edit0, tr#delete_table-edit2").hide (); - $("#module_name").attr ("disabled", "disabled") - $("#module_name option[value!=0]").remove (); - jQuery.post ("ajax.php", - params, - function (data, status) { - jQuery.each (data, function (id, value) { - option = $("").attr ("value", value["nombre"]).html (value["nombre"]); - $("#module_name").append (option); - }); - $("#module_loading").hide (); - $("#module_name").removeAttr ("disabled"); - }, - "json" - ); - }); - function show_form() { - $("td#delete_table-0-1, " + - "td#delete_table-edit1-1, " + - "td#delete_table-edit2-1").css ("width", "300px"); - $("#form_edit input[type=text]").attr ("value", ""); - $("#form_edit input[type=checkbox]").not ("#checkbox-recursion").removeAttr ("checked"); - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10, " + - "tr#delete_table-edit101, " + - "tr#delete_table-edit102, " + - "tr#delete_table-edit11, " + - "tr#delete_table-edit12, " + - "tr#delete_table-edit13, " + - "tr#delete_table-edit14, " + - "tr#delete_table-edit16, " + - "tr#delete_table-edit17, " + - "tr#delete_table-edit18, " + - "tr#delete_table-edit19, " + - "tr#delete_table-edit20, " + - "tr#delete_table-edit21, " + - "tr#delete_table-edit22, " + - "tr#delete_table-edit15").show (); - - switch($('#module_type').val()) { - case '3': - case '23': - case '33': - $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max,#delete_table-edit15," + - "#delete_table-edit3-2,#delete_table-edit3-3,#delete_table-edit35").hide(); - $("#edit1-1-str,#edit1-3-str").show(); - break; - case '6': - case '7': - $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); - $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + - "#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," + - "#delete_table-edit5").hide(); - break; - case '8': - case '9': - case '11': - $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); - $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + - "#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," + - "#delete_table-edit5").hide(); - break; - case '10': - $("#edit1-1-str,#edit1-3-str").show(); - $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + - "#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," + - "#delete_table-edit5").hide(); - break; - case '15': - case '16': - case '18': - $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); - $("#edit1-1-str,#edit1-3-str,#delete_table-edit5").hide(); - break; - case '17': - $("#edit1-1-str,#edit1-3-str").show(); - $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max,#delete_table-edit5").hide(); - break; - case '1': - case '2': - case '4': - case '5': - case '21': - case '22': - case '24': - case '25': - case '30': - case '31': - case '32': - case '100': - $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); - $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + - "#delete_table-edit3-3,#delete_table-edit35").hide(); - break; - default: - } - } - - function clean_lists() { - $("#id_agents").html(''); - $("#module_name").html(''); - $("#agents").html(''); - $("#module").html(''); - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit36, " + - "tr#delete_table-edit37, " + - "tr#delete_table-edit38, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10, " + - "tr#delete_table-edit101, " + - "tr#delete_table-edit102, " + - "tr#delete_table-edit11, " + - "tr#delete_table-edit12, " + - "tr#delete_table-edit13, " + - "tr#delete_table-edit14, " + - "tr#delete_table-edit16, " + - "tr#delete_table-edit17, " + - "tr#delete_table-edit18, " + - "tr#delete_table-edit19, " + - "tr#delete_table-edit20, " + - "tr#delete_table-edit21, " + - "tr#delete_table-edit22, " + - "tr#delete_table-edit15").hide (); - $('input[type=checkbox]').attr('checked', false); - $('input[type=checkbox]').attr('disabled', true); - - $('#module_type').val(-1); - $('#groups_select').val(-1); - } - - $('input[type=checkbox]').change ( - function () { - if (this.id == "checkbox-force_type") { - if (this.checked) { - $(".select_modules_row_2").css('display', 'none'); - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10").show (); - } - else { - $(".select_modules_row_2").css('display', ''); - if ($('#module_name option:selected').val() == undefined) { - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10, " + - "tr#delete_table-edit101, " + - "tr#delete_table-edit102, " + - "tr#delete_table-edit11, " + - "tr#delete_table-edit12, " + - "tr#delete_table-edit13, " + - "tr#delete_table-edit14, " + - "tr#delete_table-edit16, " + - "tr#delete_table-edit17, " + - "tr#delete_table-edit18, " + - "tr#delete_table-edit19, " + - "tr#delete_table-edit20, " + - "tr#delete_table-edit21, " + - "tr#delete_table-edit22, " + - "tr#delete_table-edit15").hide (); - } - } - } - else if (this.id == "checkbox-recursion") { - $("#checkbox-force_group").prop("checked", false); - $("#groups_select").trigger("change"); - } - else if (this.id == "checkbox-warning_inverse") { - return; //Do none - } - else if (this.id == "checkbox-critical_inverse") { - return; //Do none - } - else if (this.id == "checkbox-dynamic_two_tailed") { - return; //Do none - } - else { - if (this.id == "checkbox-force_group") { - $("#checkbox-recursion").prop("checked", false); - } - - if (this.checked) { - $(".select_agents_row_2").css('display', 'none'); - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10, " + - "tr#delete_table-edit101, " + - "tr#delete_table-edit102, " + - "tr#delete_table-edit11, " + - "tr#delete_table-edit12, " + - "tr#delete_table-edit13, " + - "tr#delete_table-edit14, " + - "tr#delete_table-edit16, " + - "tr#delete_table-edit17, " + - "tr#delete_table-edit18, " + - "tr#delete_table-edit19, " + - "tr#delete_table-edit20, " + - "tr#delete_table-edit21, " + - "tr#delete_table-edit22, " + - "tr#delete_table-edit15").show (); - } - else { - $(".select_agents_row_2").css('display', ''); - if ($('#id_agents option:selected').val() == undefined) { - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10, " + - "tr#delete_table-edit101, " + - "tr#delete_table-edit102, " + - "tr#delete_table-edit11, " + - "tr#delete_table-edit12, " + - "tr#delete_table-edit13, " + - "tr#delete_table-edit14, " + - "tr#delete_table-edit16, " + - "tr#delete_table-edit17, " + - "tr#delete_table-edit18, " + - "tr#delete_table-edit19, " + - "tr#delete_table-edit20, " + - "tr#delete_table-edit21, " + - "tr#delete_table-edit22, " + - "tr#delete_table-edit15").hide (); - } - } - } - } - ); - - $("#module_name").change (show_form); - $("#id_agents").change (show_form); - - $("#form_edit input[name=selection_mode]").change (function () { - selector = $("#form_edit input[name=selection_mode]:checked").val(); - clean_lists(); - - if(selector == 'agents') { - $(".select_modules_row").hide(); - $(".select_agents_row").show(); - $("#groups_select").trigger("change"); - } - else if(selector == 'modules') { - $(".select_agents_row").hide(); - $(".select_modules_row").show(); - $("#module_type").trigger("change"); - } - }); - - $('#tcp_send').change(function() { - if($(this).val() == 3) { - $("tr#delete_table-edit36, tr#delete_table-edit37, tr#delete_table-edit38").show(); - } - else { - $("tr#delete_table-edit36, tr#delete_table-edit37, tr#delete_table-edit38").hide(); - } - }); + var tags_to_search = $('#tags').val(); + if (tags_to_search != null) { + if (tags_to_search[0] != -1) { + params['tags'] = tags_to_search; + } + } + + $("#module_loading").show (); + $("tr#delete_table-edit1, tr#delete_table-edit0, tr#delete_table-edit2").hide (); + $("#module_name").attr ("disabled", "disabled") + $("#module_name option[value!=0]").remove (); + jQuery.post ("ajax.php", + params, + function (data, status) { + jQuery.each (data, function (id, value) { + option = $("").attr ("value", value["nombre"]).html (value["nombre"]); + $("#module_name").append (option); + }); + $("#module_loading").hide (); + $("#module_name").removeAttr ("disabled"); + }, + "json" + ); + }); + function show_form() { + $("td#delete_table-0-1, " + + "td#delete_table-edit1-1, " + + "td#delete_table-edit2-1").css ("width", "300px"); + $("#form_edit input[type=text]").attr ("value", ""); + $("#form_edit input[type=checkbox]").not ("#checkbox-recursion").removeAttr ("checked"); + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10, " + + "tr#delete_table-edit101, " + + "tr#delete_table-edit102, " + + "tr#delete_table-edit11, " + + "tr#delete_table-edit12, " + + "tr#delete_table-edit13, " + + "tr#delete_table-edit14, " + + "tr#delete_table-edit16, " + + "tr#delete_table-edit17, " + + "tr#delete_table-edit18, " + + "tr#delete_table-edit19, " + + "tr#delete_table-edit20, " + + "tr#delete_table-edit21, " + + "tr#delete_table-edit22, " + + "tr#delete_table-edit15").show (); + + switch($('#module_type').val()) { + case '3': + case '23': + case '33': + $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max,#delete_table-edit15," + + "#delete_table-edit3-2,#delete_table-edit3-3,#delete_table-edit35").hide(); + $("#edit1-1-str,#edit1-3-str").show(); + break; + case '6': + case '7': + $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); + $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + + "#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," + + "#delete_table-edit5").hide(); + break; + case '8': + case '9': + case '11': + $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); + $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + + "#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," + + "#delete_table-edit5").hide(); + break; + case '10': + $("#edit1-1-str,#edit1-3-str").show(); + $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + + "#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," + + "#delete_table-edit5").hide(); + break; + case '15': + case '16': + case '18': + $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); + $("#edit1-1-str,#edit1-3-str,#delete_table-edit5").hide(); + break; + case '17': + $("#edit1-1-str,#edit1-3-str").show(); + $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max,#delete_table-edit5").hide(); + break; + case '1': + case '2': + case '4': + case '5': + case '21': + case '22': + case '24': + case '25': + case '30': + case '31': + case '32': + case '100': + $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); + $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + + "#delete_table-edit3-3,#delete_table-edit35").hide(); + break; + default: + } + } + + function clean_lists() { + $("#id_agents").html(''); + $("#module_name").html(''); + $("#agents").html(''); + $("#module").html(''); + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit36, " + + "tr#delete_table-edit37, " + + "tr#delete_table-edit38, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10, " + + "tr#delete_table-edit101, " + + "tr#delete_table-edit102, " + + "tr#delete_table-edit11, " + + "tr#delete_table-edit12, " + + "tr#delete_table-edit13, " + + "tr#delete_table-edit14, " + + "tr#delete_table-edit16, " + + "tr#delete_table-edit17, " + + "tr#delete_table-edit18, " + + "tr#delete_table-edit19, " + + "tr#delete_table-edit20, " + + "tr#delete_table-edit21, " + + "tr#delete_table-edit22, " + + "tr#delete_table-edit15").hide (); + $('input[type=checkbox]').attr('checked', false); + $('input[type=checkbox]').attr('disabled', true); + + $('#module_type').val(-1); + $('#groups_select').val(-1); + } + + $('input[type=checkbox]').change ( + function () { + if (this.id == "checkbox-force_type") { + if (this.checked) { + $(".select_modules_row_2").css('display', 'none'); + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10").show (); + } + else { + $(".select_modules_row_2").css('display', ''); + if ($('#module_name option:selected').val() == undefined) { + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10, " + + "tr#delete_table-edit101, " + + "tr#delete_table-edit102, " + + "tr#delete_table-edit11, " + + "tr#delete_table-edit12, " + + "tr#delete_table-edit13, " + + "tr#delete_table-edit14, " + + "tr#delete_table-edit16, " + + "tr#delete_table-edit17, " + + "tr#delete_table-edit18, " + + "tr#delete_table-edit19, " + + "tr#delete_table-edit20, " + + "tr#delete_table-edit21, " + + "tr#delete_table-edit22, " + + "tr#delete_table-edit15").hide (); + } + } + } + else if (this.id == "checkbox-recursion") { + $("#checkbox-force_group").prop("checked", false); + $("#groups_select").trigger("change"); + } + else if (this.id == "checkbox-warning_inverse") { + return; //Do none + } + else if (this.id == "checkbox-critical_inverse") { + return; //Do none + } + else if (this.id == "checkbox-dynamic_two_tailed") { + return; //Do none + } + else { + if (this.id == "checkbox-force_group") { + $("#checkbox-recursion").prop("checked", false); + } + + if (this.checked) { + $(".select_agents_row_2").css('display', 'none'); + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10, " + + "tr#delete_table-edit101, " + + "tr#delete_table-edit102, " + + "tr#delete_table-edit11, " + + "tr#delete_table-edit12, " + + "tr#delete_table-edit13, " + + "tr#delete_table-edit14, " + + "tr#delete_table-edit16, " + + "tr#delete_table-edit17, " + + "tr#delete_table-edit18, " + + "tr#delete_table-edit19, " + + "tr#delete_table-edit20, " + + "tr#delete_table-edit21, " + + "tr#delete_table-edit22, " + + "tr#delete_table-edit15").show (); + } + else { + $(".select_agents_row_2").css('display', ''); + if ($('#id_agents option:selected').val() == undefined) { + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10, " + + "tr#delete_table-edit101, " + + "tr#delete_table-edit102, " + + "tr#delete_table-edit11, " + + "tr#delete_table-edit12, " + + "tr#delete_table-edit13, " + + "tr#delete_table-edit14, " + + "tr#delete_table-edit16, " + + "tr#delete_table-edit17, " + + "tr#delete_table-edit18, " + + "tr#delete_table-edit19, " + + "tr#delete_table-edit20, " + + "tr#delete_table-edit21, " + + "tr#delete_table-edit22, " + + "tr#delete_table-edit15").hide (); + } + } + } + } + ); + + $("#module_name").change (show_form); + $("#id_agents").change (show_form); + + $("#form_edit input[name=selection_mode]").change (function () { + selector = $("#form_edit input[name=selection_mode]:checked").val(); + clean_lists(); + + if(selector == 'agents') { + $(".select_modules_row").hide(); + $(".select_agents_row").show(); + $("#groups_select").trigger("change"); + } + else if(selector == 'modules') { + $(".select_agents_row").hide(); + $(".select_modules_row").show(); + $("#module_type").trigger("change"); + } + }); + + $('#tcp_send').change(function() { + if($(this).val() == 3) { + $("tr#delete_table-edit36, tr#delete_table-edit37, tr#delete_table-edit38").show(); + } + else { + $("tr#delete_table-edit36, tr#delete_table-edit37, tr#delete_table-edit38").hide(); + } + }); - $('#ip_target').change(function() { - if($(this).val() == 'custom') { - $("#text-custom_ip_target").show(); - } - else{ - $("#text-custom_ip_target").hide(); - } - }); + $('#ip_target').change(function() { + if($(this).val() == 'custom') { + $("#text-custom_ip_target").show(); + } + else{ + $("#text-custom_ip_target").hide(); + } + }); - var recursion; + var recursion; - $("#checkbox-recursion").click(function () { - recursion = this.checked ? 1 : 0; - }); + $("#checkbox-recursion").click(function () { + recursion = this.checked ? 1 : 0; + }); - $("#groups_select").change ( - function () { - if (this.value < 0) { - clean_lists(); - $(".select_agents_row_2").css('display', 'none'); - return; - } - else { - $("#module").html(''); - $("#id_agents").html(''); - $('input[type=checkbox]').removeAttr('disabled'); - $(".select_agents_row_2").css('display', ''); - } - - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10, " + - "tr#delete_table-edit101, " + - "tr#delete_table-edit102, " + - "tr#delete_table-edit11, " + - "tr#delete_table-edit12, " + - "tr#delete_table-edit13, " + - "tr#delete_table-edit14, " + - "tr#delete_table-edit16, " + - "tr#delete_table-edit17, " + - "tr#delete_table-edit18, " + - "tr#delete_table-edit19, " + - "tr#delete_table-edit20, " + - "tr#delete_table-edit21, " + - "tr#delete_table-edit22, " + - "tr#delete_table-edit15").hide (); - - jQuery.post ("ajax.php", - {"page" : "operation/agentes/ver_agente", - "get_agents_group_json" : 1, - "recursion" : recursion, - "id_group" : this.value, - status_agents: function () { - return $("#status_agents").val(); - }, - // Add a key prefix to avoid auto sorting in js object conversion - "keys_prefix" : "_" - }, - function (data, status) { - $("#id_agents").html(''); - - jQuery.each (data, function(id, value) { - // Remove keys_prefix from the index - id = id.substring(1); - - option = $("") - .attr("value", value["id_agente"]) - .html(value["alias"]); - $("#id_agents").append (option); - }); - }, - "json" - ); - } - ); - - $("#status_agents").change(function() { - $("#groups_select").trigger("change"); - }); - - if(""){ - if("" == 'agents'){ - $("#groups_select").trigger("change"); - } - } + $("#groups_select").change ( + function () { + if (this.value < 0) { + clean_lists(); + $(".select_agents_row_2").css('display', 'none'); + return; + } + else { + $("#module").html(''); + $("#id_agents").html(''); + $('input[type=checkbox]').removeAttr('disabled'); + $(".select_agents_row_2").css('display', ''); + } + + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10, " + + "tr#delete_table-edit101, " + + "tr#delete_table-edit102, " + + "tr#delete_table-edit11, " + + "tr#delete_table-edit12, " + + "tr#delete_table-edit13, " + + "tr#delete_table-edit14, " + + "tr#delete_table-edit16, " + + "tr#delete_table-edit17, " + + "tr#delete_table-edit18, " + + "tr#delete_table-edit19, " + + "tr#delete_table-edit20, " + + "tr#delete_table-edit21, " + + "tr#delete_table-edit22, " + + "tr#delete_table-edit15").hide (); + + jQuery.post ("ajax.php", + {"page" : "operation/agentes/ver_agente", + "get_agents_group_json" : 1, + "recursion" : recursion, + "id_group" : this.value, + status_agents: function () { + return $("#status_agents").val(); + }, + // Add a key prefix to avoid auto sorting in js object conversion + "keys_prefix" : "_" + }, + function (data, status) { + $("#id_agents").html(''); + + jQuery.each (data, function(id, value) { + // Remove keys_prefix from the index + id = id.substring(1); + + option = $("") + .attr("value", value["id_agente"]) + .html(value["alias"]); + $("#id_agents").append (option); + }); + }, + "json" + ); + } + ); + + $("#status_agents").change(function() { + $("#groups_select").trigger("change"); + }); + + if(""){ + if("" == 'agents'){ + $("#groups_select").trigger("change"); + } + } - $("#status_module").change(function() { - selector = $("#form_edit input[name=selection_mode]:checked").val(); - if(selector == 'agents') { - $("#id_agents").trigger("change"); - } - else if(selector == 'modules') { - $("#module_type").trigger("change"); - } - }); + $("#status_module").change(function() { + selector = $("#form_edit input[name=selection_mode]:checked").val(); + if(selector == 'agents') { + $("#id_agents").trigger("change"); + } + else if(selector == 'modules') { + $("#module_type").trigger("change"); + } + }); - $("#tags").change(function() { - selector = $("#form_edit input[name=selection_mode]:checked").val(); - $("#module_type").trigger("change"); - }); - $("#tags1").change(function() { - selector = $("#form_edit input[name=selection_mode]:checked").val(); - $("#id_agents").trigger("change"); - }); - - $('#agents').change(function(e){ - for(var i=0;i"+macro['desc']+""); - } - }); - //Plugin text can be larger - $(".macro_field").find(":input").attr("maxlength", 1023); - // Add again the hover event to the 'force_callback' elements - forced_title_callback(); - } - } - }); - } + if (flag_load_plugin_component) { + flag_load_plugin_component = false; + + return; + } + + load_plugin_description($("#id_plugin").val()); + + load_plugin_macros_fields_massive('simple-macro'); + + forced_title_callback(); + } + + function load_plugin_macros_fields_massive(row_model_id) { + // Get plugin macros when selected and load macros fields + var id_plugin = $('#id_plugin').val(); + + var params = []; + params.push("page=include/ajax/module"); + params.push("get_plugin_macros=1"); + params.push("id_plugin=" + id_plugin); + + jQuery.ajax ({ + data: params.join ("&"), + type: 'POST', + url: action = get_php_value('absolute_homeurl') + "ajax.php", + dataType: 'json', + success: function (data) { + // Delete all the macro fields + $('.macro_field').remove(); + + if (data['array'] != null) { + $('#hidden-macros').val(data['base64']); + + jQuery.each (data['array'], function (i, macro) { + console.log(macro); + if (macro['desc'] != '') { + $("#delete_table-edit21").after(""+macro['desc']+""); + } + }); + //Plugin text can be larger + $(".macro_field").find(":input").attr("maxlength", 1023); + // Add again the hover event to the 'force_callback' elements + forced_title_callback(); + } + } + }); + } function disabled_status () { - if($('#dynamic_interval_select').val() != 0){ - $('#text-min_warning').prop('readonly', true); - $('#text-min_warning').addClass('readonly'); - $('#text-max_warning').prop('readonly', true); - $('#text-max_warning').addClass('readonly'); - $('#text-min_critical').prop('readonly', true); - $('#text-min_critical').addClass('readonly'); - $('#text-max_critical').prop('readonly', true); - $('#text-max_critical').addClass('readonly'); - } else { - $('#text-min_warning').prop('readonly', false); - $('#text-min_warning').removeClass('readonly'); - $('#text-max_warning').prop('readonly', false); - $('#text-max_warning').removeClass('readonly'); - $('#text-min_critical').prop('readonly', false); - $('#text-min_critical').removeClass('readonly'); - $('#text-max_critical').prop('readonly', false); - $('#text-max_critical').removeClass('readonly'); - } + if($('#dynamic_interval_select').val() != 0){ + $('#text-min_warning').prop('readonly', true); + $('#text-min_warning').addClass('readonly'); + $('#text-max_warning').prop('readonly', true); + $('#text-max_warning').addClass('readonly'); + $('#text-min_critical').prop('readonly', true); + $('#text-min_critical').addClass('readonly'); + $('#text-max_critical').prop('readonly', true); + $('#text-max_critical').addClass('readonly'); + } else { + $('#text-min_warning').prop('readonly', false); + $('#text-min_warning').removeClass('readonly'); + $('#text-max_warning').prop('readonly', false); + $('#text-max_warning').removeClass('readonly'); + $('#text-min_critical').prop('readonly', false); + $('#text-min_critical').removeClass('readonly'); + $('#text-max_critical').prop('readonly', false); + $('#text-max_critical').removeClass('readonly'); + } } /* ]]> */ (int)$throw_unknown_events); - $values['disabled_types_event'] = json_encode($disabled_types_event); - } + return false; + } - if (strlen(get_parameter('history_data')) > 0) { - $values['history_data'] = get_parameter('history_data'); - } + if (!is_array($agents_select)) { + $agents_select = [$agents_select]; + } - if (get_parameter('quiet_select', -1) != -1) { - $values['quiet'] = get_parameter('quiet_select'); - } + // List of fields which can be updated + $fields = [ + 'dynamic_interval', + 'dynamic_max', + 'dynamic_min', + 'dynamic_two_tailed', + 'min_warning', + 'max_warning', + 'str_warning', + 'min_critical', + 'max_critical', + 'str_critical', + 'min_ff_event', + 'module_interval', + 'disabled', + 'post_process', + 'unit_select', + 'snmp_community', + 'snmp_oid', + 'tcp_send', + 'custom_string_1', + 'plugin_parameter', + 'custom_string_2', + 'custom_string_3', + 'min', + 'max', + 'id_module_group', + 'plugin_user', + 'plugin_pass', + 'id_export', + 'history_data', + 'critical_inverse', + 'warning_inverse', + 'critical_instructions', + 'warning_instructions', + 'unknown_instructions', + 'policy_linked', + 'id_category', + 'disabled_types_event', + 'ip_target', + 'custom_ip_target', + 'descripcion', + 'min_ff_event_normal', + 'min_ff_event_warning', + 'min_ff_event_critical', + 'each_ff', + 'module_ff_interval', + 'ff_timeout', + 'max_timeout', + 'tcp_port', + 'max_retries', + 'tcp_rcv', + 'id_plugin', + 'wmi_query', + 'key_string', + 'field_number', + 'tcp_send2', + 'plugin_parameter_text', + ]; + $values = []; - $filter_modules = false; + foreach ($fields as $field) { + $value = get_parameter($field, ''); - if (!is_numeric($module_name) or ($module_name != 0)) - $filter_modules['nombre'] = $module_name; + switch ($field) { + case 'id_plugin': + if ($value != 0) { + $value_field_1 = get_parameter('_field1_', ''); + $value_field_1_desc = get_parameter('desc_field1_', ''); - // Whether to update module tag info - $update_tags = get_parameter('id_tag', false); + $value_field_2 = get_parameter('_field2_', ''); + $value_field_2_desc = get_parameter('desc_field2_', ''); - if (array_search(0, $agents_select) !== false) { + $value_field_3 = get_parameter('_field3_', ''); + $value_field_3_desc = get_parameter('desc_field3_', ''); - //Apply at All agents. - $modules = db_get_all_rows_filter ('tagente_modulo', - $filter_modules, - array ('id_agente_modulo')); - } - else { + $value_field_4 = get_parameter('_field4_', ''); + $value_field_4_desc = get_parameter('desc_field4_', ''); - if ($module_name == "0") { - //Any module - $modules = db_get_all_rows_filter ('tagente_modulo', - array ('id_agente' => $agents_select), - array ('id_agente_modulo')); - } - else { - $modules = db_get_all_rows_filter ('tagente_modulo', - array ('id_agente' => $agents_select, - 'nombre' => $module_name), - array ('id_agente_modulo')); - } - } + $value_field_5 = get_parameter('_field5_', ''); + $value_field_5_desc = get_parameter('desc_field5_', ''); + $values['macros'] = '{"1":{"macro":"_field1_","desc":"'.io_safe_input($value_field_1_desc).'","help":"'.io_safe_input($value_field_1_desc).'","value":"'.$value_field_1.'"}'; - if ($modules === false) - return false; + if ($value_field_2_desc != '') { + $values['macros'] .= ',"2":{"macro":"_field2_","desc":"'.io_safe_input($value_field_2_desc).'","help":"'.io_safe_input($value_field_2_desc).'","value":"'.$value_field_2.'"}'; - if (($module_status == 'unknown') && ($module_name == "0")) { - $modules_to_delete = array(); - foreach ($modules as $mod_id) { - $mod_status = (int)db_get_value_filter ('estado', 'tagente_estado', array('id_agente_modulo' => $mod_id)); + if ($value_field_3_desc != '') { + $values['macros'] .= ',"3":{"macro":"_field3_","desc":"'.io_safe_input($value_field_3_desc).'","help":"'.io_safe_input($value_field_3_desc).'","value":"'.$value_field_3.'"}'; - // Unknown, not init and no data modules - if ($mod_status == 3 || $mod_status == 4 || $mod_status == 5) { - $modules_to_delete[$mod_id] = $mod_id; - } - } - $modules = $modules_to_delete; - } + if ($value_field_4_desc != '') { + $values['macros'] .= ',"4":{"macro":"_field4_","desc":"'.io_safe_input($value_field_4_desc).'","help":"'.io_safe_input($value_field_4_desc).'","value":"'.$value_field_4.'"}'; - foreach ($modules as $module) { - - $result = modules_update_agent_module( - $module['id_agente_modulo'], $values, true, $update_tags); + if ($value_field_5_desc != '') { + $values['macros'] .= ',"5":{"macro":"_field5_","desc":"'.io_safe_input($value_field_5_desc).'","help":"'.io_safe_input($value_field_5_desc).'","value":"'.$value_field_5.'"}'; + } else { + $values['macros'] .= '}'; + } + } else { + $values['macros'] .= '}'; + } + } else { + $values['macros'] .= '}'; + } + } else { + $values['macros'] .= '}'; + } + } + break; + case 'module_interval': + if ($value != 0) { + $values[$field] = $value; + } + break; - if (is_error($result)) - return false; + case 'plugin_pass': + if ($value != '') { + $values['plugin_pass'] = io_input_password($value); + } + break; - } - - return true; + case 'post_process': + if ($value !== '-1') { + $values['post_process'] = $value; + } + break; + + case 'unit_select': + if ($value != -1) { + if ($value == 'none') { + $values['unit'] = (string) get_parameter('unit_text'); + } else { + $values['unit'] = $value; + } + } + break; + + case 'wmi_query': + if ($value != '') { + $values['snmp_oid'] = $value; + } + break; + + case 'key_string': + if ($value != '') { + $values['snmp_community'] = $value; + } + break; + + case 'field_number': + if ($value != '') { + $values['tcp_port'] = $value; + } + break; + + case 'tcp_send2': + if ($value != '') { + $values['tcp_send'] = $value; + } + break; + + case 'plugin_parameter_text': + if ($value != '') { + $values['plugin_parameter'] = $value; + } + break; + + default: + if ($value != '') { + $values[$field] = $value; + } + break; + } + } + + // Specific snmp reused fields + if (get_parameter('tcp_send', '') == 3) { + $plugin_user_snmp = get_parameter('plugin_user_snmp', ''); + if ($plugin_user_snmp != '') { + $values['plugin_user'] = $plugin_user_snmp; + } + + $plugin_pass_snmp = get_parameter('plugin_pass_snmp', ''); + if ($plugin_pass_snmp != '') { + $values['plugin_pass'] = io_input_password($plugin_pass_snmp); + } + + $snmp3_privacy_pass = get_parameter('custom_string_2', ''); + if ($snmp3_privacy_pass != '') { + $values['custom_string_2'] = io_input_password($snmp3_privacy_pass); + } + } + + $throw_unknown_events = get_parameter('throw_unknown_events', ''); + if ($throw_unknown_events !== '') { + // Set the event type that can show. + $disabled_types_event = [ + EVENTS_GOING_UNKNOWN => (int) $throw_unknown_events, + ]; + $values['disabled_types_event'] = json_encode($disabled_types_event); + } + + if (strlen(get_parameter('history_data')) > 0) { + $values['history_data'] = get_parameter('history_data'); + } + + if (get_parameter('quiet_select', -1) != -1) { + $values['quiet'] = get_parameter('quiet_select'); + } + + $filter_modules = false; + + if (!is_numeric($module_name) or ($module_name != 0)) { + $filter_modules['nombre'] = $module_name; + } + + // Whether to update module tag info + $update_tags = get_parameter('id_tag', false); + + if (array_search(0, $agents_select) !== false) { + // Apply at All agents. + $modules = db_get_all_rows_filter( + 'tagente_modulo', + $filter_modules, + ['id_agente_modulo'] + ); + } else { + if ($module_name == '0') { + // Any module + $modules = db_get_all_rows_filter( + 'tagente_modulo', + ['id_agente' => $agents_select], + ['id_agente_modulo'] + ); + } else { + $modules = db_get_all_rows_filter( + 'tagente_modulo', + [ + 'id_agente' => $agents_select, + 'nombre' => $module_name, + ], + ['id_agente_modulo'] + ); + } + } + + if ($modules === false) { + return false; + } + + if (($module_status == 'unknown') && ($module_name == '0')) { + $modules_to_delete = []; + foreach ($modules as $mod_id) { + $mod_status = (int) db_get_value_filter('estado', 'tagente_estado', ['id_agente_modulo' => $mod_id]); + + // Unknown, not init and no data modules + if ($mod_status == 3 || $mod_status == 4 || $mod_status == 5) { + $modules_to_delete[$mod_id] = $mod_id; + } + } + + $modules = $modules_to_delete; + } + + foreach ($modules as $module) { + $result = modules_update_agent_module( + $module['id_agente_modulo'], + $values, + true, + $update_tags + ); + + if (is_error($result)) { + return false; + } + } + + return true; } -?> From bf7e7f1e5cf0254df6e23f0aeaaae2eef423717e Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Wed, 6 Feb 2019 18:11:50 +0100 Subject: [PATCH 38/95] Fixed merge errors Former-commit-id: 30312c4b1ae7a3615576abbae90776f278586f27 --- pandora_console/godmode/setup/setup_general.php | 2 -- pandora_console/godmode/setup/setup_visuals.php | 7 ------- 2 files changed, 9 deletions(-) diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index 935cb9c487..8196d98873 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -125,8 +125,6 @@ if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { $table->data[19][1] = html_print_checkbox_toogle_switch_extended('activate_netflow', 1, $config['activate_netflow'], $rbt_disabled, '', '', true); -$table->data[19][1] = __('Yes').'   '.html_print_radio_button_extended('activate_netflow', 1, '', $config['activate_netflow'], $rbt_disabled, '', '', true).'  '; -$table->data[19][1] .= __('No').'   '.html_print_radio_button_extended('activate_netflow', 0, '', $config['activate_netflow'], $rbt_disabled, '', '', true); $zone_name = [ 'Africa' => __('Africa'), diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 4c5d89c66e..8d18cf40d7 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -550,13 +550,6 @@ $table_styles->data[$row][1] = html_print_checkbox_toogle_switch( true ); -$table_styles->data[$row][0] = __('Visual effects and animation'); -$table_styles->data[$row][1] = html_print_checkbox( - 'visual_animation', - 1, - $config['visual_animation'], - true -); echo '
    '; echo ''.__('Style configuration').''; From f4c22d2250bcedf7b2bf7663ef0f1286161e5c0b Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 7 Feb 2019 13:01:21 +0100 Subject: [PATCH 39/95] added extra arguments to get_snmpwalk Former-commit-id: bf02258e312d3a81673e79a144173b53e0c2c153 --- pandora_console/include/functions.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index d1b5fb7831..6f13388fc0 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1754,7 +1754,8 @@ function get_snmpwalk( $quick_print=0, $base_oid='', $snmp_port='', - $server_to_exec=0 + $server_to_exec=0, + $extra_arguments='' ) { global $config; @@ -1805,15 +1806,15 @@ function get_snmpwalk( case '3': switch ($snmp3_security_level) { case 'authNoPriv': - $command_str = $snmpwalk_bin.' -m ALL -Oa -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; + $command_str = $snmpwalk_bin.' -m ALL -Oa '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; break; case 'noAuthNoPriv': - $command_str = $snmpwalk_bin.' -m ALL -Oa -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -l '.escapeshellarg($snmp3_security_level).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; + $command_str = $snmpwalk_bin.' -m ALL -Oa '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -l '.escapeshellarg($snmp3_security_level).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; break; default: - $command_str = $snmpwalk_bin.' -m ALL -Oa -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' -x '.escapeshellarg($snmp3_privacy_method).' -X '.escapeshellarg($snmp3_privacy_pass).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; + $command_str = $snmpwalk_bin.' -m ALL -Oa '.$extra_arguments.' -v 3'.' -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' -x '.escapeshellarg($snmp3_privacy_method).' -X '.escapeshellarg($snmp3_privacy_pass).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; break; } break; @@ -1822,7 +1823,7 @@ function get_snmpwalk( case '2c': case '1': default: - $command_str = $snmpwalk_bin.' -m ALL -Oa -v '.escapeshellarg($snmp_version).' -c '.escapeshellarg(io_safe_output($snmp_community)).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; + $command_str = $snmpwalk_bin.' -m ALL '.$extra_arguments.' -Oa -v '.escapeshellarg($snmp_version).' -c '.escapeshellarg(io_safe_output($snmp_community)).' '.escapeshellarg($ip_target).' '.$base_oid.' 2> '.$error_redir_dir; break; } From 8041c66f4c7db74260bfa07b5ca4bcfb2a9b0504 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Thu, 7 Feb 2019 16:28:05 +0100 Subject: [PATCH 40/95] Add _id_trap_ macro to snmp alert macros - #3439 Former-commit-id: 81fca58b445355834e136be8f0c09d6ea3a8f54f --- pandora_server/lib/PandoraFMS/Core.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 3bfd1e1a7d..4682c38820 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -3454,6 +3454,7 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) { # Specific SNMP Trap alert macros for regexp selectors in trap info my %macros; + $macros{'_trap_id_'} = $trap_id; $macros{'_snmp_oid_'} = $trap_oid; $macros{'_snmp_value_'} = $trap_value; From 23a8d0640f3a4902cb2af48070e1aa50cfa3ed90 Mon Sep 17 00:00:00 2001 From: Samuel Carcases Date: Thu, 7 Feb 2019 17:05:05 +0100 Subject: [PATCH 41/95] Update events.build_query.php Former-commit-id: 189244aa57d58eb33dd43f707eb6ac929f58e537 --- pandora_console/operation/events/events.build_query.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/events/events.build_query.php b/pandora_console/operation/events/events.build_query.php index ec6c274cba..f912c66bf1 100755 --- a/pandora_console/operation/events/events.build_query.php +++ b/pandora_console/operation/events/events.build_query.php @@ -172,7 +172,7 @@ if ($meta) { $id_agent = get_parameter('id_agent', 0); if ($id_agent) { $sql_post .= ' AND agent_name IN (SELECT nombre FROM tmetaconsole_agent WHERE - id_tagente ='.$id_agent." AND alias LIKE '".io_safe_input($text_agent)."')"; + id_tagente ='.$id_agent." AND alias LIKE '".$text_agent."')"; $filter_resume['agent'] = $text_agent; } } else { From c2a44e073fe0c63c17a2f2a79288fedffb8b4c74 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Thu, 7 Feb 2019 18:03:28 +0100 Subject: [PATCH 42/95] Update events.build_query.php Former-commit-id: 4622b27b1ce9e81ce81d89d7bc9d2eeb1b30fb93 --- .../operation/events/events.build_query.php | 82 ++++++++++--------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/pandora_console/operation/events/events.build_query.php b/pandora_console/operation/events/events.build_query.php index 4aa9e4a567..3af11f86b7 100755 --- a/pandora_console/operation/events/events.build_query.php +++ b/pandora_console/operation/events/events.build_query.php @@ -41,6 +41,39 @@ if ($id_group > 0) { $childrens_ids = array_keys($groups); } +if (($date_from == '') && ($date_to == '')) { + if ($event_view_hr > 0) { + $filter_resume['hours_max'] = $event_view_hr; + $unixtime = (get_system_time() - ($event_view_hr * SECONDS_1HOUR)); + $sql_post .= ' AND (utimestamp > '.$unixtime.')'; + } +} else { + // Some of this values will have the user's timezone, + // so we need to reverse it to the system's timezone + // before using it into the db. + $fixed_offset = get_fixed_offset(); + + if (!empty($date_from)) { + if (empty($time_from)) { + $time_from = '00:00:00'; + } + + $utimestamp_from = (strtotime($date_from.' '.$time_from) - $fixed_offset); + $filter_resume['time_from'] = date(DATE_FORMAT.' '.TIME_FORMAT, $utimestamp_from); + $sql_post .= ' AND (utimestamp >= '.$utimestamp_from.')'; + } + + if (!empty($date_to)) { + if (empty($time_to)) { + $time_to = '23:59:59'; + } + + $utimestamp_to = (strtotime($date_to.' '.$time_to) - $fixed_offset); + $filter_resume['time_to'] = date(DATE_FORMAT.' '.TIME_FORMAT, $utimestamp_to); + $sql_post .= ' AND (utimestamp <= '.$utimestamp_to.')'; + } +} + // Group selection if ($id_group > 0 && in_array($id_group, array_keys($groups))) { if ($propagate) { @@ -51,11 +84,15 @@ if ($id_group > 0 && in_array($id_group, array_keys($groups))) { $sql_post = " AND (id_grupo = $id_group OR id_group = $id_group)"; } } else { - $sql_post = sprintf( - ' AND (id_grupo IN (%s) OR id_group IN (%s)) ', - implode(',', array_keys($groups)), - implode(',', array_keys($groups)) - ); + hd(users_can_manage_group_all('ER')); + if (!users_is_admin() && !users_can_manage_group_all('ER')) { + hd(users_can_manage_group_all('ER')); + $sql_post = sprintf( + ' AND (id_grupo IN (%s) OR id_group IN (%s)) ', + implode(',', array_keys($groups)), + implode(',', array_keys($groups)) + ); + } } // Skip system messages if user is not PM @@ -218,39 +255,6 @@ if (!isset($date_to)) { $date_to = ''; } -if (($date_from == '') && ($date_to == '')) { - if ($event_view_hr > 0) { - $filter_resume['hours_max'] = $event_view_hr; - $unixtime = (get_system_time() - ($event_view_hr * SECONDS_1HOUR)); - $sql_post .= ' AND (utimestamp > '.$unixtime.')'; - } -} else { - // Some of this values will have the user's timezone, - // so we need to reverse it to the system's timezone - // before using it into the db - $fixed_offset = get_fixed_offset(); - - if (!empty($date_from)) { - if (empty($time_from)) { - $time_from = '00:00:00'; - } - - $utimestamp_from = (strtotime($date_from.' '.$time_from) - $fixed_offset); - $filter_resume['time_from'] = date(DATE_FORMAT.' '.TIME_FORMAT, $utimestamp_from); - $sql_post .= ' AND (utimestamp >= '.$utimestamp_from.')'; - } - - if (!empty($date_to)) { - if (empty($time_to)) { - $time_to = '23:59:59'; - } - - $utimestamp_to = (strtotime($date_to.' '.$time_to) - $fixed_offset); - $filter_resume['time_to'] = date(DATE_FORMAT.' '.TIME_FORMAT, $utimestamp_to); - $sql_post .= ' AND (utimestamp <= '.$utimestamp_to.')'; - } -} - // Search by tag if (!empty($tag_with)) { if (!users_is_admin()) { @@ -398,3 +402,5 @@ if ($meta) { } } } + +hd($sql_post); From e6abb61a132aabd60ba21962888dd3eec976f03e Mon Sep 17 00:00:00 2001 From: artica Date: Fri, 8 Feb 2019 00:01:29 +0100 Subject: [PATCH 43/95] Auto-updated build strings. Former-commit-id: 0f011fb8fe35e16e311b4cd0f946fec051170c32 --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 4 ++-- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index e15649e232..b0d91124af 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.731-190207 +Version: 7.0NG.731-190208 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index a631fb09e0..18b7ecf8d3 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190207" +pandora_version="7.0NG.731-190208" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 3af9a430e3..52420004de 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.731'; -use constant AGENT_BUILD => '190207'; +use constant AGENT_BUILD => '190208'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 911ba417ad..3993a5bd13 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190207 +%define release 190208 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 541e84d5d2..442973f4b5 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190207 +%define release 190208 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index f0bcf0ca6c..2120d8b93d 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190207" +PI_BUILD="190208" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 32199ce71a..008d448846 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190207} +{190208} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 41b2406096..3b53ff7396 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.731(Build 190207)") +#define PANDORA_VERSION ("7.0NG.731(Build 190208)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 3df3840653..e4f02cd597 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.731(Build 190207))" + VALUE "ProductVersion", "(7.0NG.731(Build 190208))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index d34d864b44..94f0ca1d13 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.731-190207 +Version: 7.0NG.731-190208 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 56e2337ea7..ae82ac8e38 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190207" +pandora_version="7.0NG.731-190208" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index b7d7211711..14c7eee371 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190207'; +$build_version = 'PC190208'; $pandora_version = 'v7.0NG.731'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 68cd6dcbde..aa4ec21ada 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -112,8 +112,8 @@
    [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index b737e6e75f..c425d82675 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190207 +%define release 190208 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 0d0a9e3a3b..4ce9ced407 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190207 +%define release 190208 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 89c4249a12..bd92093f41 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190207" +PI_BUILD="190208" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 71e6375747..d1ff8d455f 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.731 PS190207"; +my $version = "7.0NG.731 PS190208"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 13823fe4e6..5711034fcc 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.731 PS190207"; +my $version = "7.0NG.731 PS190208"; # save program name for logging my $progname = basename($0); From ba7540c9ee79344b81dd820d95458f24b4003aac Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Fri, 8 Feb 2019 09:51:08 +0100 Subject: [PATCH 44/95] improvement of optimization for list event Former-commit-id: a7788b01160c661139e6a3a6aac70c69441265a1 --- .../operation/events/events.build_query.php | 57 ++++++++----------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/pandora_console/operation/events/events.build_query.php b/pandora_console/operation/events/events.build_query.php index 3af11f86b7..85d0de9a7d 100755 --- a/pandora_console/operation/events/events.build_query.php +++ b/pandora_console/operation/events/events.build_query.php @@ -19,7 +19,6 @@ if (check_acl($id_user, 0, 'ER')) { $groups = users_get_groups($id_user, 'EM'); } - $propagate = db_get_value('propagate', 'tgrupo', 'id_grupo', $id_group); if ($id_group > 0) { @@ -41,7 +40,15 @@ if ($id_group > 0) { $childrens_ids = array_keys($groups); } -if (($date_from == '') && ($date_to == '')) { +if (!isset($date_from)) { + $date_from = ''; +} + +if (!isset($date_to)) { + $date_to = ''; +} + +if (($date_from === '') && ($date_to === '')) { if ($event_view_hr > 0) { $filter_resume['hours_max'] = $event_view_hr; $unixtime = (get_system_time() - ($event_view_hr * SECONDS_1HOUR)); @@ -74,20 +81,18 @@ if (($date_from == '') && ($date_to == '')) { } } -// Group selection +// Group selection. if ($id_group > 0 && in_array($id_group, array_keys($groups))) { if ($propagate) { $childrens_str = implode(',', $childrens_ids); - $sql_post = " AND (id_grupo IN ($childrens_str) OR id_group IN ($childrens_str))"; + $sql_post .= " AND (id_grupo IN ($childrens_str) OR id_group IN ($childrens_str))"; } else { - // If a group is selected and it's in the groups allowed - $sql_post = " AND (id_grupo = $id_group OR id_group = $id_group)"; + // If a group is selected and it's in the groups allowed. + $sql_post .= " AND (id_grupo = $id_group OR id_group = $id_group)"; } } else { - hd(users_can_manage_group_all('ER')); if (!users_is_admin() && !users_can_manage_group_all('ER')) { - hd(users_can_manage_group_all('ER')); - $sql_post = sprintf( + $sql_post .= sprintf( ' AND (id_grupo IN (%s) OR id_group IN (%s)) ', implode(',', array_keys($groups)), implode(',', array_keys($groups)) @@ -95,7 +100,7 @@ if ($id_group > 0 && in_array($id_group, array_keys($groups))) { } } -// Skip system messages if user is not PM +// Skip system messages if user is not PM. if (!check_acl($id_user, 0, 'PM')) { $sql_post .= ' AND id_grupo != 0'; } @@ -201,7 +206,7 @@ if ($source != '') { $sql_post .= " AND source LIKE '%$source%'"; } -// In metaconsole mode the agent search is performed by name +// In metaconsole mode the agent search is performed by name. if ($meta) { $text_agent = get_parameter('text_agent', ''); $id_agent = get_parameter('id_agent', 0); @@ -216,7 +221,7 @@ if ($meta) { break; case -1: - // Agent doesnt exist. No results will returned + // Agent doesnt exist. No results will returned. $sql_post .= ' AND 1 = 0'; break; @@ -229,9 +234,7 @@ if ($meta) { -if ($meta) { - // There is another filter. -} else { +if (!$meta) { if (!empty($text_module)) { $filter_resume['module'] = $text_module; $sql_post .= " AND id_agentmodule IN ( @@ -247,15 +250,7 @@ if ($id_user_ack != '0') { $sql_post .= " AND id_usuario = '".$id_user_ack."'"; } -if (!isset($date_from)) { - $date_from = ''; -} - -if (!isset($date_to)) { - $date_to = ''; -} - -// Search by tag +// Search by tag. if (!empty($tag_with)) { if (!users_is_admin()) { $user_tags = array_flip(tags_get_tags_for_module_search()); @@ -309,7 +304,7 @@ if (!empty($tag_without)) { $sql_post .= ' ) '; } -// Filter/Only alerts +// Filter/Only alerts. if (isset($filter_only_alert)) { if ($filter_only_alert == 0) { $filter_resume['alerts'] = $filter_only_alert; @@ -320,7 +315,7 @@ if (isset($filter_only_alert)) { } } -// Tags ACLS +// Tags ACLS. if ($id_group > 0 && in_array($id_group, array_keys($groups))) { $group_array = (array) $id_group; } else { @@ -339,7 +334,7 @@ if (check_acl($id_user, 0, 'ER')) { [], true ); - // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)" + // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)". } else if (check_acl($id_user, 0, 'EW')) { $tags_acls_condition = tags_get_acl_tags( $id_user, @@ -352,7 +347,7 @@ if (check_acl($id_user, 0, 'ER')) { [], true ); - // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)" + // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)". } else if (check_acl($id_user, 0, 'EM')) { $tags_acls_condition = tags_get_acl_tags( $id_user, @@ -365,14 +360,14 @@ if (check_acl($id_user, 0, 'ER')) { [], true ); - // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)" + // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)". } if (($tags_acls_condition != ERR_WRONG_PARAMETERS) && ($tags_acls_condition != ERR_ACL) && ($tags_acls_condition != -110000)) { $sql_post .= $tags_acls_condition; } -// Metaconsole fitlers +// Metaconsole fitlers. if ($meta) { if ($server_id) { $filter_resume['server'] = $server_id; @@ -402,5 +397,3 @@ if ($meta) { } } } - -hd($sql_post); From 16c742bd83a9320dfa1eb21ed265e6e74a6fd77b Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 8 Feb 2019 14:10:19 +0100 Subject: [PATCH 45/95] fixed report pdf Former-commit-id: 442a90512fbb244154749ddefe0007cef65655c5 --- pandora_console/include/functions_html.php | 60 +++---- .../include/functions_reporting_html.php | 157 ++++++++++-------- pandora_console/include/styles/pandoraPDF.css | 15 ++ 3 files changed, 136 insertions(+), 96 deletions(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index f2093dd1c8..2079c8fbc4 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1822,35 +1822,36 @@ function html_get_predefined_table($model='transparent', $columns=4) * Print a nicely formatted table. Code taken from moodle. * * @param object Object with several properties: - * $table->head - An array of heading names. - * $table->head_colspan - An array of colspans of each head column. - * $table->headstyle - An array of styles of each head column. - * $table->align - An array of column alignments - * $table->valign - An array of column alignments - * $table->size - An array of column sizes - * $table->wrap - An array of "nowrap"s or nothing - * $table->style - An array of personalized style for each column. - * $table->rowid - An array of personalized ids of each row. - * $table->rowstyle - An array of personalized style of each row. - * $table->rowclass - An array of personalized classes of each row (odd-evens classes will be ignored). - * $table->colspan - An array of colspans of each column. - * $table->rowspan - An array of rowspans of each column. - * $table->data[] - An array of arrays containing the data. - * $table->width - A percentage of the page - * $table->border - Border of the table. - * $table->tablealign - Align the whole table (float left or right) - * $table->cellpadding - Padding on each cell - * $table->cellspacing - Spacing between cells - * $table->cellstyle - Style of a cell - * $table->cellclass - Class of a cell - * $table->class - CSS table class - * $table->id - Table ID (useful in JavaScript) - * $table->headclass[] - An array of classes for each heading - * $table->title - Title of the table is a single string that will be on top of the table in the head spanning the whole table - * $table->titlestyle - Title style - * $table->titleclass - Title class - * $table->styleTable - Table style - * $table->caption - Table title + * $table->head - An array of heading names. + * $table->head_colspan - An array of colspans of each head column. + * $table->headstyle - An array of styles of each head column. + * $table->align - An array of column alignments + * $table->valign - An array of column alignments + * $table->size - An array of column sizes + * $table->wrap - An array of "nowrap"s or nothing + * $table->style - An array of personalized style for each column. + * $table->rowid - An array of personalized ids of each row. + * $table->rowstyle - An array of personalized style of each row. + * $table->rowclass - An array of personalized classes of each row (odd-evens classes will be ignored). + * $table->colspan - An array of colspans of each column. + * $table->rowspan - An array of rowspans of each column. + * $table->data[] - An array of arrays containing the data. + * $table->width - A percentage of the page + * $table->border - Border of the table. + * $table->tablealign - Align the whole table (float left or right) + * $table->cellpadding - Padding on each cell + * $table->cellspacing - Spacing between cells + * $table->cellstyle - Style of a cell + * $table->cellclass - Class of a cell + * $table->class - CSS table class + * $table->id - Table ID (useful in JavaScript) + * $table->headclass[] - An array of classes for each heading + * $table->title - Title of the table is a single string that will be on top of the table in the head spanning the whole table + * $table->titlestyle - Title style + * $table->titleclass - Title class + * $table->styleTable - Table style + * $table->caption - Table title + * $table->pdf_report - Table repeat title conteiner. * @param bool Whether to return an output string or echo now * * @return string HTML code if return parameter is true. @@ -2990,4 +2991,3 @@ function html_print_csrf_error() ); return true; } - diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index ed1ddfc891..c753b1b8a6 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -672,26 +672,27 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) true ); } else { - $return_pdf .= ''; + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; $return_pdf .= html_print_table( $table1, true ); - $return_pdf .= ''; - - $return_pdf .= ''; - $return_pdf .= html_print_table( - $table2, - true - ); - $return_pdf .= ''; - - $return_pdf .= ''; - $return_pdf .= html_print_table( - $table3, - true - ); - $return_pdf .= ''; + $table2->title = $item['title']; + $table2->titleclass = 'title_table_pdf'; + $table2->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table( + $table2, + true + ); + $table3->title = $item['title']; + $table3->titleclass = 'title_table_pdf'; + $table3->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table( + $table3, + true + ); } } else { $table->colspan['error']['cell'] = 3; @@ -699,82 +700,83 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) } if (!empty($item['charts'])) { - /* - $table1 = new stdClass(); - $table1->width = '99%'; - $table1->size = []; - $table1->size[0] = '10%'; + $table1 = new stdClass(); + $table1->width = '99%'; + $table1->size = []; + $table1->size[0] = '10%'; - $table1->data = []; + $table1->data = []; - foreach ($item['charts'] as $chart) { + foreach ($item['charts'] as $chart) { $table1->data[] = [ $chart['agent'].'
    '.$chart['module'], $chart['chart'], ]; - } + } - if ($pdf === 0) { + if ($pdf === 0) { $table->colspan['charts']['cell'] = 2; $table->data['charts']['cell'] = html_print_table( $table1, true ); - } else { + } else { + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; $return_pdf .= html_print_table( $table1, true ); - } + } - // Table_legend_graphs. - $table1 = new stdClass(); - $table1->width = '99%'; - $table1->data = []; - $table1->size = []; - $table1->size[0] = '2%'; - $table1->data[0][0] = ''; - $table1->size[1] = '14%'; - $table1->data[0][1] = ''.__('OK').''; + // Table_legend_graphs. + $table1 = new stdClass(); + $table1->width = '99%'; + $table1->data = []; + $table1->size = []; + $table1->size[0] = '2%'; + $table1->data[0][0] = ''; + $table1->size[1] = '14%'; + $table1->data[0][1] = ''.__('OK').''; - $table1->size[2] = '2%'; - $table1->data[0][2] = ''; - $table1->size[3] = '14%'; - $table1->data[0][3] = ''.__('Critical').''; + $table1->size[2] = '2%'; + $table1->data[0][2] = ''; + $table1->size[3] = '14%'; + $table1->data[0][3] = ''.__('Critical').''; - $table1->size[4] = '2%'; - $table1->data[0][4] = ''; - $table1->size[5] = '14%'; - $table1->data[0][5] = ''.__('Unknow').''; + $table1->size[4] = '2%'; + $table1->data[0][4] = ''; + $table1->size[5] = '14%'; + $table1->data[0][5] = ''.__('Unknow').''; - $table1->size[6] = '2%'; - $table1->data[0][6] = ''; - $table1->size[7] = '14%'; - $table1->data[0][7] = ''.__('Not Init').''; + $table1->size[6] = '2%'; + $table1->data[0][6] = ''; + $table1->size[7] = '14%'; + $table1->data[0][7] = ''.__('Not Init').''; - $table1->size[8] = '2%'; - $table1->data[0][8] = ''; - $table1->size[9] = '14%'; - $table1->data[0][9] = ''.__('Downtimes').''; + $table1->size[8] = '2%'; + $table1->data[0][8] = ''; + $table1->size[9] = '14%'; + $table1->data[0][9] = ''.__('Downtimes').''; - $table1->size[10] = '2%'; - $table1->data[0][10] = ''; - $table1->size[11] = '15%'; - $table1->data[0][11] = ''.__('Ignore time').''; + $table1->size[10] = '2%'; + $table1->data[0][10] = ''; + $table1->size[11] = '15%'; + $table1->data[0][11] = ''.__('Ignore time').''; - if ($pdf === 0) { + if ($pdf === 0) { $table->colspan['legend']['cell'] = 2; $table->data['legend']['cell'] = html_print_table( $table1, true ); - } else { + } else { $return_pdf .= html_print_table( $table1, true ); - } - */ + } } } @@ -2348,13 +2350,28 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e } -function reporting_html_increment(&$table, $item) +/** + * Show a brief analysis in which the variation of the value + * of the indicated module is indicated. + * + * @param string $table + * @param array $item + * @param integer $pdf + * @return html + */ +function reporting_html_increment($table, $item, $pdf=0) { global $config; + $return_pdf = ''; + if (isset($item['data']['error'])) { - $table->colspan['error']['cell'] = 3; - $table->data['error']['cell'] = $item['data']['message']; + if ($pdf === 0) { + $table->colspan['error']['cell'] = 3; + $table->data['error']['cell'] = $item['data']['message']; + } else { + $return_pdf = $item['data']['message']; + } } else { $table1 = new stdClass(); $table1->width = '99%'; @@ -2403,9 +2420,17 @@ function reporting_html_increment(&$table, $item) $table1->data[] = $table1_row; - $data = []; - $data[0] = html_print_table($table1, true); - array_push($table->data, $data); + if ($pdf === 0) { + $data = []; + $data[0] = html_print_table($table1, true); + array_push($table->data, $data); + } else { + $return_pdf = html_print_table($table1, true); + } + } + + if ($pdf !== 0) { + return $return_pdf; } } diff --git a/pandora_console/include/styles/pandoraPDF.css b/pandora_console/include/styles/pandoraPDF.css index f3dca9373d..85eec2aa9b 100644 --- a/pandora_console/include/styles/pandoraPDF.css +++ b/pandora_console/include/styles/pandoraPDF.css @@ -48,6 +48,12 @@ thead.header_tr tr th.th_first { text-align: left; } +thead.header_tr tr th.th_description { + background-color: #f5f5f5; + color: #1c1c1c; + text-align: justify; +} + table.table_beauty { border-collapse: collapse; width: 100%; @@ -57,3 +63,12 @@ table.table_beauty tbody tr td { padding: 5px; border: 0.1pt solid #acacac; } + +table.databox { + margin-bottom: 20px; +} + +th.title_table_pdf { + background-color: #acacac; + padding: 15px; +} From f992e7b1f4f8ec04d792ae113e5b29499fc58960 Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 9 Feb 2019 00:01:35 +0100 Subject: [PATCH 46/95] Auto-updated build strings. Former-commit-id: 7eb19cce56cb06b70ee9269f4b51d7b45b19f5d9 --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index b0d91124af..35b305158a 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.731-190208 +Version: 7.0NG.731-190209 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 18b7ecf8d3..06e3132c6d 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190208" +pandora_version="7.0NG.731-190209" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 52420004de..a111e0ac4d 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.731'; -use constant AGENT_BUILD => '190208'; +use constant AGENT_BUILD => '190209'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 3993a5bd13..835d775c9f 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190208 +%define release 190209 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 442973f4b5..10cc69c6a2 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190208 +%define release 190209 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 2120d8b93d..1f14979290 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190208" +PI_BUILD="190209" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 008d448846..02cf08ea7e 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190208} +{190209} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 3b53ff7396..6a713b2708 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.731(Build 190208)") +#define PANDORA_VERSION ("7.0NG.731(Build 190209)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index e4f02cd597..deb57c1a23 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.731(Build 190208))" + VALUE "ProductVersion", "(7.0NG.731(Build 190209))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 94f0ca1d13..ca94d0101c 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.731-190208 +Version: 7.0NG.731-190209 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index ae82ac8e38..b2c6cba986 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190208" +pandora_version="7.0NG.731-190209" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 14c7eee371..1b5bd84ebf 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190208'; +$build_version = 'PC190209'; $pandora_version = 'v7.0NG.731'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index aa4ec21ada..94db42da2d 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -113,7 +113,7 @@
    [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index c425d82675..7add6e9d23 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190208 +%define release 190209 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 4ce9ced407..942ae54fa6 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190208 +%define release 190209 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index bd92093f41..d27dcf4114 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190208" +PI_BUILD="190209" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index d1ff8d455f..d1354375a1 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.731 PS190208"; +my $version = "7.0NG.731 PS190209"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 5711034fcc..ff63c790fb 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.731 PS190208"; +my $version = "7.0NG.731 PS190209"; # save program name for logging my $progname = basename($0); From 56797e717beca14948ffb03dec7a98f5647c032f Mon Sep 17 00:00:00 2001 From: artica Date: Sun, 10 Feb 2019 00:01:25 +0100 Subject: [PATCH 47/95] Auto-updated build strings. Former-commit-id: 728a4013a020328735f2e76b4ecb49e87d815d10 --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 35b305158a..ceeef66e8c 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.731-190209 +Version: 7.0NG.731-190210 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 06e3132c6d..6b93c4a1e9 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190209" +pandora_version="7.0NG.731-190210" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index a111e0ac4d..5ca02d4a39 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.731'; -use constant AGENT_BUILD => '190209'; +use constant AGENT_BUILD => '190210'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 835d775c9f..bb6fe292e9 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190209 +%define release 190210 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 10cc69c6a2..d52908f16a 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190209 +%define release 190210 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 1f14979290..08bfc8b4a8 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190209" +PI_BUILD="190210" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 02cf08ea7e..643bd96377 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190209} +{190210} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 6a713b2708..48174cc8b1 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.731(Build 190209)") +#define PANDORA_VERSION ("7.0NG.731(Build 190210)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index deb57c1a23..939e27500f 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.731(Build 190209))" + VALUE "ProductVersion", "(7.0NG.731(Build 190210))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index ca94d0101c..9b54dd0485 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.731-190209 +Version: 7.0NG.731-190210 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index b2c6cba986..e4bd1c3bc9 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190209" +pandora_version="7.0NG.731-190210" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 1b5bd84ebf..c78a673cc9 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190209'; +$build_version = 'PC190210'; $pandora_version = 'v7.0NG.731'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 94db42da2d..d0b3a710a6 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -113,7 +113,7 @@
    [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 7add6e9d23..3b97143de1 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190209 +%define release 190210 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 942ae54fa6..9b98000225 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190209 +%define release 190210 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index d27dcf4114..cc242decba 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190209" +PI_BUILD="190210" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index d1354375a1..01379b53b4 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.731 PS190209"; +my $version = "7.0NG.731 PS190210"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index ff63c790fb..0c3441e67c 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.731 PS190209"; +my $version = "7.0NG.731 PS190210"; # save program name for logging my $progname = basename($0); From 3acd6b8d31562be3a8a2972475c2a06e2705b147 Mon Sep 17 00:00:00 2001 From: artica Date: Mon, 11 Feb 2019 00:01:26 +0100 Subject: [PATCH 48/95] Auto-updated build strings. Former-commit-id: bb603dd63396712b8a649e3c08320653021c1289 --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index ceeef66e8c..64726c200d 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.731-190210 +Version: 7.0NG.731-190211 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 6b93c4a1e9..c250ad0133 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190210" +pandora_version="7.0NG.731-190211" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 5ca02d4a39..650b805708 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.731'; -use constant AGENT_BUILD => '190210'; +use constant AGENT_BUILD => '190211'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index bb6fe292e9..440400d161 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190210 +%define release 190211 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index d52908f16a..5f5fff46a6 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190210 +%define release 190211 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 08bfc8b4a8..d2a09dc251 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190210" +PI_BUILD="190211" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 643bd96377..e25d5bb13d 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190210} +{190211} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 48174cc8b1..c6f60b7aa2 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.731(Build 190210)") +#define PANDORA_VERSION ("7.0NG.731(Build 190211)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 939e27500f..a7f6242409 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.731(Build 190210))" + VALUE "ProductVersion", "(7.0NG.731(Build 190211))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 9b54dd0485..4d05af5d90 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.731-190210 +Version: 7.0NG.731-190211 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index e4bd1c3bc9..21b609d656 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190210" +pandora_version="7.0NG.731-190211" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index c78a673cc9..b2e74f4053 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190210'; +$build_version = 'PC190211'; $pandora_version = 'v7.0NG.731'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index d0b3a710a6..d953a9e48d 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -113,7 +113,7 @@
    [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 3b97143de1..68bac0e6a0 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190210 +%define release 190211 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 9b98000225..af6c012946 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190210 +%define release 190211 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index cc242decba..b14c6574b3 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190210" +PI_BUILD="190211" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 01379b53b4..0a0c73e505 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.731 PS190210"; +my $version = "7.0NG.731 PS190211"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 0c3441e67c..307d2ee1d6 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.731 PS190210"; +my $version = "7.0NG.731 PS190211"; # save program name for logging my $progname = basename($0); From b9a09cef45c42107371371118f94007ccaa1ed8c Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Mon, 11 Feb 2019 12:11:23 +0100 Subject: [PATCH 49/95] fixed bug in functions_reporting_html Former-commit-id: 53fd11f9b6ff51c55c0009b1e1448834ed7f0161 --- .../include/functions_reporting_html.php | 160 ------------------ 1 file changed, 160 deletions(-) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 91c5ecfac6..54f81e32bc 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2812,166 +2812,6 @@ function get_agent_first_time($agent_name) } -function reporting_html_general(&$table, $item) -{ - if (!empty($item['data'])) { - $data_in_same_row = $item['show_in_same_row']; - switch ($item['subtype']) { - case REPORT_GENERAL_NOT_GROUP_BY_AGENT: - if (!$data_in_same_row) { - $table1 = new stdClass(); - $table1->width = '99%'; - $table1->data = []; - $table1->head = []; - $table1->head[0] = __('Agent'); - $table1->head[1] = __('Module'); - if ($item['date']['period'] != 0) { - $table1->head[2] = __('Operation'); - } - - $table1->head[3] = __('Value'); - $table1->style[0] = 'text-align: left'; - $table1->style[1] = 'text-align: left'; - $table1->style[2] = 'text-align: left'; - $table1->style[3] = 'text-align: left'; - - // Begin - Order by agent - foreach ($item['data'] as $key => $row) { - $aux[$key] = $row['agent']; - } - - array_multisort($aux, SORT_ASC, $item['data']); - - // End - Order by agent - foreach ($item['data'] as $row) { - if ($item['date']['period'] != 0) { - $table1->data[] = [ - $row['agent'], - $row['module'], - $row['operator'], - $row['formated_value'], - ]; - } else { - $table1->data[] = [ - $row['agent'], - $row['module'], - $row['formated_value'], - ]; - } - } - } else { - $order_data = []; - foreach ($item['data'] as $row) { - $order_data[$row['id_agent']][$row['id_agent_module']][$row['operator']] = $row['formated_value']; - } - - $table1 = new stdClass(); - $table1->width = '99%'; - $table1->data = []; - $table1->head = []; - $table1->head[0] = __('Agent'); - $table1->head[1] = __('Module'); - $table1->head[2] = __('Avg'); - $table1->head[3] = __('Max'); - $table1->head[4] = __('Min'); - $table1->head[5] = __('Sum'); - $table1->style[0] = 'text-align: center'; - $table1->style[1] = 'text-align: center'; - $table1->style[2] = 'text-align: center'; - $table1->style[3] = 'text-align: center'; - $table1->style[4] = 'text-align: center'; - $table1->style[4] = 'text-align: center'; - - foreach ($order_data as $id_agent => $row) { - foreach ($row as $id_module => $row2) { - $table1->data[] = [ - agents_get_alias($id_agent), - modules_get_agentmodule_name($id_module), - $row2['Rate'], - $row2['Maximum'], - $row2['Minimum'], - $row2['Summatory'], - ]; - } - } - } - break; - - case REPORT_GENERAL_GROUP_BY_AGENT: - $list_modules = []; - foreach ($item['data'] as $modules) { - foreach ($modules as $name => $value) { - $list_modules[$name] = null; - } - } - - $list_modules = array_keys($list_modules); - - $table1->width = '99%'; - $table1->data = []; - $table1->head = array_merge([__('Agent')], $list_modules); - foreach ($item['data'] as $agent => $modules) { - $row = []; - - $row['agent'] = $agent; - $table1->style['agent'] = 'text-align: center;'; - foreach ($list_modules as $name) { - $table1->style[$name] = 'text-align: center;'; - if (isset($modules[$name])) { - $row[$name] = $modules[$name]; - } else { - $row[$name] = '--'; - } - } - - $table1->data[] = $row; - } - break; - } - - $table->colspan['data']['cell'] = 3; - $table->cellstyle['data']['cell'] = 'text-align: center;'; - $table->data['data']['cell'] = html_print_table($table1, true); - } else { - $table->colspan['error']['cell'] = 3; - $table->data['error']['cell'] = __('There are no Agent/Modules defined'); - } - - if ($item['resume'] && !empty($item['data'])) { - $table_summary = new stdClass(); - $table_summary->width = '99%'; - - $table_summary->data = []; - $table_summary->head = []; - $table_summary->head_colspan = []; - $table_summary->align = []; - - $table_summary->align[0] = 'left'; - $table_summary->align[1] = 'right'; - $table_summary->align[2] = 'right'; - $table_summary->align[3] = 'left'; - $table_summary->align[4] = 'right'; - - $table_summary->head_colspan[0] = 2; - $table_summary->head[0] = __('Min Value'); - $table_summary->head[1] = __('Average Value'); - $table_summary->head_colspan[2] = 2; - $table_summary->head[2] = __('Max Value'); - - $table_summary->data[0][0] = $item['min']['agent'].' - '.$item['min']['module']; - $table_summary->data[0][1] = $item['min']['formated_value']; - $table_summary->data[0][2] = format_for_graph($item['avg_value'], 2); - $table_summary->data[0][3] = $item['max']['agent'].' - '.$item['max']['module']; - $table_summary->data[0][4] = $item['max']['formated_value']; - - $table->colspan['summary_title']['cell'] = 3; - $table->data['summary_title']['cell'] = ''.__('Summary').''; - $table->colspan['summary_table']['cell'] = 3; - $table->data['summary_table']['cell'] = html_print_table($table_summary, true); - } -} - - function reporting_html_sql(&$table, $item) { if (!$item['correct']) { From 7150b8b7584eef67a3dde28a6db52969ba1d7ebb Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Mon, 11 Feb 2019 16:08:36 +0100 Subject: [PATCH 50/95] restore install.php Former-commit-id: 917f3d5d07b1bce92fa06836c5b2872dc06390d2 --- pandora_console/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/install.php b/pandora_console/install.php index 69e11b10bd..55daa07357 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -113,7 +113,7 @@
    Date: Mon, 11 Feb 2019 17:05:05 +0100 Subject: [PATCH 51/95] Fixed error in reports Former-commit-id: d3ad6cd8e1dd052fedc3dfe65bd5938537033f34 --- .../include/functions_reporting_html.php | 207 +++++++++++++----- pandora_console/include/styles/pandora.css | 48 +--- pandora_console/include/styles/pandoraPDF.css | 4 + 3 files changed, 169 insertions(+), 90 deletions(-) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index c753b1b8a6..d6e20c2105 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -407,6 +407,16 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) } +/** + * Function to print to HTML SLA report. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param boolean $mini If true or false letter mini. + * @param boolean $pdf If it comes from pdf. + * + * @return html + */ function reporting_html_SLA($table, $item, $mini, $pdf=0) { $return_pdf = ''; @@ -786,11 +796,25 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) } -function reporting_html_top_n($table, $item) +/** + * Function to print html report top N. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param boolean $pdf If it comes from pdf. + * + * @return html + */ +function reporting_html_top_n($table, $item, $pdf=0) { + $return_pdf = ''; if (!empty($item['failed'])) { - $table->colspan['top_n']['cell'] = 3; - $table->data['top_n']['cell'] = $item['failed']; + if ($pdf !== 0) { + $return_pdf .= $item['failed']; + } else { + $table->colspan['top_n']['cell'] = 3; + $table->data['top_n']['cell'] = $item['failed']; + } } else { $table1 = new stdClass(); $table1->width = '99%'; @@ -821,16 +845,31 @@ function reporting_html_top_n($table, $item) } $table->colspan['top_n']['cell'] = 3; - $table->data['top_n']['cell'] = html_print_table($table1, true); + if ($pdf !== 0) { + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table($table1, true); + } else { + $table->data['top_n']['cell'] = html_print_table($table1, true); + } if (!empty($item['charts']['pie'])) { - $table->colspan['char_pie']['cell'] = 3; - $table->data['char_pie']['cell'] = $item['charts']['pie']; + if ($pdf !== 0) { + $return_pdf .= $item['charts']['pie']; + } else { + $table->colspan['char_pie']['cell'] = 3; + $table->data['char_pie']['cell'] = $item['charts']['pie']; + } } if (!empty($item['charts']['bars'])) { - $table->colspan['char_bars']['cell'] = 3; - $table->data['char_bars']['cell'] = $item['charts']['bars']; + if ($pdf !== 0) { + $return_pdf .= $item['charts']['bars']; + } else { + $table->colspan['char_bars']['cell'] = 3; + $table->data['char_bars']['cell'] = $item['charts']['bars']; + } } if (!empty($item['resume'])) { @@ -860,10 +899,21 @@ function reporting_html_top_n($table, $item) $row[] = $item['resume']['max']['formated_value']; $table1->data[] = $row; - $table->colspan['resume']['cell'] = 3; - $table->data['resume']['cell'] = html_print_table($table1, true); + if ($pdf !== 0) { + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table($table1, true); + } else { + $table->colspan['resume']['cell'] = 3; + $table->data['resume']['cell'] = html_print_table($table1, true); + } } } + + if ($pdf !== 0) { + return $return_pdf; + } } @@ -1374,7 +1424,7 @@ function reporting_html_inventory($table, $item) } -function reporting_html_agent_module($table, $item) +function reporting_html_agent_module($table, $item, $pdf=0) { $table->colspan['agent_module']['cell'] = 3; $table->cellstyle['agent_module']['cell'] = 'text-align: center;'; @@ -1575,6 +1625,17 @@ function reporting_html_agent_module($table, $item) $table->data['agent_module']['cell'] = $table_data; } + + if ($pdf !== 0) { + $table->title = $item['title']; + $table->titleclass = 'title_table_pdf'; + $table->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table( + $table, + true + ); + return $return_pdf; + } } @@ -1666,60 +1727,66 @@ function reporting_html_exception($table, $item) } -function reporting_html_group_report($table, $item) +function reporting_html_group_report($table, $item, $pdf=0) { global $config; $table->colspan['group_report']['cell'] = 3; $table->cellstyle['group_report']['cell'] = 'text-align: center;'; - $table->data['group_report']['cell'] = " - + $data = "
    + - - + + - - - + + + - - - - - - + + + + + + - - - - - - - + + + + + + + - - + + - - - + + + - + - - - + + +
    ".__('Total')."
    ".__('Unknown')."
    ".__('Total')."".__('Unknown')."
    ".__('Agents')."
    ".$item['data']['group_stats']['total_agents']."
    ".$item['data']['group_stats']['agents_unknown']."
    ".__('Agents')."".$item['data']['group_stats']['total_agents']."".$item['data']['group_stats']['agents_unknown']."
    ".__('Total')."
    ".__('Normal')."
    ".__('Critical')."
    ".__('Warning')."
    ".__('Unknown')."
    ".__('Not init')."
    ".__('Total')."".__('Normal')."".__('Critical')."".__('Warning')."".__('Unknown')."".__('Not init')."
    ".__('Monitors')."
    ".$item['data']['group_stats']['monitor_checks']."
    ".$item['data']['group_stats']['monitor_ok']."
    ".$item['data']['group_stats']['monitor_critical']."
    ".$item['data']['group_stats']['monitor_warning']."
    ".$item['data']['group_stats']['monitor_unknown']."
    ".$item['data']['group_stats']['monitor_not_init']."
    ".__('Monitors')."".$item['data']['group_stats']['monitor_checks']."".$item['data']['group_stats']['monitor_ok']."".$item['data']['group_stats']['monitor_critical']."".$item['data']['group_stats']['monitor_warning']."".$item['data']['group_stats']['monitor_unknown']."".$item['data']['group_stats']['monitor_not_init']."
    ".__('Defined')."
    ".__('Fired')."
    ".__('Defined')."".__('Fired')."
    ".__('Alerts')."
    ".$item['data']['group_stats']['monitor_alerts']."
    ".$item['data']['group_stats']['monitor_alerts_fired']."
    ".__('Alerts')."".$item['data']['group_stats']['monitor_alerts']."".$item['data']['group_stats']['monitor_alerts_fired']."
    ".__('Last %s', human_time_description_raw($item['date']['period']))."
    ".__('Last %s', human_time_description_raw($item['date']['period']))."
    ".__('Events')."
    ".$item['data']['count_events'].'
    ".__('Events')."".$item['data']['count_events'].'
    '; + + $table->data['group_report']['cell'] = $data; + + if ($pdf !== 0) { + return $data; + } } @@ -2802,11 +2869,22 @@ function get_agent_first_time($agent_name) } -function reporting_html_general(&$table, $item) +/** + * Function to print to HTML General report. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param boolean $pdf If it comes from pdf. + * + * @return html + */ +function reporting_html_general($table, $item, $pdf=0) { + $return_pdf = ''; if (!empty($item['data'])) { $data_in_same_row = $item['show_in_same_row']; switch ($item['subtype']) { + default: case REPORT_GENERAL_NOT_GROUP_BY_AGENT: if (!$data_in_same_row) { $table1 = new stdClass(); @@ -2825,14 +2903,14 @@ function reporting_html_general(&$table, $item) $table1->style[2] = 'text-align: left'; $table1->style[3] = 'text-align: left'; - // Begin - Order by agent + // Begin - Order by agent. foreach ($item['data'] as $key => $row) { $aux[$key] = $row['agent']; } array_multisort($aux, SORT_ASC, $item['data']); - // End - Order by agent + // End - Order by agent. foreach ($item['data'] as $row) { if ($item['date']['period'] != 0) { $table1->data[] = [ @@ -2886,7 +2964,6 @@ function reporting_html_general(&$table, $item) } } break; - case REPORT_GENERAL_GROUP_BY_AGENT: $list_modules = []; foreach ($item['data'] as $modules) { @@ -2919,12 +2996,23 @@ function reporting_html_general(&$table, $item) break; } - $table->colspan['data']['cell'] = 3; - $table->cellstyle['data']['cell'] = 'text-align: center;'; - $table->data['data']['cell'] = html_print_table($table1, true); + if ($pdf !== 0) { + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table($table1, true); + } else { + $table->colspan['data']['cell'] = 3; + $table->cellstyle['data']['cell'] = 'text-align: center;'; + $table->data['data']['cell'] = html_print_table($table1, true); + } } else { - $table->colspan['error']['cell'] = 3; - $table->data['error']['cell'] = __('There are no Agent/Modules defined'); + if ($pdf !== 0) { + $return_pdf .= __('There are no Agent/Modules defined'); + } else { + $table->colspan['error']['cell'] = 3; + $table->data['error']['cell'] = __('There are no Agent/Modules defined'); + } } if ($item['resume'] && !empty($item['data'])) { @@ -2954,10 +3042,21 @@ function reporting_html_general(&$table, $item) $table_summary->data[0][3] = $item['max']['agent'].' - '.$item['max']['module']; $table_summary->data[0][4] = $item['max']['formated_value']; - $table->colspan['summary_title']['cell'] = 3; - $table->data['summary_title']['cell'] = ''.__('Summary').''; - $table->colspan['summary_table']['cell'] = 3; - $table->data['summary_table']['cell'] = html_print_table($table_summary, true); + if ($pdf !== 0) { + $return_pdf .= html_print_table($table_summary, true); + } else { + $table->colspan['summary_title']['cell'] = 3; + $table->data['summary_title']['cell'] = ''.__('Summary').''; + $table->colspan['summary_table']['cell'] = 3; + $table->data['summary_table']['cell'] = html_print_table( + $table_summary, + true + ); + } + } + + if ($pdf !== 0) { + return $return_pdf; } } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index f971611bdf..aab2f63bf5 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -2064,82 +2064,58 @@ div#logo_text3 { /* TABLAS */ /* Cells divs to set individual styles with the table objects */ -div.cellBold { - width: 100%; - height: 100%; +td.cellBold { font-weight: bold; } -div.cellRight { - width: 100%; - height: 100%; +td.cellRight { text-align: right; } -div.cellCenter { - width: 100%; - height: 100%; +td.cellCenter { text-align: center; } -div.cellWhite { - width: 100%; - height: 100%; +td.cellWhite { background: #fff; color: #111; } -div.cellNormal { - width: 100%; - height: 100%; +td.cellNormal { background: #6eb432; color: #fff; } -div.cellCritical { - width: 100%; - height: 100%; +td.cellCritical { background: #f85858; color: #fff; } -div.cellWarning { - width: 100%; - height: 100%; +td.cellWarning { background: #ffea59; color: #111; } -div.cellUnknown { - width: 100%; - height: 100%; +td.cellUnknown { background: #aaaaaa; color: #ffffff; } -div.cellNotInit { - width: 100%; - height: 100%; +td.cellNotInit { background: #3ba0ff; color: #ffffff; } -div.cellAlert { - width: 100%; - height: 100%; +td.cellAlert { background: #ff8800; color: #111; } -div.cellBorder1 { - width: 100%; - height: 100%; +td.cellBorder1 { border: 1px solid #666; } -div.cellBig { - width: 100%; - height: 100%; +td.cellBig { font-size: 18px; } diff --git a/pandora_console/include/styles/pandoraPDF.css b/pandora_console/include/styles/pandoraPDF.css index 85eec2aa9b..37d527c30b 100644 --- a/pandora_console/include/styles/pandoraPDF.css +++ b/pandora_console/include/styles/pandoraPDF.css @@ -72,3 +72,7 @@ th.title_table_pdf { background-color: #acacac; padding: 15px; } + +table.table_agent_module tr td { + padding: 5px; +} From bbd3cb79ce3ace21b786d4561e42687660a814b9 Mon Sep 17 00:00:00 2001 From: artica Date: Tue, 12 Feb 2019 00:01:37 +0100 Subject: [PATCH 52/95] Auto-updated build strings. Former-commit-id: ca52afd38b1d242e4823639dd6c1e8cbc265ef04 --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 64726c200d..607627a3ee 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.731-190211 +Version: 7.0NG.731-190212 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index c250ad0133..9ba665ed46 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190211" +pandora_version="7.0NG.731-190212" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 650b805708..b725810739 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.731'; -use constant AGENT_BUILD => '190211'; +use constant AGENT_BUILD => '190212'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 440400d161..efeb0694d6 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190211 +%define release 190212 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 5f5fff46a6..5a9cffadd1 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190211 +%define release 190212 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index d2a09dc251..7a5ddeaa91 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190211" +PI_BUILD="190212" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index e25d5bb13d..86d8e9de52 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190211} +{190212} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index c6f60b7aa2..1e42bbc738 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.731(Build 190211)") +#define PANDORA_VERSION ("7.0NG.731(Build 190212)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index a7f6242409..e2a88d86bf 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.731(Build 190211))" + VALUE "ProductVersion", "(7.0NG.731(Build 190212))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 4d05af5d90..26c3ee5b1f 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.731-190211 +Version: 7.0NG.731-190212 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 21b609d656..6392c5a84a 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190211" +pandora_version="7.0NG.731-190212" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index b2e74f4053..1bb868d2cc 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190211'; +$build_version = 'PC190212'; $pandora_version = 'v7.0NG.731'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index d953a9e48d..c8224c01c0 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -113,7 +113,7 @@
    [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 68bac0e6a0..11b2df4ed0 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190211 +%define release 190212 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index af6c012946..b3548ca8f7 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190211 +%define release 190212 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index b14c6574b3..189467a643 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190211" +PI_BUILD="190212" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 0a0c73e505..b7c3b42ea3 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.731 PS190211"; +my $version = "7.0NG.731 PS190212"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 307d2ee1d6..2d8697cfc9 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.731 PS190211"; +my $version = "7.0NG.731 PS190212"; # save program name for logging my $progname = basename($0); From fa7f519d3446a16b87bb4f623cf9dca2d4dfb765 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 12 Feb 2019 14:52:18 +0100 Subject: [PATCH 53/95] Merged from develop. Former-commit-id: 438c0bfa6cfa77ef0b75df02f3bce020122692b9 --- .../godmode/agentes/configurar_agente.php | 40 +++++---- .../godmode/massive/massive_edit_agents.php | 17 ++-- pandora_console/include/functions_modules.php | 86 ++++++++++--------- 3 files changed, 76 insertions(+), 67 deletions(-) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index c6a01fbe53..dfa28988a8 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -824,23 +824,25 @@ if ($update_agent) { ] ); - # Update the configuration files - if ($old_values['intervalo'] != $intervalo) { - enterprise_hook( - 'config_agents_update_config_token', - array($id_agente, 'interval', $intervalo) - ); - } - if ($old_values['disabled'] != $disabled) { - enterprise_hook( - 'config_agents_update_config_token', - array($id_agente, 'standby', $disabled ? "1" : "0") - ); - // Validate alerts for disabled agents. - if ($disabled) { - alerts_validate_alert_agent($id_agente); - } - } + if ($old_value === false) { + // Create custom field if not exist + $update_custom = db_process_sql_insert( + 'tagent_custom_data', + [ + 'id_field' => $key, + 'id_agent' => $id_agente, + 'description' => $value, + ] + ); + } else { + $update_custom = db_process_sql_update( + 'tagent_custom_data', + ['description' => $value], + [ + 'id_field' => $key, + 'id_agent' => $id_agente, + ] + ); if ($update_custom == 1) { $update_custom_result = 1; @@ -943,6 +945,10 @@ if ($update_agent) { $disabled ? '1' : '0', ] ); + // Validate alerts for disabled agents. + if ($disabled) { + alerts_validate_alert_agent($id_agente); + } } if ($tpolicy_group_old) { diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php index 0b449ac8db..2011eec564 100755 --- a/pandora_console/godmode/massive/massive_edit_agents.php +++ b/pandora_console/godmode/massive/massive_edit_agents.php @@ -63,16 +63,9 @@ if ($update_agents) { $values['intervalo'] = get_parameter('interval'); } - if ($disabled_old !== false && $disabled_old != $values['disabled']) { - enterprise_hook( - 'config_agents_update_config_token', - array($id_agent, 'standby', $values['disabled']) - ); - // Validate alerts for disabled agents. - if ($values['disabled'] == 1) { - alerts_validate_alert_agent($id_agent); - } - } + if (get_parameter('id_os', '') != -1) { + $values['id_os'] = get_parameter('id_os'); + } if (get_parameter('id_parent', '') != '') { $values['id_parent'] = get_parameter('id_agent_parent', 0); @@ -212,6 +205,10 @@ if ($update_agents) { $values['disabled'], ] ); + // Validate alerts for disabled agents. + if ($values['disabled'] == 1) { + alerts_validate_alert_agent($id_agent); + } } if ($group_old || $result) { diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index d14483d088..164660fc25 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -311,48 +311,54 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent, * * @return True if the module was disabled. False if not. */ -function modules_change_disabled($id_agent_module, $new_value = 1) { - $id_agent_module = (array) $id_agent_module; - - $id_agent_module_changed = array(); - - foreach ($id_agent_module as $id_module) { - // If the module is already disabled/enabled ignore - $current_disabled = db_get_value('disabled', 'tagente_modulo', - 'id_agente_modulo', $id_module); - if ($current_disabled == $new_value) { - continue; - } +function modules_change_disabled($id_agent_module, $new_value=1) +{ + $id_agent_module = (array) $id_agent_module; - // Validate alerts for disabled modules. - if ($new_value == 1) { - alerts_validate_alert_module($id_module); - } + $id_agent_module_changed = []; - $id_agent_changed[] = modules_get_agentmodule_agent($id_module); - $id_agent_module_changed[] = $id_module; - } - - if (empty($id_agent_module_changed)) { - return NOERR; - } - else { - $result = db_process_sql_update('tagente_modulo', - array('disabled' => (int) $new_value), - array('id_agente_modulo' => $id_agent_module_changed)); - } - - if ($result) { - // Change the agent flag to update modules count - db_process_sql_update('tagente', - array('update_module_count' => 1), - array('id_agente' => $id_agent_changed)); - - return NOERR; - } - else { - return ERR_GENERIC; - } + foreach ($id_agent_module as $id_module) { + // If the module is already disabled/enabled ignore + $current_disabled = db_get_value( + 'disabled', + 'tagente_modulo', + 'id_agente_modulo', + $id_module + ); + if ($current_disabled == $new_value) { + continue; + } + // Validate alerts for disabled modules. + if ($new_value == 1) { + alerts_validate_alert_module($id_module); + } + + $id_agent_changed[] = modules_get_agentmodule_agent($id_module); + $id_agent_module_changed[] = $id_module; + } + + if (empty($id_agent_module_changed)) { + return NOERR; + } else { + $result = db_process_sql_update( + 'tagente_modulo', + ['disabled' => (int) $new_value], + ['id_agente_modulo' => $id_agent_module_changed] + ); + } + + if ($result) { + // Change the agent flag to update modules count + db_process_sql_update( + 'tagente', + ['update_module_count' => 1], + ['id_agente' => $id_agent_changed] + ); + + return NOERR; + } else { + return ERR_GENERIC; + } } From bcaccf31bc87ad3710899455b6a086f371a61be6 Mon Sep 17 00:00:00 2001 From: samucarc Date: Tue, 12 Feb 2019 17:55:58 +0100 Subject: [PATCH 54/95] fixed encryptation in network componet modules Former-commit-id: b4d64e4562add1b9853bfa888556a4495c4177ed --- .../godmode/modules/manage_network_components_form.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index e951b77bf4..92623e3062 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -47,7 +47,7 @@ if ($create_network_from_module) { $id_module_group = $data_module['id_module_group']; $id_plugin = $data_module['id_plugin']; $plugin_user = $data_module['plugin_user']; - $plugin_pass = $data_module['plugin_pass']; + $plugin_pass = io_output_password($data_module['plugin_pass']); $plugin_parameter = $data_module['plugin_parameter']; $macros = $data_module['macros']; $max_timeout = $data_module['max_timeout']; @@ -104,7 +104,7 @@ if (isset($id)) { $id_group = $component['id_group']; $id_plugin = $component['id_plugin']; $plugin_user = $component['plugin_user']; - $plugin_pass = $component['plugin_pass']; + $plugin_pass = io_output_password($component['plugin_pass']); $plugin_parameter = $component['plugin_parameter']; $macros = $component['macros']; $max_timeout = $component['max_timeout']; @@ -140,7 +140,7 @@ if (isset($id)) { // New support for snmp v3 $snmp_version = $component['tcp_send']; $snmp3_auth_user = $component['plugin_user']; - $snmp3_auth_pass = $component['plugin_pass']; + $snmp3_auth_pass = io_output_password($component['plugin_pass']); $snmp3_auth_method = $component['plugin_parameter']; $snmp3_privacy_method = $component['custom_string_1']; $snmp3_privacy_pass = $component['custom_string_2']; From 28a932148ed39a14ec43eb9331656444cb55c13b Mon Sep 17 00:00:00 2001 From: samucarc Date: Tue, 12 Feb 2019 18:55:36 +0100 Subject: [PATCH 55/95] Fixed tooltip Former-commit-id: 565813260edd865433afba59e8ecad824d549c77 --- pandora_console/godmode/setup/setup_auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/setup/setup_auth.php b/pandora_console/godmode/setup/setup_auth.php index 5124bb4bdc..abd0dd5050 100644 --- a/pandora_console/godmode/setup/setup_auth.php +++ b/pandora_console/godmode/setup/setup_auth.php @@ -43,7 +43,7 @@ if (is_ajax()) { if ($type_auth != 'mysql') { // Fallback to local authentication $row = []; - $row['name'] = __('Fallback to local authentication').ui_print_help_tip(__('Enable this option if you want to fallback to local authentication when remote (ldap etc...) authentication failed. Only available when "Save password" is enabled.'), true); + $row['name'] = __('Fallback to local authentication').ui_print_help_tip(__('Enable this option if you want to fallback to local authentication when remote (ldap etc...) authentication failed. Only available when \'Save password\' is enabled.'), true); $row['control'] = __('Yes').' '.html_print_radio_button('fallback_local_auth', 1, '', $config['fallback_local_auth'], true).'  '; $row['control'] .= __('No').' '.html_print_radio_button('fallback_local_auth', 0, '', $config['fallback_local_auth'], true); $table->data['fallback_local_auth'] = $row; From 0e39e3fef7b7946d93101f2d8396aa27debbb25e Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 13 Feb 2019 00:01:37 +0100 Subject: [PATCH 56/95] Auto-updated build strings. Former-commit-id: 7c2aabad85c99a55d80b3dc856c931f160cb35d7 --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 4 ++-- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 607627a3ee..5e6cdcaf52 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.731-190212 +Version: 7.0NG.731-190213 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 9ba665ed46..36394c1753 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190212" +pandora_version="7.0NG.731-190213" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index b725810739..51cfc9b3b4 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.731'; -use constant AGENT_BUILD => '190212'; +use constant AGENT_BUILD => '190213'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index efeb0694d6..dd33121a7b 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190212 +%define release 190213 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 5a9cffadd1..594a55cf67 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190212 +%define release 190213 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 7a5ddeaa91..a1fe47bf4d 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190212" +PI_BUILD="190213" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 86d8e9de52..97198033b0 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190212} +{190213} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 1e42bbc738..e733c2c808 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.731(Build 190212)") +#define PANDORA_VERSION ("7.0NG.731(Build 190213)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index e2a88d86bf..0a946f611d 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.731(Build 190212))" + VALUE "ProductVersion", "(7.0NG.731(Build 190213))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 26c3ee5b1f..48853b25f5 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.731-190212 +Version: 7.0NG.731-190213 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 6392c5a84a..72b51f04c3 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190212" +pandora_version="7.0NG.731-190213" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 1bb868d2cc..88feb4717c 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190212'; +$build_version = 'PC190213'; $pandora_version = 'v7.0NG.731'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 9d90a6df26..c232b43ac7 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -112,8 +112,8 @@
    [ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 11b2df4ed0..dd9d6163cb 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190212 +%define release 190213 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index b3548ca8f7..89ac48edce 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190212 +%define release 190213 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 189467a643..3e1b7760d5 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190212" +PI_BUILD="190213" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index bb776164da..c3c75fffb1 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.731 PS190212"; +my $version = "7.0NG.731 PS190213"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 2d8697cfc9..65d4942d52 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.731 PS190212"; +my $version = "7.0NG.731 PS190213"; # save program name for logging my $progname = basename($0); From 93edda07ee60ccb66dd94593001548af3440f530 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Date: Wed, 13 Feb 2019 07:55:21 +0100 Subject: [PATCH 57/95] fixed errors Former-commit-id: 167c9a725e5dbd4f4ae1db0b6fb6c573a364c122 --- pandora_console/include/functions_html.php | 1 - .../include/functions_reporting_html.php | 403 ++++++++++++++---- 2 files changed, 313 insertions(+), 91 deletions(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 2079c8fbc4..24da558335 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1851,7 +1851,6 @@ function html_get_predefined_table($model='transparent', $columns=4) * $table->titleclass - Title class * $table->styleTable - Table style * $table->caption - Table title - * $table->pdf_report - Table repeat title conteiner. * @param bool Whether to return an output string or echo now * * @return string HTML code if return parameter is true. diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index d6e20c2105..931d3be94b 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -295,13 +295,7 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) break; case 'sql_graph_vbar': - reporting_html_sql_graph($table, $item); - break; - case 'sql_graph_hbar': - reporting_html_sql_graph($table, $item); - break; - case 'sql_graph_pie': reporting_html_sql_graph($table, $item); break; @@ -1424,7 +1418,16 @@ function reporting_html_inventory($table, $item) } -function reporting_html_agent_module($table, $item, $pdf=0) +/** + * Print in html the agent / module report + * showing the status of these modules. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * + * @return void + */ +function reporting_html_agent_module($table, $item) { $table->colspan['agent_module']['cell'] = 3; $table->cellstyle['agent_module']['cell'] = 'text-align: center;'; @@ -1625,26 +1628,29 @@ function reporting_html_agent_module($table, $item, $pdf=0) $table->data['agent_module']['cell'] = $table_data; } - - if ($pdf !== 0) { - $table->title = $item['title']; - $table->titleclass = 'title_table_pdf'; - $table->titlestyle = 'text-align:left;'; - $return_pdf .= html_print_table( - $table, - true - ); - return $return_pdf; - } } -function reporting_html_exception($table, $item) +/** + * Function to print to HTML Exception report. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param boolean $pdf If it comes from pdf. + * + * @return html + */ +function reporting_html_exception($table, $item, $pdf=0) { + $return_pdf = ''; if (!empty($item['failed'])) { - $table->colspan['group_report']['cell'] = 3; - $table->cellstyle['group_report']['cell'] = 'text-align: center;'; - $table->data['group_report']['cell'] = $item['failed']; + if ($pdf !== 0) { + $return_pdf .= $item['failed']; + } else { + $table->colspan['group_report']['cell'] = 3; + $table->cellstyle['group_report']['cell'] = 'text-align: center;'; + $table->data['group_report']['cell'] = $item['failed']; + } } else { $table1 = new stdClass(); $table1->width = '99%'; @@ -1679,18 +1685,30 @@ function reporting_html_exception($table, $item) $table1->data[] = $row; } - $table->colspan['data']['cell'] = 3; - $table->cellstyle['data']['cell'] = 'text-align: center;'; - $table->data['data']['cell'] = html_print_table($table1, true); + if ($pdf !== 0) { + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table($table1, true); + } else { + $table->colspan['data']['cell'] = 3; + $table->cellstyle['data']['cell'] = 'text-align: center;'; + $table->data['data']['cell'] = html_print_table($table1, true); + } if (!empty($item['chart'])) { - $table->colspan['chart_pie']['cell'] = 3; - $table->cellstyle['chart_pie']['cell'] = 'text-align: center;'; - $table->data['chart_pie']['cell'] = $item['chart']['pie']; + if ($pdf !== 0) { + $return_pdf .= $item['chart']['pie']; + $return_pdf .= $item['chart']['hbar']; + } else { + $table->colspan['chart_pie']['cell'] = 3; + $table->cellstyle['chart_pie']['cell'] = 'text-align: center;'; + $table->data['chart_pie']['cell'] = $item['chart']['pie']; - $table->colspan['chart_hbar']['cell'] = 3; - $table->cellstyle['chart_hbar']['cell'] = 'text-align: center;'; - $table->data['chart_hbar']['cell'] = $item['chart']['hbar']; + $table->colspan['chart_hbar']['cell'] = 3; + $table->cellstyle['chart_hbar']['cell'] = 'text-align: center;'; + $table->data['chart_hbar']['cell'] = $item['chart']['hbar']; + } } if (!empty($item['resume'])) { @@ -1719,11 +1737,22 @@ function reporting_html_exception($table, $item) 'max' => $item['resume']['max']['formated_value'], ]; - $table->colspan['resume']['cell'] = 3; - $table->cellstyle['resume']['cell'] = 'text-align: center;'; - $table->data['resume']['cell'] = html_print_table($table1, true); + if ($pdf !== 0) { + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table($table1, true); + } else { + $table->colspan['resume']['cell'] = 3; + $table->cellstyle['resume']['cell'] = 'text-align: center;'; + $table->data['resume']['cell'] = html_print_table($table1, true); + } } } + + if ($pdf !== 0) { + return $return_pdf; + } } @@ -1970,7 +1999,16 @@ function reporting_html_event_report_agent($table, $item, $pdf=0) } -function reporting_html_historical_data($table, $item) +/** + * Function to print to HTML historical data report. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param boolean $pdf If it comes from pdf. + * + * @return html + */ +function reporting_html_historical_data($table, $item, $pdf=0) { global $config; @@ -1997,13 +2035,40 @@ function reporting_html_historical_data($table, $item) $table1->data[] = $row; } - $table->colspan['database_serialized']['cell'] = 3; - $table->cellstyle['database_serialized']['cell'] = 'text-align: center;'; - $table->data['database_serialized']['cell'] = html_print_table($table1, true); + if ($pdf === 0) { + $table->colspan['database_serialized']['cell'] = 3; + $table->cellstyle['database_serialized']['cell'] = 'text-align: center;'; + $table->data['database_serialized']['cell'] = html_print_table( + $table1, + true + ); + } else { + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; + return html_print_table( + $table1, + true + ); + } } -function reporting_html_database_serialized($table, $item) +/** + * It displays an item in the table format report from + * the data stored within the table named 'tagente_datos_stringin' + * the Pandora FMS Database. + * For it, the agent should serialize the data separating + * them with a line-separating character and another + * which separates the fields. All lines should contain all fields. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param boolean $pdf If it comes from pdf. + * + * @return html + */ +function reporting_html_database_serialized($table, $item, $pdf=0) { $table1 = new stdClass(); $table1->width = '100%'; @@ -2023,40 +2088,92 @@ function reporting_html_database_serialized($table, $item) } } - $table->colspan['database_serialized']['cell'] = 3; - $table->cellstyle['database_serialized']['cell'] = 'text-align: center;'; - $table->data['database_serialized']['cell'] = html_print_table($table1, true); + if ($pdf === 0) { + $table->colspan['database_serialized']['cell'] = 3; + $table->cellstyle['database_serialized']['cell'] = 'text-align: center;'; + $table->data['database_serialized']['cell'] = html_print_table( + $table1, + true + ); + } else { + $table1->title = $item['title']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; + return html_print_table( + $table1, + true + ); + } } -function reporting_html_group_configuration($table, $item) +/** + * Shows the data of a group and the agents that are part of them. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param boolean $pdf If it comes from pdf. + * + * @return html + */ +function reporting_html_group_configuration($table, $item, $pdf=0) { - $table1 = new stdClass(); - $table1->width = '100%'; - $table1->head = []; - $table1->data = []; $cell = ''; foreach ($item['data'] as $agent) { - $table2 = new stdClass(); - $table2->width = '100%'; - $table2->data = []; - reporting_html_agent_configuration($table2, ['data' => $agent]); - - $cell .= html_print_table($table2, true); + if ($pdf === 0) { + $table2 = new stdClass(); + $table2->width = '100%'; + $table2->data = []; + reporting_html_agent_configuration( + $table2, + ['data' => $agent], + $pdf + ); + $cell .= html_print_table( + $table2, + true + ); + } else { + $cell .= reporting_html_agent_configuration( + false, + ['data' => $agent], + $pdf, + $item['title'] + ); + } } - $table->colspan['group_configuration']['cell'] = 3; - $table->cellstyle['group_configuration']['cell'] = 'text-align: center;'; - $table->data['group_configuration']['cell'] = $cell; + if ($pdf === 0) { + $table->colspan['group_configuration']['cell'] = 3; + $table->cellstyle['group_configuration']['cell'] = 'text-align: center;'; + $table->data['group_configuration']['cell'] = $cell; + } else { + return $cell; + } } -function reporting_html_network_interfaces_report($table, $item, $pdf=false) +/** + * This type of report element will generate the interface graphs + * of all those devices that belong to the selected group. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param boolean $pdf If it comes from pdf. + * + * @return html + */ +function reporting_html_network_interfaces_report($table, $item, $pdf=0) { + $return_pdf = ''; if (!empty($item['failed'])) { - $table->colspan['interfaces']['cell'] = 3; - $table->cellstyle['interfaces']['cell'] = 'text-align: left;'; - $table->data['interfaces']['cell'] = $item['failed']; + if ($pdf === 0) { + $table->colspan['interfaces']['cell'] = 3; + $table->cellstyle['interfaces']['cell'] = 'text-align: left;'; + $table->data['interfaces']['cell'] = $item['failed']; + } else { + $return_pdf .= $item['failed']; + } } else { foreach ($item['data'] as $agent) { $table_agent = new StdCLass(); @@ -2069,9 +2186,6 @@ function reporting_html_network_interfaces_report($table, $item, $pdf=false) $table_agent->style[0] = 'text-align: center'; $table_agent->data['interfaces'] = ''; - if ($pdf) { - $return_pdf .= __('Agent').' '.$agent['agent']; - } foreach ($agent['interfaces'] as $interface) { $table_interface = new StdClass(); @@ -2103,22 +2217,35 @@ function reporting_html_network_interfaces_report($table, $item, $pdf=false) $table_interface->cellstyle['graph'][0] = 'text-align: center;'; } - if ($pdf) { - $table_interface->class = 'table-beauty'; - $return_pdf .= html_print_table($table_interface, true); + if ($pdf !== 0) { + $table_interface->title = $item['title'].' '.__('Agents').': '.$agent['agent']; + $table_interface->titleclass = 'title_table_pdf'; + $table_interface->titlestyle = 'text-align:left;'; + $table_interface->styleTable = 'page-break-inside:avoid;'; + + $return_pdf .= html_print_table( + $table_interface, + true + ); } - $table_agent->data['interfaces'] .= html_print_table($table_interface, true); + $table_agent->data['interfaces'] .= html_print_table( + $table_interface, + true + ); $table_agent->colspan[$interface_name][0] = 3; } $id = uniqid(); $table->colspan[$id][0] = 3; - $table->data[$id] = html_print_table($table_agent, true); + $table->data[$id] = html_print_table( + $table_agent, + true + ); } } - if ($pdf) { + if ($pdf !== 0) { return $return_pdf; } } @@ -2207,6 +2334,19 @@ function reporting_html_alert_report($table, $item, $pdf=0) } +/** + * This type of report element allows custom graphs to be defined + * for use in reports. + * These graphs will be created using SQL code entered by the user. + * This SQL code should always return a variable called "label" + * for the text labels or name of the elements to be displayed + * and a field called "value" to store the numerical value to be represented. + * + * @param object $table Parameters table. + * @param array $item Items data. + * + * @return void + */ function reporting_html_sql_graph($table, $item) { $table->colspan['chart']['cell'] = 3; @@ -2261,10 +2401,23 @@ function reporting_html_prediction_date($table, $item, $mini) } -function reporting_html_agent_configuration(&$table, $item) -{ - $table->colspan['agent']['cell'] = 3; - $table->cellstyle['agent']['cell'] = 'text-align: left;'; +/** + * Shows the data of agents and modules. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param boolean $pdf If it comes from pdf. + * @param string $title Show title pdf. + * + * @return html + */ +function reporting_html_agent_configuration( + $table, + $item, + $pdf=0, + $title='' +) { + $return_pdf = ''; $table1 = new stdClass(); $table1->width = '99%'; @@ -2276,6 +2429,7 @@ function reporting_html_agent_configuration(&$table, $item) $table1->head['description'] = __('Description'); $table1->head['status'] = __('Status'); $table1->data = []; + $row = []; $row['name'] = $item['data']['name']; $row['group'] = $item['data']['group_icon']; @@ -2289,13 +2443,32 @@ function reporting_html_agent_configuration(&$table, $item) } $table1->data[] = $row; - $table->data['agent']['cell'] = html_print_table($table1, true); - $table->colspan['modules']['cell'] = 3; - $table->cellstyle['modules']['cell'] = 'text-align: left;'; + if ($pdf === 0) { + $table->colspan['agent']['cell'] = 3; + $table->cellstyle['agent']['cell'] = 'text-align: left;'; + $table->data['agent']['cell'] = html_print_table( + $table1, + true + ); + } else { + $return_pdf .= html_print_table( + $table1, + true + ); + } + + if ($pdf === 0) { + $table->colspan['modules']['cell'] = 3; + $table->cellstyle['modules']['cell'] = 'text-align: left;'; + } if (empty($item['data']['modules'])) { - $table->data['modules']['cell'] = __('Empty modules'); + if ($pdf === 0) { + $table->data['modules']['cell'] = __('Empty modules'); + } else { + $return_pdf .= __('Empty modules'); + } } else { $table1->width = '99%'; $table1->head = []; @@ -2339,7 +2512,25 @@ function reporting_html_agent_configuration(&$table, $item) $table1->data[] = $row; } - $table->data['modules']['cell'] = html_print_table($table1, true); + if ($pdf === 0) { + $table->data['modules']['cell'] = html_print_table($table1, true); + } else { + if ($title !== '') { + $item['title'] = $title; + } + + $table1->title = $item['title'].' '.__('Agent').': '.$item['data']['name']; + $table1->titleclass = 'title_table_pdf'; + $table1->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table( + $table1, + true + ); + } + } + + if ($pdf !== 0) { + return $return_pdf; } } @@ -2421,9 +2612,10 @@ function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_e * Show a brief analysis in which the variation of the value * of the indicated module is indicated. * - * @param string $table - * @param array $item - * @param integer $pdf + * @param string $table Reference table in pdf a false. + * @param array $item Parameters for item pdf. + * @param boolean $pdf Send pdf. + * * @return html */ function reporting_html_increment($table, $item, $pdf=0) @@ -2437,7 +2629,7 @@ function reporting_html_increment($table, $item, $pdf=0) $table->colspan['error']['cell'] = 3; $table->data['error']['cell'] = $item['data']['message']; } else { - $return_pdf = $item['data']['message']; + $return_pdf .= $item['data']['message']; } } else { $table1 = new stdClass(); @@ -3061,11 +3253,25 @@ function reporting_html_general($table, $item, $pdf=0) } -function reporting_html_sql(&$table, $item) +/** + * Function to print to HTML query sql. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param boolean $pdf If it comes from pdf. + * + * @return html + */ +function reporting_html_sql($table, $item, $pdf=0) { + $return_pdf = ''; if (!$item['correct']) { - $table->colspan['error']['cell'] = 3; - $table->data['error']['cell'] = $item['error']; + if ($pdf === 0) { + $table->colspan['error']['cell'] = 3; + $table->data['error']['cell'] = $item['error']; + } else { + $return_pdf .= $item['error']; + } } else { $first = true; @@ -3074,10 +3280,10 @@ function reporting_html_sql(&$table, $item) $table2->width = '100%'; foreach ($item['data'] as $row) { - if ($first) { + if ($first === true) { $first = false; - // Print the header + // Print the header. foreach ($row as $key => $value) { $table2->head[] = $key; } @@ -3086,9 +3292,26 @@ function reporting_html_sql(&$table, $item) $table2->data[] = $row; } - $table->colspan['data']['cell'] = 3; - $table->cellstyle['data']['cell'] = 'text-align: center;'; - $table->data['data']['cell'] = html_print_table($table2, true); + if ($pdf === 0) { + $table->colspan['data']['cell'] = 3; + $table->cellstyle['data']['cell'] = 'text-align: center;'; + $table->data['data']['cell'] = html_print_table( + $table2, + true + ); + } else { + $table2->title = $item['title']; + $table2->titleclass = 'title_table_pdf'; + $table2->titlestyle = 'text-align:left;'; + $return_pdf .= html_print_table( + $table2, + true + ); + } + } + + if ($pdf !== 0) { + return $return_pdf; } } From 6a9e69adb1a5895941c66e3ccccb7fa4a3406368 Mon Sep 17 00:00:00 2001 From: samucarc Date: Wed, 13 Feb 2019 12:21:31 +0100 Subject: [PATCH 58/95] Added changes Former-commit-id: 0d0de6dba065aaaa5bbfc4b9f9790e4ef1b92b7d --- .../godmode/update_manager/update_manager.online.php | 5 +++-- pandora_console/include/functions_update_manager.php | 2 +- pandora_console/include/javascript/update_manager.js | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/update_manager/update_manager.online.php b/pandora_console/godmode/update_manager/update_manager.online.php index ea946f23d6..3e807367bd 100644 --- a/pandora_console/godmode/update_manager/update_manager.online.php +++ b/pandora_console/godmode/update_manager/update_manager.online.php @@ -140,8 +140,8 @@ if ($enterprise == ENTERPRISE_NOT_HOOK) { ?>