From b372bcabac547f45868b83a5bf564b22354688fa Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Tue, 3 Jul 2018 13:47:34 +0200 Subject: [PATCH 01/93] fixed minor bug: entities in module name --- .../godmode/agentes/module_manager_editor_common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index db77af000b..edd76e841c 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -148,7 +148,7 @@ $table_simple->colspan[6][1] = 3; $table_simple->data[0][0] = __('Name'); $table_simple->data[0][1] = html_print_input_text_extended ('name', - io_safe_input(html_entity_decode($name)), 'text-name', '', 45, 100, $disabledBecauseInPolicy, '', $largeClassDisabledBecauseInPolicy, true); + io_safe_input(html_entity_decode($name, ENT_QUOTES, "UTF-8")), 'text-name', '', 45, 100, $disabledBecauseInPolicy, '', $largeClassDisabledBecauseInPolicy, true); //$table_simple->data[0][1] = html_print_input_text ('name', // io_safe_output($name), '', 45, 100, true, $disabledBecauseInPolicy); From 63a47e3acfe3e0b6073d47f51e66b0a58ed8a797 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Thu, 5 Jul 2018 18:48:31 +0200 Subject: [PATCH 02/93] removed watermark from incidents statistics graphs --- pandora_console/include/functions_graph.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 0fd12990b9..a917671b5c 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2967,7 +2967,7 @@ function grafico_incidente_prioridad () { } return pie3d_graph($config['flash_charts'], $data, 320, 200, - __('Other'), '', $water_mark, + __('Other'), '', '', $config['fontpath'], $config['font_size']); } @@ -3008,7 +3008,7 @@ function graph_incidents_status () { } return pie3d_graph($config['flash_charts'], $data, 320, 200, - __('Other'), '', $water_mark, + __('Other'), '', '', $config['fontpath'], $config['font_size']); } @@ -3064,7 +3064,7 @@ function graphic_incident_group () { } return pie3d_graph($config['flash_charts'], $data, 320, 200, - __('Other'), '', $water_mark, + __('Other'), '', '', $config['fontpath'], $config['font_size']); } @@ -3119,7 +3119,7 @@ function graphic_incident_user () { } return pie3d_graph($config['flash_charts'], $data, 320, 200, - __('Other'), '', $water_mark, + __('Other'), '', '', $config['fontpath'], $config['font_size']); } @@ -3173,7 +3173,7 @@ function graphic_incident_source($width = 320, $height = 200) { } return pie3d_graph($config['flash_charts'], $data, $width, $height, - __('Other'), '', $water_mark, + __('Other'), '', '', $config['fontpath'], $config['font_size']); } From d3b39fe1dd2cdea7dbac41396ccc784095dbcb89 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Fri, 6 Jul 2018 11:03:52 +0200 Subject: [PATCH 03/93] fixed visual bug: buttons in message edit bad positioned --- .../operation/messages/message_edit.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pandora_console/operation/messages/message_edit.php b/pandora_console/operation/messages/message_edit.php index ce1abf91a4..5df20ce9fe 100644 --- a/pandora_console/operation/messages/message_edit.php +++ b/pandora_console/operation/messages/message_edit.php @@ -103,22 +103,22 @@ if ($read_message) { //Start the message much like an e-mail reply $new_msg = "\n\n\nOn ".date ($config["date_format"], $message["timestamp"]).' '.$user_name.' '.__('wrote').":\n\n".$message["mensaje"]; - echo '
'; + echo ''; html_print_table($table); - echo "
"; - html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); - echo "
"; echo "
"; - echo '
'; + echo ''; html_print_input_hidden ("dst_user", $message["id_usuario_origen"]); html_print_input_hidden ("subject", $new_subj); html_print_input_hidden ("message", $new_msg); html_print_input_hidden ("orig_user", $message["id_usuario_destino"]); - echo "
"; - html_print_submit_button (__('Reply'), 'reply', false, 'class="sub next"'); - echo '
'; echo '
'; + + echo "
"; + html_print_submit_button(__('Delete'), 'delete_btn', false, 'form="delete_message" class="sub delete"'); + echo " "; + html_print_submit_button (__('Reply'), 'reply', false, 'form="reply_message" class="sub next"'); + echo "
"; return; } From 213a59d26ecd85c4adc8080b0ada8efbe4930768 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Mon, 16 Jul 2018 18:14:18 +0200 Subject: [PATCH 04/93] fixed bug on bulk delete and bulk update module operation --- .../godmode/massive/massive_edit_modules.php | 24 ++++++++++++------- pandora_console/include/functions_modules.php | 4 ++-- pandora_console/include/javascript/pandora.js | 2 +- .../operation/agentes/ver_agente.php | 9 ++++--- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 87fb1b3173..6e8238c254 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -47,17 +47,21 @@ $update = (bool) get_parameter_post ('update'); if ($update) { $agents_ = ''; if ($selection_mode == 'modules') { + + $agents_ = array(); + $force = get_parameter('force_type', false); if ($agents_select == false) { $agents_select = array(); - $agents_ = array(); } foreach ($agents_select as $agent_name) { $agents_[] = agents_get_agent_id($agent_name); } + $modules_ = $module_name; + } else if ($selection_mode == 'agents') { $force = get_parameter('force_group', false); @@ -75,6 +79,7 @@ if ($update) { // If the option to select all of one group or module type is checked if ($force) { if ($force == 'type') { + $type_condition = ''; if ($module_type != 0) $type_condition = "AND tam.id_tipo_modulo = $module_type"; @@ -141,12 +146,11 @@ if ($update) { else { // Standard procedure foreach ($agents_ as $agent_) { - + if ($modules_ == false) $modules_ = array(); foreach ($modules_ as $module_) { - $result = process_manage_edit ($module_, $agent_, $modules_selection_mode); $count++; $success += (int)$result; @@ -331,6 +335,7 @@ $table->data['form_modules_2'][2] .= html_print_select ( 'all' => __('Show all agents')), 'agents_selection_mode', 'common', false, '', '', true); + $table->data['form_modules_2'][3] = html_print_select (array(), 'agents[]', $agents_select, false, __('None'), 0, true, true, false); @@ -1519,12 +1524,14 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu $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, array ('id_agente_modulo')); } else { + if ($module_name == "0") { //Any module $modules = db_get_all_rows_filter ('tagente_modulo', @@ -1538,7 +1545,8 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu array ('id_agente_modulo')); } } - + + if ($modules === false) return false; @@ -1554,16 +1562,16 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu } $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)) { - + + if (is_error($result)) return false; - } + } return true; diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 59e88d9cdf..c749e03a9b 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -441,9 +441,9 @@ function modules_update_agent_module ($id, $values, } $result = @db_process_sql_update ('tagente_modulo', $values, $where); - + if ($result == false) { - if ($result_disable == ERR_GENERIC ){ + if ($result_disable === ERR_GENERIC ){ return ERR_DB; } else{ diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index fae6a82072..e1813f7abe 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -529,7 +529,7 @@ function module_changed_by_multiple_modules (event, id_module, selected) { jQuery.each (data, function (i, val) { s = js_html_entity_decode(val); $('#agents') - .append ($('').html (s).attr ("value", val)); + .append ($('').html (s).attr ("value", i)); $('#agents').fadeIn ('normal'); }); diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 8381bf3aa7..393aa07882 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -207,7 +207,7 @@ if (is_ajax ()) { $groups = users_get_groups ($config["id_user"], "AW", false); $group_id_list = ($groups ? join(",",array_keys($groups)):"0"); - $sql = 'SELECT DISTINCT(t1.alias) as name + $sql = 'SELECT DISTINCT(t1.nombre) as name, t1.alias FROM tagente t1, tagente_modulo t2 WHERE t1.id_agente = t2.id_agente AND t1.id_grupo IN (' . $group_id_list .') @@ -254,10 +254,9 @@ if (is_ajax ()) { if ($nameAgents == false) $nameAgents = array(); - foreach ($nameAgents as $nameAgent) { - $names[] = io_safe_output($nameAgent['name']); - } - + foreach ($nameAgents as $nameAgent) + $names[$nameAgent['name']] = io_safe_output($nameAgent['alias']); + echo json_encode($names); return; } From 4cbd80a3b410e5d1919982540a61c0d199fe0aec Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Tue, 17 Jul 2018 13:45:38 +0200 Subject: [PATCH 05/93] fixed wrong percentage in meta availability report --- pandora_console/include/functions_reporting_html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index da4bf3fff5..58b0e98167 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2432,7 +2432,7 @@ function reporting_html_availability(&$table, $item) { else $table_row[] = '--'; - $table_row[] = '' . sla_truncate($row['SLA'] * 100, $config['graph_precision']). '%'; + $table_row[] = '' . sla_truncate($row['SLA'], $config['graph_precision']). '%'; $table_row2 = array(); $table_row2[] = $row['agent']; From 5258d69e7e6cfe949ed8fbc27649ea51b47bb7e2 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Wed, 18 Jul 2018 17:44:18 +0200 Subject: [PATCH 06/93] fixed bug in meta alert view: agent names not showing in table --- pandora_console/include/functions_ui.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 633f007784..0e334cb35c 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -823,10 +823,26 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f else return array ("", "", "", "", "", "", ""); } - - // Get agent id - $id_agent = modules_get_agentmodule_agent ($alert['id_agent_module']); - $agente = db_get_row ('tagente', 'id_agente', $id_agent); + + + if (defined('METACONSOLE')) { + + $server = db_get_row ('tmetaconsole_setup', 'id', $alert['server_data']['id']); + + if (metaconsole_connect($server) == NOERR) { + + // Get agent data from node + $agente = db_get_row ('tagente', 'id_agente', $alert['id_agent']); + + metaconsole_restore_db (); + } + + } else { + // Get agent id + $id_agent = modules_get_agentmodule_agent ($alert['id_agent_module']); + $agente = db_get_row ('tagente', 'id_agente', $id_agent); + } + $template = alerts_get_alert_template ($alert['id_alert_template']); $description = io_safe_output($template['name']); From 88a9d6db4d6bf86353486d871d4b80132d9e855b Mon Sep 17 00:00:00 2001 From: samucarc Date: Wed, 18 Jul 2018 17:49:12 +0200 Subject: [PATCH 07/93] Fixed Windows visual mismatch of the Recon task --- pandora_console/operation/servers/recon_view.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandora_console/operation/servers/recon_view.php b/pandora_console/operation/servers/recon_view.php index a60a2452d7..7738a42a62 100644 --- a/pandora_console/operation/servers/recon_view.php +++ b/pandora_console/operation/servers/recon_view.php @@ -85,6 +85,10 @@ else { $table->head = array (); $table->data = array (); $table->align = array (); + $table->headstyle = array (); + for ($i=0; $i < 9; $i++) { + $table->headstyle[$i] = 'text-align: left;'; + } $table->head[0] = __('Force'); $table->align[0] = "left"; From b5c378d589adec0983af7d45f602556028745ffe Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Thu, 19 Jul 2018 13:55:16 +0200 Subject: [PATCH 08/93] fixed bug in meta alert view: action field (other than default) not showing --- pandora_console/include/functions_alerts.php | 22 +++++++++++++++----- pandora_console/include/functions_ui.php | 6 +----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index 3e3d424227..52f43783b5 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -1305,13 +1305,25 @@ function alerts_delete_alert_agent_module_action ($id_alert_agent_module_action) * * @return mixed Actions associated or false if something goes wrong. */ -function alerts_get_alert_agent_module_actions ($id_alert_agent_module, $fields = false) { +function alerts_get_alert_agent_module_actions ($id_alert_agent_module, $fields = false, $server_id = -1) { if (empty ($id_alert_agent_module)) return false; - - $actions = db_get_all_rows_filter ('talert_template_module_actions', - array ('id_alert_template_module' => $id_alert_agent_module), - $fields); + + if (defined('METACONSOLE')) { + $server = db_get_row ('tmetaconsole_setup', 'id', $server_id); + + if (metaconsole_connect($server) == NOERR) { + $actions = db_get_all_rows_filter ('talert_template_module_actions', + array ('id_alert_template_module' => $id_alert_agent_module), + $fields); + + metaconsole_restore_db (); + } + } else { + $actions = db_get_all_rows_filter ('talert_template_module_actions', + array ('id_alert_template_module' => $id_alert_agent_module), + $fields); + } if ($actions === false) return array (); diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 633f007784..d3871c4929 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -823,10 +823,6 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f else return array ("", "", "", "", "", "", ""); } - - // Get agent id - $id_agent = modules_get_agentmodule_agent ($alert['id_agent_module']); - $agente = db_get_row ('tagente', 'id_agente', $id_agent); $template = alerts_get_alert_template ($alert['id_alert_template']); $description = io_safe_output($template['name']); @@ -917,7 +913,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f ui_print_truncate_text (io_safe_output($description), 'description', false, true, true, '[…]', 'font-size: 7.1pt') . $disabledHtmlEnd; - $actions = alerts_get_alert_agent_module_actions ($alert['id'], false); + $actions = alerts_get_alert_agent_module_actions ($alert['id'], false, $alert['server_data']['id']); if (!empty($actions)) { $actionText = '