diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 4e75f77388..9f53db8086 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,22 @@ +2014-06-17 Alejandro Gallardo + + * godmode/agentes/module_manager_editor_common.php, + operation/reporting/reporting_viewer.php, + operation/agentes/status_monitor.php, + include/functions_netflow.php, + include/functions_graph.php: Improvements to avoid + php notices and warnings. + + * godmode/setup/setup_visuals.php, + include/functions_config.php: Added a new option + to choose a custom line thickness for the line between + the items relations of the visual maps. + + * include/functions_visual_map.php, + include/javascript/pandora_visual_console.js: Added + support to the custom line thickness and fixed some + problems with the line connections. + 2014-06-17 Vanessa Gil * include/javascript/pandora_module.js: Fixed bug diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index b092adbd2b..82e7eef915 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -400,7 +400,7 @@ if (preg_match ('/async/', $module_type_name) || $edit) { '', 5, 10, true, $disabledBecauseInPolicy).ui_print_help_tip (__('Timeout in secs from start of flip flop counting. If this value is exceeded, FF counter is reset. Set to 0 for no timeout.'), true) . ''; } if (!preg_match ('/async/', $module_type_name) || $edit) { - $table_advanced->data[5][4] .= '' . __('Disabled') . ui_print_help_tip (__('This value can be set only in the async modules.'), true) . ''; + $table_advanced->data[5][4] = '' . __('Disabled') . ui_print_help_tip (__('This value can be set only in the async modules.'), true) . ''; } /* Tags */ diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 5eed8c7824..5df5192ddf 100644 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -241,6 +241,12 @@ $table->data[$row][1] = html_print_select ($values, 'vc_refr', $config["vc_refr" $row++; +if (empty($config["vc_line_thickness"])) $config["vc_line_thickness"] = 2; +$table->data[$row][0] = __('Default line thickness for the Visual Console') . ui_print_help_tip(__('This interval will affect to the lines between elements on the Visual Console'), true); +$table->data[$row][1] = html_print_input_text ('vc_line_thickness', $config["vc_line_thickness"], '', 5, 5, true); + +$row++; + $table->data[$row][0] = __('Agent size text') . ui_print_help_tip(__('When the agent name have a lot of characters, in some places in Pandora Console it is necesary truncate to N characters.'), true); $table->data[$row][1] = __('Small:') . html_print_input_text ('agent_size_text_small', $config["agent_size_text_small"], '', 3, 3, true); $table->data[$row][1] .= ' ' . __('Normal:') . html_print_input_text ('agent_size_text_medium', $config["agent_size_text_medium"], '', 3, 3, true); diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index fee6de8035..e206993ab8 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -413,6 +413,8 @@ function config_update_config () { $error_update[] = __('Login background'); if (!config_update_value ('vc_refr', get_parameter('vc_refr'))) $error_update[] = __('Default interval for refresh on Visual Console'); + if (!config_update_value ('vc_line_thickness', get_parameter('vc_line_thickness'))) + $error_update[] = __('Default line thickness for the Visual Console'); if (!config_update_value ('agent_size_text_small', get_parameter('agent_size_text_small'))) $error_update[] = __('Agent size text'); if (!config_update_value ('agent_size_text_medium', get_parameter('agent_size_text_medium'))) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 5a5c57c85d..4169f541c8 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -3466,10 +3466,10 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, // Fix event and alert scale $event_max = 2 + (float)$max_value * 1.05; foreach ($chart as $timestamp => $chart_data) { - if ($chart_data['event'] > 0) { + if (!empty($chart_data['event']) && $chart_data['event'] > 0) { $chart[$timestamp]['event'] = $event_max; } - if ($chart_data['alert'] > 0) { + if (!empty($chart_data['alert']) && $chart_data['alert'] > 0) { $chart[$timestamp]['alert'] = $event_max; } } diff --git a/pandora_console/include/functions_netflow.php b/pandora_console/include/functions_netflow.php index 82af2ea6ed..aded2a30cc 100644 --- a/pandora_console/include/functions_netflow.php +++ b/pandora_console/include/functions_netflow.php @@ -577,7 +577,15 @@ function netflow_get_data ($start_date, $end_date, $interval_length, $filter, $a // Address resolution start if ($get_hostnames) { if (!isset($hostnames[$line['agg']])) { - $hostname = gethostbyaddr($line['agg']); + $hostname = false; + // Trying to get something like an IP from the description + if (preg_match ("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $line['agg'], $matches) || + preg_match ("/(((?=(?>.*?(::))(?!.+\3)))\3?|([\dA-F]{1,4}(\3|:?)|\2))(?4){5}((?4){2}|(25[0-5]| + (2[0-4]|1\d|[1-9])?\d)(\.(?7)){3})/i", $line['agg'], $matches)) { + if ($matches[0]) { + $hostname = gethostbyaddr($line['agg']); + } + } if ($hostname !== false) { $hostnames[$line['agg']] = $hostname; $line['agg'] = $hostname; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 42cd0ede61..5500fdcc72 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -326,7 +326,7 @@ function visual_map_print_item($layoutData) { echo ''; } @@ -1146,6 +1146,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line $line['id'] = $layout_data['id']; $line['node_begin'] = 'layout-data-' . $layout_data["parent_item"]; $line['node_end'] = 'layout-data-' . $layout_data["id"]; + $line['thickness'] = empty($config["vc_line_thickness"]) ? 2 : $config["vc_line_thickness"]; switch ($status_parent) { default: case VISUAL_MAP_STATUS_UNKNOWN: diff --git a/pandora_console/include/javascript/pandora_visual_console.js b/pandora_console/include/javascript/pandora_visual_console.js index 57ec054502..f76388f604 100644 --- a/pandora_console/include/javascript/pandora_visual_console.js +++ b/pandora_console/include/javascript/pandora_visual_console.js @@ -29,10 +29,14 @@ function draw_line (line, id_div, editor) { if (typeof(resize_map) == 'undefined') { resize_map = 0; } + + var lineThickness = 2; + if (line['thickness']) + lineThickness = line['thickness']; div = document.getElementById (id_div); brush = new jsGraphics (div); - brush.setStroke (1); + brush.setStroke (lineThickness); brush.setColor (line['color']); have_node_begin_img = $('#'+line['node_begin'] + " img").length; @@ -42,12 +46,7 @@ function draw_line (line, id_div, editor) { x1 = line['x']; } else { - if (resize_map && have_node_begin_img) { - width = parseInt($('#'+line['node_begin'] + " img").css('width')); - } - else { - width = $('#'+line['node_begin']).width(); - } + width = $('#'+line['node_begin']).width(); x1 = parseInt($('#'+line['node_begin']).css (selector + 'left')) + (width / 2); } @@ -55,7 +54,7 @@ function draw_line (line, id_div, editor) { y1 = line['y1']; } else { - if (resize_map && have_node_begin_img) { + if (have_node_begin_img) { height = parseInt($('#'+line['node_begin'] + " img").css('height')); } else { @@ -68,12 +67,7 @@ function draw_line (line, id_div, editor) { x2 = line['x2']; } else { - if (resize_map && have_node_end_img) { - width = parseInt($('#'+line['node_end'] + " img").css('width')); - } - else { - width = $('#'+line['node_end']).width(); - } + width = $('#'+line['node_end']).width(); x2 = parseInt($('#'+line['node_end']).css (selector + 'left')) + (width / 2); } @@ -81,7 +75,7 @@ function draw_line (line, id_div, editor) { y2 = line['y2']; } else { - if (resize_map && have_node_end_img) { + if (have_node_end_img) { height = parseInt($('#'+line['node_end'] + " img").css('height')); } else { diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 8caf56ce00..10745773ac 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -514,9 +514,12 @@ foreach ($custom_fields as $custom_field) { $row = array(); $row[0] = $custom_field['name']; - $custom_field_value = $ag_custom_fields[$custom_field['id_field']]; - if (empty($custom_field_value)) { - $custom_field_value = ""; + $custom_field_value = ""; + if (!empty($ag_custom_fields)) { + $custom_field_value = $ag_custom_fields[$custom_field['id_field']]; + if (empty($custom_field_value)) { + $custom_field_value = ""; + } } $row[1] = html_print_input_text ("ag_custom_fields[".$custom_field['id_field']."]", $custom_field_value, '', 100, 300, true); diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index e8be6b20c2..03bfbf0227 100644 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -31,7 +31,7 @@ if (! $id_report) { $report = db_get_row ('treport', 'id_report', $id_report); // Check ACL on the report to see if user has access to the report. -if (! check_acl ($config['id_user'], $report['id_group'], "RR")) { +if (empty($report) || ! check_acl ($config['id_user'], $report['id_group'], "RR")) { db_pandora_audit("ACL Violation","Trying to access graph reader"); include ("general/noaccess.php"); exit;