From b007e2d924055c61b4c72620d221bc38321ff6f8 Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Mon, 27 Aug 2018 12:12:09 +0200 Subject: [PATCH 01/66] Suppress entities in System audit log comments --- pandora_console/godmode/admin_access_logs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/admin_access_logs.php b/pandora_console/godmode/admin_access_logs.php index 82f0af0f7e..219177402f 100644 --- a/pandora_console/godmode/admin_access_logs.php +++ b/pandora_console/godmode/admin_access_logs.php @@ -235,7 +235,7 @@ foreach ($result as $row) { $data[2] = ui_print_help_tip(date($config["date_format"], $row["utimestamp"]), true) . ui_print_timestamp($row["utimestamp"], true); $data[3] = $row["ip_origen"]; - $data[4] = $row["descripcion"]; + $data[4] = io_safe_output($row["descripcion"]); if ($enterprise_include !== ENTERPRISE_NOT_HOOK) { $data[5] = enterprise_hook("cell1EntepriseAudit", array($row["id_sesion"])); From 997b1e21d72acf0f4e97cb856e33efa822f55023 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Tue, 4 Sep 2018 12:26:47 +0200 Subject: [PATCH 02/66] Fixed bug in modules deletion: parent id set to 0 in case parent has been deleted --- pandora_server/util/pandora_db.pl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 2989207841..8f10bc4c8e 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -292,12 +292,22 @@ sub pandora_purgedb ($$) { # Delete pending modules log_message ('PURGE', "Deleting pending delete modules (data table).", ''); + my @deleted_modules = get_db_rows ($dbh, 'SELECT id_agente_modulo FROM tagente_modulo WHERE delete_pending = 1'); + my @all_modules = get_db_rows ($dbh, 'SELECT id_agente_modulo, parent_module_id FROM tagente_modulo'); foreach my $module (@deleted_modules) { my $buffer = 1000; my $id_module = $module->{'id_agente_modulo'}; - + + foreach my $m (@all_modules) { + my $id_parent = $m->{'parent_module_id'}; + my $id_module_fetched = $m->{'id_agente_modulo'}; + if ($id_parent == $id_module) { + db_do ($dbh, 'UPDATE tagente_modulo SET parent_module_id=0 WHERE id_agente_modulo=?', $id_module_fetched); + } + } + log_message ('', "."); while(1) { From a0470114a53da2a6361ea2f710081a0bddb016ea Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Tue, 4 Sep 2018 13:00:43 +0200 Subject: [PATCH 03/66] Fixed bug in module manager --- pandora_console/godmode/agentes/module_manager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index b475e29e2b..c5fb96b591 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -138,7 +138,7 @@ if (($policy_page) || (isset($agent))) { echo ''; } echo ''; - echo __("Type"); + echo __("

Type

"); html_print_select ($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;' ); html_print_input_hidden ('edit_module', 1); echo ''; @@ -638,7 +638,7 @@ foreach ($modules as $module) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) $table->colspan[$i - 1][0] = 10; else - $table->colspan[$i - 1][0] = 8; + $table->colspan[$i - 1][0] = 9; $data = array (); } From 7d6bf289f8fcebd78fa25909edf33f509808a1a5 Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Wed, 5 Sep 2018 08:23:57 +0200 Subject: [PATCH 04/66] visuals fix in visual styles --- .../godmode/setup/setup_visuals.php | 105 ++++++------------ 1 file changed, 31 insertions(+), 74 deletions(-) diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 88b2392e14..0a7d36f8f5 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -83,13 +83,8 @@ $table_behaviour->data[$row][1] = html_print_checkbox('paginate_module', 1, $row++; $table_behaviour->data[$row][0] = __('Display data of proc modules in other format'); -$table_behaviour->data[$row][1] = __('Yes') . ' ' . - html_print_radio_button ('render_proc', 1, '', - $config["render_proc"], true) . - '  '; -$table_behaviour->data[$row][1] .= __('No') . ' ' . - html_print_radio_button ('render_proc', 0, '', - $config["render_proc"], true); +$table_behaviour->data[$row][1] = html_print_checkbox('render_proc', 1, + $config['render_proc'], true); $row++; $table_behaviour->data[$row][0] = __('Display text proc modules have state is ok'); @@ -103,13 +98,8 @@ $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] = __('Yes') . ' ' . - html_print_radio_button ('click_display', 1, '', - $config["click_display"], true) . - '  '; -$table_behaviour->data[$row][1] .= __('No') . ' ' . - html_print_radio_button ('click_display', 0, '', - $config["click_display"], true); +$table_behaviour->data[$row][1] = html_print_checkbox('click_display', 1, + $config['click_display'], true); $row++; //Daniel maya 02/06/2016 Display menu with click --END @@ -126,13 +116,8 @@ 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] = __('Yes') . ' ' . - html_print_radio_button ('classic_menu', 1, '', - $config["classic_menu"], true) . - '  '; -$table_behaviour->data[$row][1] .= __('No') . ' ' . - html_print_radio_button ('classic_menu', 0, '', - $config["classic_menu"], true); +$table_behaviour->data[$row][1] = html_print_checkbox('classic_menu', 1, + $config['classic_menu'], true); $row++; echo "
"; @@ -398,41 +383,31 @@ if(enterprise_installed()) { $row++; } -$table_styles->data[$row][0] = __('Disable logo in graphs'); -$table_styles->data[$row][1] = __('Yes') . ' ' . - html_print_radio_button_extended ('fixed_graph', 1, '', $config["fixed_graph"], $open, '','',true) . - '  '; +if (enterprise_installed()){ + $table_styles->data[$row][0] = __('Disable logo in graphs'); + $table_styles->data[$row][1] = html_print_checkbox('fixed_graph', 1, + $config['fixed_graph'], true); + $row++; +} + /* Hello there! :) We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :( You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years. */ - -$table_styles->data[$row][1] .= __('No') . ' ' . - html_print_radio_button_extended ('fixed_graph', 0, '', $config["fixed_graph"], $open, '','',true, $open,'visualmodal'); -$row++; $table_styles->data[$row][0] = __('Disable helps'); -$table_styles->data[$row][1] = __('Yes') . ' ' . - html_print_radio_button ('disable_help', 1, '', $config["disable_help"], true) . - '  '; -$table_styles->data[$row][1] .= __('No') . ' ' . - html_print_radio_button ('disable_help', 0, '', $config["disable_help"], true); +$table_styles->data[$row][1] = html_print_checkbox('disable_help', 1, + $config['disable_help'], true); $row++; $table_styles->data[$row][0] = __('Fixed header'); -$table_styles->data[$row][1] = __('Yes') . ' ' . - html_print_radio_button ('fixed_header', 1, '', $config["fixed_header"], true) . - '  '; -$table_styles->data[$row][1] .= __('No') . ' ' . - html_print_radio_button ('fixed_header', 0, '', $config["fixed_header"], true); +$table_styles->data[$row][1] = html_print_checkbox('fixed_header', 1, + $config['fixed_header'], true); $row++; $table_styles->data[$row][0] = __('Fixed menu'); -$table_styles->data[$row][1] = __('Yes') . ' ' . - html_print_radio_button ('fixed_menu', 1, '', $config["fixed_menu"], true) . - '  '; -$table_styles->data[$row][1] .= __('No') . ' ' . - html_print_radio_button ('fixed_menu', 0, '', $config["fixed_menu"], true); +$table_styles->data[$row][1] = html_print_checkbox('fixed_menu', 1, + $config['fixed_menu'], true); $row++; // For 5.1 Autohidden menu feature @@ -441,11 +416,8 @@ $table_styles->data['autohidden'][1] = html_print_checkbox('autohidden_menu', 1, $config['autohidden_menu'], true); $table_styles->data[$row][0] = __('Visual effects and animation'); -$table_styles->data[$row][1] = __('Yes') . ' ' . - html_print_radio_button ('visual_animation', 1, '', $config["visual_animation"], true) . - '  '; -$table_styles->data[$row][1] .= __('No') . ' ' . - html_print_radio_button ('visual_animation', 0, '', $config["visual_animation"], true); +$table_styles->data[$row][1] = html_print_checkbox('visual_animation', 1, + $config['visual_animation'], true); echo "
"; echo "" . __('Style configuration') . ""; @@ -465,10 +437,8 @@ $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] = __('Yes') . ' ' . - html_print_radio_button ('gis_label', 1, '', $config["gis_label"], true).'  '; -$table_gis->data[$row][1] .= __('No') . ' ' . - html_print_radio_button ('gis_label', 0, '', $config["gis_label"], true); +$table_gis->data[$row][1] = html_print_checkbox('gis_label', 1, +$config['gis_label'], true); $row++; $listIcons = gis_get_array_list_icons(); @@ -558,10 +528,8 @@ $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] = __('Yes') . ' ' . - html_print_radio_button ('simple_module_value', 1, '', $config["simple_module_value"], true).'  '; -$table_font->data[$row][1] .= __('No') . ' ' . - html_print_radio_button ('simple_module_value', 0, '', $config["simple_module_value"], true); +$table_font->data[$row][1] = html_print_checkbox('simple_module_value', 1, +$config['simple_module_value'], true); $row++; echo "
"; @@ -647,8 +615,8 @@ $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] = __('Yes').' '.html_print_radio_button ('round_corner', 1, '', $config["round_corner"], true).'  '; -$table_chars->data[$row][1] .= __('No').' '.html_print_radio_button ('round_corner', 0, '', $config["round_corner"], true); +$table_chars->data[$row][1] = html_print_checkbox('round_corner', 1, +$config['round_corner'], true); $row++; $table_chars->data[$row][0] = __('Type of module charts'); @@ -855,14 +823,8 @@ $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] = __('Yes') . ' ' . - html_print_radio_button ('show_qr_code_header', 1, '', - $config["show_qr_code_header"], true) . - '  '; -$table_other->data[$row][1] .= __('No') . ' ' . - html_print_radio_button ('show_qr_code_header', 0, '', - $config["show_qr_code_header"], true); - +$table_other->data[$row][1] = html_print_checkbox('show_qr_code_header', 1, +$config['show_qr_code_header'], true); $row++; $table_other->data[$row][0] = __('Custom graphviz directory') . @@ -882,13 +844,8 @@ $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] = __('Yes') . ' ' . - html_print_radio_button ('show_group_name', 1, '', - $config["show_group_name"], true) . - '  '; -$table_other->data[$row][1] .= __('No') . ' ' . - html_print_radio_button ('show_group_name', 0, '', - $config["show_group_name"], true); + html_print_checkbox('show_group_name', 1, + $config['show_group_name'], true); $row++; $table_other->data[$row][0] = __('Date format string') . ui_print_help_icon("date_format", true); From 481582f62856f983cf4500135985f22da0f49028 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Thu, 6 Sep 2018 16:42:52 +0200 Subject: [PATCH 05/66] Changed event type 'Going down to critical' to 'Going up to critical' --- 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 0d496bf9c4..3df864156f 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1162,7 +1162,7 @@ function events_print_type_description ($type, $return = false) { break; case "going_down_critical": case "going_up_critical": //This is to be backwards compatible - $output .= __('Going down to critical state'); + $output .= __('Going up to critical state'); break; case "going_up_normal": case "going_down_normal": //This is to be backwards compatible From a721eadcbd6ef3154e6030030d7b6a55b0cf5644 Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Fri, 7 Sep 2018 08:36:06 +0200 Subject: [PATCH 06/66] Fixed bug in the construction of the name of the xml file --- pandora_console/extensions/insert_data.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/extensions/insert_data.php b/pandora_console/extensions/insert_data.php index 5cfcc331d0..b930462fe5 100644 --- a/pandora_console/extensions/insert_data.php +++ b/pandora_console/extensions/insert_data.php @@ -48,7 +48,7 @@ function createXMLData($agent, $agentModule, $time, $data) { $data ); - $file_name = $config["remote_config"] . "/" . io_safe_output($agent["alias"]) . "." . str_replace($time, " ", "_") . ".data"; + $file_name = $config["remote_config"] . "/" . io_safe_output($agent["alias"]) . "." . strtotime($time) . ".data"; return (bool) @file_put_contents($file_name, $xml); } @@ -115,7 +115,7 @@ function mainInsertData() { $utimestamp = strtotime($date . " " . $time) - get_fixed_offset(); $timestamp = date(DATE_FORMAT . " " . TIME_FORMAT, $utimestamp); $result = createXMLData($agent, $agentModule, $timestamp, $data); - + if ($result) { $done++; } From a807763c1f44aa93d27112d501f3fe379e42b6ac Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Fri, 7 Sep 2018 13:56:35 +0200 Subject: [PATCH 07/66] Added horizontal scroll in the interfaces select --- .../godmode/agentes/agent_wizard.snmp_interfaces_explorer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php index e27c014a1f..7e1e8bd2f7 100644 --- a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php @@ -541,7 +541,7 @@ if (!empty($interfaces_list)) { $table->data[0][1] = ''; $table->data[0][2] = ''.__('Modules').''; - $table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px;'); + $table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;'); $table->data[1][1] = html_print_image('images/darrowright.png', true); $table->data[1][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;'); $table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true); From 3c251257138a0551798797489f80d51fbde7941b Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Mon, 10 Sep 2018 13:01:48 +0200 Subject: [PATCH 08/66] fixed bug: hide not init agents not working in report item creation --- .../include/functions_reporting_html.php | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 9ed6ab16e1..b2dc71c756 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -381,7 +381,7 @@ function reporting_html_SLA($table, $item, $mini) { } } - if(isset($item['data'])){ + if(!(!isset($item['data']) && $hide_notinit_agent == 1)) { $table1 = new stdClass(); $table1->width = '99%'; @@ -471,20 +471,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'])); - if (!$hide_notinit_agent) { - //first_table - $row = array(); - $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']); - } - else{ - $row[] = $sla['dinamic_text']; - } - $row[] = round($sla['sla_limit'], 2) . "%"; + //first_table + $row = array(); + $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']); + } + else{ + $row[] = $sla['dinamic_text']; + } + $row[] = round($sla['sla_limit'], 2) . "%"; + + if (!$hide_notinit_agent) { + if (reporting_sla_is_not_init_from_array($sla)) { $row[] = '' . @@ -646,6 +649,11 @@ function reporting_html_SLA($table, $item, $mini) { $table->colspan['checks_global']['cell'] = 2; $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'); + } if (!empty($item['charts'])) { $table1 = new stdClass(); @@ -2313,7 +2321,7 @@ function reporting_html_availability(&$table, $item) { global $config; - if (!empty($item["data"])) { + if (!empty($item["data"]) || ($hide_notinit_agent !=1 && ($item['type'] == "availability" || $item['type'] == "sla"))) { $table1 = new stdClass(); $table1->width = '99%'; $table1->data = array (); From e0242462ebc9b7f0d406a4a07c89ed23860f8673 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Mon, 10 Sep 2018 13:10:27 +0200 Subject: [PATCH 09/66] modified function for availability reporting --- 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 b2dc71c756..df58255356 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2321,7 +2321,7 @@ function reporting_html_availability(&$table, $item) { global $config; - if (!empty($item["data"]) || ($hide_notinit_agent !=1 && ($item['type'] == "availability" || $item['type'] == "sla"))) { + if (!empty($item["data"]) || $hide_notinit_agent !=1) { $table1 = new stdClass(); $table1->width = '99%'; $table1->data = array (); From d36c10fa089858a7ca1e2a8fcd4bc8ebe117c4ac Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Mon, 10 Sep 2018 13:22:02 +0200 Subject: [PATCH 10/66] new function that adds a border to the image if the status is warning - #2723 --- pandora_console/images/tip_border.png | Bin 0 -> 1281 bytes pandora_console/include/functions_ui.php | 17 +++++++++++++++++ .../operation/events/events.build_table.php | 9 ++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 pandora_console/images/tip_border.png diff --git a/pandora_console/images/tip_border.png b/pandora_console/images/tip_border.png new file mode 100755 index 0000000000000000000000000000000000000000..a7a9663a311034bc1f1a959ae01f2b80ed700f08 GIT binary patch literal 1281 zcmeAS@N?(olHy`uVBq!ia0vp^d_c_2!3HG#TlXXZDajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_cg49rTIArU1JzCKpT`MG+DAT@dwxdlMo3=B5*6$OdO*{LN8 zNvY|XdA3ULckfqH$V{%1*XSQL?vFu&J;D8jzb> zlBiITo0C^;Rbi_HHrEQs1_|pcDS(xfWZNo192Makpx~Tel&WB=XRMoSU}&gdW~OIo zVrph)sH0$HU}&Uo07PcGh9*{~W>!Y#3Q(W~w5=#5%__*n4QdyVXRDM^Qc_^0uU}qX zu2*iXmtT~wZ)j<02{OaTNEfI=x41H|B(Xv_uUHvof=g;~a#3bMNoIbY0?5R~r2Ntn zTP2`NAzsKWfE$}v3=Jk=fazBx7U&!58GyV5Q|Rl9UukYGTy=3tP%6T`SPd=?sVqp< z4@xc0FD*(2MqHXQ$f^P>=c3falKi5O{QMkPCx(xwAm%KD6=dz#jPkmR{`v0t4!Q(alvUG zRBsASw-~$P)TknMZjdOc->c+fq}8q)5S5Q z;#SEdZ*QhRk>mfbZ=bT%F{z((>I98wmsHk=i#qOXOMD+WsF zYH4H(+D(XaGwEFK^V~0enTYW256{n3{y8_Zc&E>_)GgMH4hx!ng1s#NUBsI9u2>Q-$sGP^|JjAvv+Ujq7Jca5yD;i+Y??}F>PtGePWJ_H)9D1BQt=W5oIhyugj zuMUd@@7oqA*F16ZP5Qj$@yq$LQ=JbQcWxGVZvSs}M$lT9y_~mJIloo2dTaai%CTFz z?=FSCInK7>Np(|s#F203G&a3YGe5ZU+UdaA#peXD$z3umT|a64@_hT3^ZxkkeHY!p$k3C#FudDT^%1C0@^tlcS?83{1OT=M&XNEC literal 0 HcmV?d00001 diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 54334e4ecf..d43e2a6e22 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -1952,6 +1952,23 @@ function ui_print_help_tip ($text, $return = false, $img = 'images/tip.png', $is echo $output; } +function ui_print_help_tip_border ($text, $return = false, $img = 'images/tip_border.png', $is_relative = false) { + $output = + '' . + html_print_image ( + $img, + true, + array('title' => $text), + false, + $is_relative && is_metaconsole() + ) . + ''; + + if ($return) + return $output; + echo $output; +} + /** * Powerful debug function that also shows a backtrace. * diff --git a/pandora_console/operation/events/events.build_table.php b/pandora_console/operation/events/events.build_table.php index 84b995af28..a26572f9e0 100644 --- a/pandora_console/operation/events/events.build_table.php +++ b/pandora_console/operation/events/events.build_table.php @@ -676,7 +676,14 @@ else { } $comments_help_tip = ""; if (!empty($event_user_comment_str)) { - $comments_help_tip = ui_print_help_tip($event_user_comment_str, true); + + if($myclass == 'datos_yellow'){ + $comments_help_tip = ui_print_help_tip_border($event_user_comment_str, true); + } + else{ + $comments_help_tip = ui_print_help_tip($event_user_comment_str, true); + } + } $data[$i] = '' . $comments_help_tip . ''; From 31c153ec27b99995e652569f2dc2d2062d1e13bc Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Tue, 11 Sep 2018 11:01:37 +0200 Subject: [PATCH 11/66] Changed Actions column with the right icons - #2637 --- pandora_console/include/help/en/help_eventview.php | 5 +++-- pandora_console/include/help/es/help_eventview.php | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/help/en/help_eventview.php b/pandora_console/include/help/en/help_eventview.php index 58bcc49d5a..4d2a5c8d1a 100644 --- a/pandora_console/include/help/en/help_eventview.php +++ b/pandora_console/include/help/en/help_eventview.php @@ -11,7 +11,7 @@

Validate

"Validated event", "alt" => "Validated event", "width" => '10', "height" => '10')); ?> - Validated event
- "Event not validated", "alt" => "Event not validated", "width" => '10', "height" => '10')); ?> - Event not validated + "Event not validated", "alt" => "Event not validated", "width" => '10', "height" => '10')); ?>
- Event not validated
@@ -27,7 +27,8 @@

Actions

"Validate event", "alt" => "Validate event")); ?> - Validate event
"Delete event", "alt" => "Delete event")); ?> - Delete event
- "Create incident from event", "alt" => "Create incident from event")); ?> - Create incident from event + "Show more", "alt" => "Show more")); ?> - Show more
+ "In progress", "alt" => "In progress")); ?> - In progress
 
diff --git a/pandora_console/include/help/es/help_eventview.php b/pandora_console/include/help/es/help_eventview.php index a01bf52eae..94dc475b43 100644 --- a/pandora_console/include/help/es/help_eventview.php +++ b/pandora_console/include/help/es/help_eventview.php @@ -11,7 +11,7 @@

Validar

"Validated event", "alt" => "Validated event", "width" => '10', "height" => '10')); ?> - Validar evento
- "Event not validated", "alt" => "Event not validated", "width" => '10', "height" => '10')); ?> - Evento no validado + "Event not validated", "alt" => "Event not validated", "width" => '10', "height" => '10')); ?>
- Evento no validado
@@ -27,7 +27,8 @@

Acciones

"Validate event", "alt" => "Validate event")); ?> - Validar evento
"Delete event", "alt" => "Delete event")); ?> - Borrar evento
- "Create incident from event", "alt" => "Create incident from event")); ?> - Crear incidente del evento + "Mostrar más", "alt" => "Mostrar más")); ?> - Mostrar más
+ "En progreso", "alt" => "En progreso")); ?> - En progreso
 
From 2fb8c99b2a79c41c0032f1eddea7a46fa4ee8a8b Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Tue, 11 Sep 2018 15:30:16 +0200 Subject: [PATCH 12/66] Database and application_osx icons added to select icon of group - #2572 --- .../images/groups_small/application_osx.png | Bin 0 -> 274 bytes pandora_console/images/groups_small/database.png | Bin 0 -> 397 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 pandora_console/images/groups_small/application_osx.png create mode 100644 pandora_console/images/groups_small/database.png diff --git a/pandora_console/images/groups_small/application_osx.png b/pandora_console/images/groups_small/application_osx.png new file mode 100644 index 0000000000000000000000000000000000000000..14a1a6e2b67d2af36f9bbb5252bfaa64449dac06 GIT binary patch literal 274 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc#=yY%t50_}kRw^*8c`CQpH@k=2BE*x~z~FR| zg*n2MnMI(Ed1Gcg!x7lqTko@5Xk_jx*IKhQ;k;Sjx*$IkVNHo0m=JZopj!u`M0}3oh(w4mq#Mu<3`? Vm-$nlMgZN<;OXk;vd$@?2>_dJ^)A=us{XZ zg9v~Cf+J?2^nL{eg@+(%2M`7bAeg5A$jX?Y^aW%=fB?dZuxWRM+3g6WK^A?03GPQy zxqu0akqQ6-#E8rTn(Y8J0tP++@qvQ}4_;tIQuH5>BORF-hy*NH#10_44T>2Exsd_t z#sdHWM6AsWjKrD-3-bL~6u|*dF(b*oJ_yAhkfL4y%Ab#{&>o-F$O&j79yJ$`P0Ys< z*s!EyfGuVmhzUoK&H!|4fkCqY!~h5|sw4C?(GR2w$S?;K+>W61jUIspWI9X$iW$%i zYy{#BP#Z}BAUzMT8CVYuZ~+nx41nb;CTd3tdb*hiP2&@wHWK4fkXQR*UPd=CADS5J r$#5LVF%QtaypfCufhC&{G)dS1j9*7y&jLmy00000NkvXXu0mjf-zkjC literal 0 HcmV?d00001 From 69ec75e39242cb3fadf6d8121a382387fb3ef2ad Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Fri, 14 Sep 2018 09:38:36 +0200 Subject: [PATCH 13/66] Capital letter in the letter a of audit - #2762 --- pandora_console/godmode/setup/setup_general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index 37f595a9fb..7d95828b68 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -222,7 +222,7 @@ $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[37][0] = __('audit log directory') . +$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); From 7e4ca193cfd73000863155e1cce330edc62cd282 Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Fri, 14 Sep 2018 14:19:49 +0200 Subject: [PATCH 14/66] Countdown in group view for autorefresh --- pandora_console/operation/users/user_edit.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 83b69c85d2..e5162f967d 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -385,10 +385,11 @@ $data = array(); $autorefresh_list_out = array(); if(is_metaconsole()) { $autorefresh_list_out['monitoring/tactical'] = "tactical"; + $autorefresh_list_out['monitoring/group_view'] = "group_view"; } else { $autorefresh_list_out['operation/agentes/tactical'] = "tactical"; + $autorefresh_list_out['operation/agentes/group_view'] = "group_view"; } -$autorefresh_list_out['operation/agentes/group_view'] = "group_view"; $autorefresh_list_out['operation/agentes/estado_agente'] = "agent_status"; $autorefresh_list_out['operation/agentes/alerts_status'] = "alerts_status"; $autorefresh_list_out['operation/agentes/status_monitor'] = "status_monitor"; From d0e7b86112540ddc89c0ec20bc40bdb5a72ff4e0 Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Tue, 18 Sep 2018 09:41:05 +0200 Subject: [PATCH 15/66] Fixed bug in deleted policies from the metaconsole --- pandora_console/include/functions.php | 5 +- pandora_console/include/functions_api.php | 275 ---------------------- 2 files changed, 3 insertions(+), 277 deletions(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index e2c5c742a3..5ee67a4638 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1369,10 +1369,11 @@ function is_metaconsole() { * * @return bool */ -function is_management_allowed() { +function is_management_allowed($hkey = '') { global $config; return ( (is_metaconsole() && $config["centralized_management"]) - || (!is_metaconsole() && !$config["centralized_management"])); + || (!is_metaconsole() && !$config["centralized_management"]) + || (!is_metaconsole() && $config["centralized_management"]) && $hkey == hash('sha256', db_get_value ('value', 'tupdate_settings', 'token', 'customer_key'))); } /** diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 189cc4203b..76968e1e75 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -30,7 +30,6 @@ include_once($config['homedir'] . "/include/functions_network_components.php"); include_once($config['homedir'] . "/include/functions_netflow.php"); include_once($config['homedir'] . "/include/functions_servers.php"); include_once($config['homedir'] . "/include/functions_planned_downtimes.php"); -include_once($config['homedir'] . "/include/functions_db.php"); enterprise_include_once ('include/functions_local_components.php'); enterprise_include_once ('include/functions_events.php'); enterprise_include_once ('include/functions_agents.php'); @@ -11398,282 +11397,8 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access = return false; } -function api_get_user_info($thrash1, $thrash2, $other, $returnType) { - if (defined ('METACONSOLE')) { - return; - } - - $separator = ';'; - - $other = json_decode(base64_decode($other['data']),true); - - $sql = 'select * from tusuario where id_user = "'.$other[0]['id_user'].'" and password = "'.$other[0]['password'].'"'; - - $user_info = db_get_all_rows_sql($sql); - - if (count($user_info) > 0 and $user_info !== false) { - $data = array('type' => 'array', 'data' => $user_info); - returnData($returnType, $data, $separator); - } - else { - return 0; - } -} -/* - -This function receives different parameters to process one of these actions the logging process in our application from the records in the audit of pandora fms, to avoid concurrent access of administrator users, and optionally to prohibit access to non-administrator users: - -Parameter 0 - -The User ID that attempts the action is used to check the status of the application for access. - -Parameter 1 - -Login, logout, exclude, browse. - -These requests receive a response that we can treat as we consider, this function only sends answers, does not perform any action in your application, you must customize them. - -Login action: free (register our access), taken, denied (if you are not an administrator user and parameter four is set to 1, register the expulsion). - -Browse action: It has the same answers as login, but does not register anything in the audit. - -Logout action: It records the deslogeo but does not send a response. - -All other actions do not return a response, - -Parameter 2 - -IP address of the application is also used to check the status of the application for access. - -Parameter 3 - -Name of the application, it is also used to check the status of the application for access. - -Parameter 4 - -If you mark 1 you will avoid the access to the non-administrators users, returning the response `denied' and registering that expulsion in the audit of pandora fms. - -*/ - - - -function api_set_access_process($thrash1, $thrash2, $other, $returnType) { - if (defined ('METACONSOLE')) { - return; - } - - $other['data'] = explode('|',$other['data']); - - $sql = 'select id_usuario,utimestamp from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].' Logon%" and id_usuario IN (select id_user from tusuario where is_admin = 1) and id_usuario != "'.$other['data'][0].'" order by utimestamp DESC limit 1'; - $audit_concurrence = db_get_all_rows_sql($sql); - $sql_user = 'select id_usuario,utimestamp from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].' Logon%" and id_usuario IN (select id_user from tusuario where is_admin = 1) and id_usuario = "'.$other['data'][0].'" order by utimestamp DESC limit 1'; - $audit_concurrence_user = db_get_all_rows_sql($sql_user); - $sql2 = 'select id_usuario,utimestamp,accion from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].' Logoff%" and id_usuario = "'.$audit_concurrence[0]['id_usuario'].'" order by utimestamp DESC limit 1'; - $audit_concurrence_2 = db_get_all_rows_sql($sql2); - - //The user trying to log in is an administrator - if(users_is_admin($other['data'][0])){ - //The admin user is trying to login - if($other['data'][1] == 'login'){ - // Check if there is an administrator user logged in prior to our last login - if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_user[0]['utimestamp']){ - // Check if the administrator user logged in later to us has unlogged and left the node free - if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_2[0]['utimestamp']){ - // The administrator user logged in later has not yet unlogged - returnData('string', array('type' => 'string', 'data' => 'taken')); - } - else{ - // The administrator user logged in later has already unlogged - returnData('string', array('type' => 'string', 'data' => 'free')); - } - } - else{ - // There is no administrator user who has logged in since then to log us in. - db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]); - returnData('string', array('type' => 'string', 'data' => 'free')); - } - - } - elseif ($other['data'][1] == 'logout') { - // The administrator user wants to log out - db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]); - } - elseif ($other['data'][1] == 'exclude') { - // The administrator user has ejected another administrator user who was logged in - db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]); - db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2] , $audit_concurrence[0]['id_usuario']); - - } - //The admin user is trying to browse - elseif ($other['data'][1] == 'browse') { - // Check if there is an administrator user logged in prior to our last login - if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_user[0]['utimestamp']){ - // Check if the administrator user logged in later to us has unlogged and left the node free - if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_2[0]['utimestamp']){ - // The administrator user logged in later has not yet unlogged - returnData('string', array('type' => 'string', 'data' => $audit_concurrence[0]['id_usuario'])); - } - else{ - // The administrator user logged in later has already unlogged - returnData('string', array('type' => 'string', 'data' => 'free')); - } - } - else{ - // There is no administrator user who has logged in since then to log us in. - returnData('string', array('type' => 'string', 'data' => 'free')); - } - - } - elseif ($other['data'][1] == 'cancelled'){ - //The administrator user tries to log in having another administrator logged in, but instead of expelling him he cancels his log in. - db_pandora_audit($other['data'][3].' cancelled access', 'Cancelled access in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]); - returnData('string', array('type' => 'string', 'data' => 'cancelled')); - } - -} -else{ - - if($other['data'][4] == 1){ - //The user trying to log in is not an administrator and is not allowed no admin access - db_pandora_audit($other['data'][3].' denied access', 'Denied access to non-admin user '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]); - returnData('string', array('type' => 'string', 'data' => 'denied')); - } - else{ - //The user trying to log in is not an administrator and is allowed no admin access - if($other['data'][1] == 'login'){ - //The user trying to login is not admin, can enter without concurrent use filter - db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]); - returnData('string', array('type' => 'string', 'data' => 'free')); - - } - elseif ($other['data'][1] == 'logout') { - //The user trying to logoff is not admin - db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]); - } - elseif ($other['data'][1] == 'browse'){ - //The user trying to browse in an app page is not admin, can enter without concurrent use filter - returnData('string', array('type' => 'string', 'data' => 'free')); - } - } - } -} - - -function api_get_traps($thrash1, $thrash2, $other, $returnType) { - - if (defined ('METACONSOLE')) { - return; - } - - $other['data'] = explode('|',$other['data']); - - $other['data'][1] = date("Y-m-d H:i:s",$other['data'][1]); - - $sql = 'SELECT * from ttrap where timestamp >= "'.$other['data'][1].'"'; - - // $sql = 'SELECT * from ttrap where source = "'.$other['data'][0].'" and timestamp >= "'.$other['data'][1].'"'; - - if($other['data'][4]){ - $other['data'][4] = date("Y-m-d H:i:s",$other['data'][4]); - $sql .= ' and timestamp <= "'.$other['data'][4].'"'; - } - - if($other['data'][2]){ - $sql .= ' limit '.$other['data'][2]; - } - - if($other['data'][3]){ - $sql .= ' offset '.$other['data'][3]; - } - - if($other['data'][5]){ - $sql .= ' and status = 0'; - } - - if(sizeof($other['data']) == 0){ - $sql = 'SELECT * from ttrap'; - } - - - $traps = db_get_all_rows_sql($sql); - - if($other['data'][6]){ - - foreach ($traps as $key => $value) { - - if(!strpos($value['oid_custom'],$other['data'][6]) && $other['data'][7] == 'false'){ - unset($traps[$key]); - } - - if(strpos($value['oid_custom'],$other['data'][6]) && $other['data'][7] == 'true'){ - unset($traps[$key]); - } - - } - - } - - $traps_json = json_encode($traps); - - if (count($traps) > 0 and $traps !== false) { - returnData('string', array('type' => 'string', 'data' => $traps_json)); - } - else { - return 0; - } - -} - -function api_set_validate_traps ($id, $thrash2, $other, $thrash3) { - - if (defined ('METACONSOLE')) { - return; - } - - if($id == 'all'){ - $result = db_process_sql_update('ttrap',array('status' => 1)); - } - else{ - $result = db_process_sql_update('ttrap', - array('status' => 1), array('id_trap' => $id)); - } - - if (is_error($result)) { - // TODO: Improve the error returning more info - returnError('error_update_trap', __('Error in trap update.')); - } - else { - returnData('string', - array('type' => 'string', - 'data' => __('Validated traps.'))); - } - } - - function api_set_delete_traps ($id, $thrash2, $other, $thrash3) { - - if (defined ('METACONSOLE')) { - return; - } - - if($id == 'all'){ - $result = db_process_sql ('delete from ttrap'); - } - else{ - $result = db_process_sql_delete('ttrap',array('id_trap' => $id)); - } - - if (is_error($result)) { - // TODO: Improve the error returning more info - returnError('error_delete_trap', __('Error in trap delete.')); - } - else { - returnData('string', - array('type' => 'string', - 'data' => __('Deleted traps.'))); - } - } ?> From e22d9e6d9bddda34b1ed4a9160c7862df3a73ead Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Tue, 18 Sep 2018 14:31:01 +0200 Subject: [PATCH 16/66] Fixed bug in custom macros help --- .../include/help/en/help_module_macros.php | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pandora_console/include/help/en/help_module_macros.php b/pandora_console/include/help/en/help_module_macros.php index 855da023e3..705b6f92e9 100644 --- a/pandora_console/include/help/en/help_module_macros.php +++ b/pandora_console/include/help/en/help_module_macros.php @@ -30,43 +30,43 @@ This macros can be used in module alerts.

-

Si el módulo es de tipo analisis de módulo web:

+

IF THE MODULE IS A WEB MODULE ANALYSIS TYPE:

- Las macros dinámicas tendrán un formato especial que empieza por @ y tendrán estas posibles sustituciones: +Dynamic macros will have a special format starting with @ and will have these possible substitutions:

  1. - @DATE_FORMAT (fecha/hora actual con formato definido por el usuario) + @DATE_FORMAT (current date/time with user-defined format)
  2. - @DATE_FORMAT_nh (horas) + @DATE_FORMAT_nh (hours)
  3. - @DATE_FORMAT_nm (minutos) + @DATE_FORMAT_nm (minutes)
  4. - @DATE_FORMAT_nd (días) + @DATE_FORMAT_nd (days)
  5. - @DATE_FORMAT_ns (segundos) + @DATE_FORMAT_ns (seconds)
  6. - @DATE_FORMAT_nM (mes) + @DATE_FORMAT_nM (month)
  7. - @DATE_FORMAT_nY (años) + @DATE_FORMAT_nY (years)

- Donde “n” puede ser un numero sin signo (positivo) o negativo. +Where "n" can be a number without a sign (positive) or negative.

- Y FORMAT sigue el standard de strftime de perl: +And FORMAT follows the standard of perl's strftime: http://search.cpan.org/~dexter/POSIX-strftime-GNU-0.02/lib/POSIX/strftime/GNU.pm

- Ejemplos: + Examples:

 	@DATE_%Y-%m-%d %H:%M:%S

From 3f046441f06afe590788d0693f6670ef70dfed58 Mon Sep 17 00:00:00 2001
From: alejandro-campos 
Date: Wed, 19 Sep 2018 10:06:57 +0200
Subject: [PATCH 17/66] Changed custom graph item insertion and deletion to fix
 bug when sorting elements in list

---
 pandora_console/godmode/reporting/graph_builder.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php
index 564c179f67..957720f59c 100644
--- a/pandora_console/godmode/reporting/graph_builder.php
+++ b/pandora_console/godmode/reporting/graph_builder.php
@@ -195,7 +195,8 @@ if ($add_module) {
 		"')");
 	
 		if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
-			$order = db_get_row_sql("SELECT `field_order` from tgraph_source ORDER BY `field_order` DESC");
+			$order = db_get_row_sql("SELECT `field_order` from tgraph_source WHERE id_graph=$id_graph ORDER BY `field_order` DESC");
+
 			$order = $order['field_order'];
 				foreach($id_agent_modules as $id_agent_module){
 					$order++;
@@ -207,8 +208,13 @@ if ($add_module) {
 }
 
 if ($delete_module) {
+	$id_graph = get_parameter('id');	
+		
 	$deleteGraph = get_parameter('delete');
+	$order_val = db_get_value('field_order', 'tgraph_source', 'id_gs', $deleteGraph);
 	$result = db_process_sql_delete('tgraph_source', array('id_gs' => $deleteGraph));
+	db_process_sql ('UPDATE tgraph_source SET field_order=field_order-1 WHERE id_graph='.$id_graph.' AND field_order>'.$order_val);
+
 }
 
 if ($change_weight) {

From e0e098a7a649eaca71bce55b6a377be2b603fb71 Mon Sep 17 00:00:00 2001
From: "tatiana.llorente@artica.es" 
Date: Wed, 19 Sep 2018 16:51:31 +0200
Subject: [PATCH 18/66] Added module name and agent name in actions enable and
 disable module - #2783

---
 .../godmode/agentes/configurar_agente.php        | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php
index b0999eb638..4fee505d10 100644
--- a/pandora_console/godmode/agentes/configurar_agente.php
+++ b/pandora_console/godmode/agentes/configurar_agente.php
@@ -1760,13 +1760,15 @@ if (!empty($duplicate_module)) { // DUPLICATE agent module !
 // =====================
 if ($enable_module) {
 	$result = modules_change_disabled($enable_module, 0);
-	
+	$modulo_nombre = db_get_row_sql("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = ".$enable_module."");	
+	$modulo_nombre = $modulo_nombre['nombre'];
+
 	if ($result === NOERR) {	
 		enterprise_hook('config_agents_enable_module_conf', array($id_agente, $enable_module));
-		db_pandora_audit("Module management", 'Enable  ' . $enable_module);
+		db_pandora_audit("Module management", 'Enable #' . $enable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
 	}
 	else {
-		db_pandora_audit("Module management", 'Fail to enable ' . $enable_module);
+		db_pandora_audit("Module management", 'Fail to enable #' . $enable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
 	}
 	
 	ui_print_result_message ($result,
@@ -1775,13 +1777,15 @@ if ($enable_module) {
 
 if ($disable_module) {
 	$result = modules_change_disabled($disable_module, 1);
-	
+	$modulo_nombre = db_get_row_sql("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = ".$disable_module."");
+	$modulo_nombre = $modulo_nombre['nombre'];
+
 	if ($result === NOERR) {
 		enterprise_hook('config_agents_disable_module_conf', array($id_agente, $disable_module));
-		db_pandora_audit("Module management", 'Disable  ' . $disable_module);
+		db_pandora_audit("Module management", 'Disable #' . $disable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
 	}
 	else {
-		db_pandora_audit("Module management", 'Fail to disable ' . $disable_module);
+		db_pandora_audit("Module management", 'Fail to disable #' . $disable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
 	}
 	
 	ui_print_result_message ($result,

From 00badd671a517394afd5e289046a2b05e0908f2b Mon Sep 17 00:00:00 2001
From: fermin831 
Date: Wed, 19 Sep 2018 18:39:19 +0200
Subject: [PATCH 19/66] Removed .empty from tarball and rpm

---
 pandora_agents/unix/collections/.empty        | 1 -
 pandora_agents/unix/pandora_agent.redhat.spec | 2 +-
 pandora_agents/unix/pandora_agent.spec        | 2 +-
 pandora_agents/unix/pandora_agent_installer   | 4 ++--
 pandora_agents/win32/bin/collections/.empty   | 0
 5 files changed, 4 insertions(+), 5 deletions(-)
 delete mode 100644 pandora_agents/unix/collections/.empty
 delete mode 100644 pandora_agents/win32/bin/collections/.empty

diff --git a/pandora_agents/unix/collections/.empty b/pandora_agents/unix/collections/.empty
deleted file mode 100644
index 8d1c8b69c3..0000000000
--- a/pandora_agents/unix/collections/.empty
+++ /dev/null
@@ -1 +0,0 @@
- 
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index 57317deecf..a8348b9632 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -95,7 +95,7 @@ if [ ! -e /etc/pandora/plugins ]; then
 fi
 
 if [ ! -e /etc/pandora/collections ]; then
-	ln -s /usr/share/pandora_agent/collections /etc/pandora
+	mkdir -p /etc/pandora/collections
 fi
 
 mkdir -p /var/spool/pandora/data_out
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index 04574d3e25..f2a5d5757d 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -88,7 +88,7 @@ if [ ! -e /etc/pandora/plugins ]; then
 fi
 
 if [ ! -e /etc/pandora/collections ]; then
-	ln -s /usr/share/pandora_agent/collections /etc/pandora
+	mkdir /etc/pandora/collections
 fi
 cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent
 
diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer
index 5cb84bc1fb..504eaecbf8 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -388,8 +388,8 @@ install () {
 
 	ln -s $PANDORA_BASE_REAL$PANDORA_HOME/plugins $PANDORA_BASE$PANDORA_CFG
 
-	echo "Copying Pandora FMS Agent collections to $PANDORA_BASE$PANDORA_HOME/collections..."
-	cp -r collections $PANDORA_BASE$PANDORA_HOME
+	echo "Creating the collections directory in to $PANDORA_BASE$PANDORA_HOME/collections..."
+	mkdir -p $PANDORA_BASE$PANDORA_HOME/collections
 	chmod -R 700 $PANDORA_BASE$PANDORA_HOME/collections
 	ln -s $PANDORA_BASE_REAL$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG
 	
diff --git a/pandora_agents/win32/bin/collections/.empty b/pandora_agents/win32/bin/collections/.empty
deleted file mode 100644
index e69de29bb2..0000000000

From bc38468e6cb3fbf38fb4ccead858018c82b3a489 Mon Sep 17 00:00:00 2001
From: "tatiana.llorente@artica.es" 
Date: Thu, 20 Sep 2018 11:50:47 +0200
Subject: [PATCH 20/66] Fixed borders of tables with classes databox and data -
 #2768

---
 pandora_console/include/styles/pandora.css | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index 8cdfa3a9e7..b580b90cfc 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -1393,6 +1393,37 @@ table.databox {
 	color: #222 !important;
 }
 
+.databox.data>tbody>tr>td:first-child{
+    border-left: 1px solid #e2e2e2;
+}
+
+.databox.data>tbody>tr:last-child>td:first-child{
+    border-bottom-left-radius: 4px;
+}
+
+.databox.data>tbody>tr>td:last-child {
+    border-right: 1px solid #e2e2e2;
+}
+
+.databox.data>tbody>tr:last-child >td:last-child {
+    border-bottom-right-radius: 4px;
+}
+
+.databox.data>thead>tr>th:first-child {
+    border-left: 1px solid #e2e2e2;
+    border-top-left-radius: 4px;
+    border-color: #373737;
+}
+
+.databox.data>thead>tr>th:last-child {
+    border-right: 1px solid #e2e2e2;
+    border-top-right-radius: 4px;
+    border-color: #373737;
+}
+.databox.data{
+	border: none;
+}
+
 .tabletitle {
 	color: #333;
 }

From e49c0e3ae74bf169c99a6eaef5354f5eb92409f4 Mon Sep 17 00:00:00 2001
From: "tatiana.llorente@artica.es" 
Date: Thu, 20 Sep 2018 12:18:31 +0200
Subject: [PATCH 21/66] Fixed a minor mistake in thead - #2768

---
 pandora_console/include/styles/pandora.css | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index b580b90cfc..1a1c9b513f 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -1409,13 +1409,13 @@ table.databox {
     border-bottom-right-radius: 4px;
 }
 
-.databox.data>thead>tr>th:first-child {
+.databox.data>thead>tr:first-child>th:first-child {
     border-left: 1px solid #e2e2e2;
     border-top-left-radius: 4px;
     border-color: #373737;
 }
 
-.databox.data>thead>tr>th:last-child {
+.databox.data>thead>tr:first-child>th:last-child {
     border-right: 1px solid #e2e2e2;
     border-top-right-radius: 4px;
     border-color: #373737;

From b66f3a9f6f9b7189ce91df6821f392dec31bf19d Mon Sep 17 00:00:00 2001
From: samucarc 
Date: Thu, 20 Sep 2018 19:18:45 +0200
Subject: [PATCH 22/66] Fixed SQL graphs in reports

---
 pandora_console/include/chart_generator.php |  52 ++++++++++
 pandora_console/include/functions_graph.php |  13 ++-
 pandora_console/include/graphs/fgraph.php   | 102 ++++++++------------
 3 files changed, 100 insertions(+), 67 deletions(-)

diff --git a/pandora_console/include/chart_generator.php b/pandora_console/include/chart_generator.php
index f23107f39c..beeec9ed5c 100644
--- a/pandora_console/include/chart_generator.php
+++ b/pandora_console/include/chart_generator.php
@@ -126,6 +126,58 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
 				echo grafico_modulo_sparse($params);
 			echo '';
 		}
+    elseif($type_graph_pdf == 'hbar'){
+      echo '
'; + echo hbar_graph( + $params['flash_chart'], + $params['chart_data'], + $params['width'], + $params['height'], + $params['color'], + $params['legend'], + $params['long_index'], + $params['no_data_image'], + $params['xaxisname'], + $params['yaxisname'], + $params['water_mark'], + $params['font'], + $params['font_size'], + $params['unit'], + $params['ttl'], + $params['homeurl'], + $params['backgroundColor'], + $params['tick_color'], + $params['val_min'], + $params['val_max'] + ); + echo '
'; + } + elseif($type_graph_pdf == 'vbar'){ + echo '
'; + echo vbar_graph( + $params['flash_chart'], + $params['chart_data'], + $params['width'], + $params['height'], + $params['color'], + $params['legend'], + $params['long_index'], + $params['no_data_image'], + $params['xaxisname'], + $params['yaxisname'], + $params['water_mark'], + $params['font'], + $params['font_size'], + $params['unit'], + $params['ttl'], + $params['homeurl'], + $params['backgroundColor'], + $params['from_ux'], + $params['from_wux'], + $params['tick_color'] + ); + echo '
'; + } $config['font_size'] = $aux_font_size; ?> diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index e8fa13df9f..a88b6bd535 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -3726,10 +3726,9 @@ function graph_custom_sql_graph ($id, $width, $height, } } } - - $flash_charts = $config['flash_charts']; - - if ($only_image) { + + $flash_charts = true; + if ($ttl == 2) { $flash_charts = false; } @@ -3759,9 +3758,9 @@ function graph_custom_sql_graph ($id, $width, $height, $ttl, $homeurl, "white", + true, false, - false, - "c1c1c1" + "#c1c1c1" ); break; case 'sql_graph_hbar': // horizontal bar @@ -3783,7 +3782,7 @@ function graph_custom_sql_graph ($id, $width, $height, $ttl, $homeurl, 'white', - 'c1c1c1' + '#c1c1c1' ); break; case 'sql_graph_pie': // Pie diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index eb638f2c2a..be9a2bce23 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -187,35 +187,27 @@ function vbar_graph( $tick_color); } else { - $new_chart_data = array(); - foreach ($chart_data as $key => $value) { - if(strlen($key) > 20 && strpos($key, ' - ') !== false){ - $key_temp = explode(" - ",$key); - $key_temp[0] = $key_temp[0]." \n"; - $key_temp[1]= '...'.substr($key_temp[1],-15); - $key2 = $key_temp[0].$key_temp[1]; - io_safe_output($key2); - $new_chart_data[$key2]['g'] = $chart_data[$key]['g']; - } else { - $new_chart_data[$key] = $value; - } - } - - $graph = array(); - $graph['data'] = $new_chart_data; - $graph['width'] = $width; - $graph['height'] = $height; - $graph['color'] = $color; - $graph['legend'] = $legend; - $graph['xaxisname'] = $xaxisname; - $graph['yaxisname'] = $yaxisname; - $graph['water_mark'] = $water_mark_file; - $graph['font'] = $font; - $graph['font_size'] = $font_size; - - $id_graph = serialize_in_temp($graph, null, $ttl); - - return ""; + $params['flash_chart'] = true; + $params['chart_data'] = $chart_data; + $params['width'] = $width; + $params['height'] = $height; + $params['color'] = $color; + $params['legend'] = $legend; + $params['long_index'] = $long_index; + $params['no_data_image'] = $no_data_image; + $params['xaxisname'] = $xaxisname; + $params['yaxisname'] = $yaxisname; + $params['water_mark'] = $water_mark; + $params['font'] = $font; + $params['font_size'] = $font_size; + $params['unit'] = $unit; + $params['ttl'] = 2; + $params['homeurl'] = $homeurl; + $params['backgroundColor'] = $backgroundColor; + $params['from_ux'] = $from_ux; + $params['from_wux'] = $from_wux; + $params['tick_color'] = $tick_color; + return generator_chart_to_pdf('vbar', $params); } } @@ -312,37 +304,27 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, $chart_data, $width, $height, $water_mark_url, $font, $font_size, $backgroundColor, $tick_color, $val_min, $val_max); } else { - foreach ($chart_data as $key => $value) { - $str_key = io_safe_output($key); - if(strlen($str_key) > 40){ - if(strpos($str_key, ' - ') != -1){ - $key_temp = explode(" - ",$str_key); - $key_temp[0] = $key_temp[0]."
"; - $key_temp[1]= '...'.substr($key_temp[1],-20); - $key2 = $key_temp[0].$key_temp[1]; - } - $chart_data[$key2]['g'] = $chart_data[$key]['g']; - unset($chart_data[$key]); - } - } - - $graph = array(); - $graph['data'] = $chart_data; - $graph['width'] = $width; - $graph['height'] = $height; - $graph['color'] = $color; - $graph['legend'] = $legend; - $graph['xaxisname'] = $xaxisname; - $graph['yaxisname'] = $yaxisname; - $graph['force_height'] = $force_height; - $graph['water_mark'] = $water_mark_file; - $graph['font'] = $font; - $graph['font_size'] = $font_size; - $graph['force_steps'] = $force_steps; - - $id_graph = serialize_in_temp($graph, null, $ttl); - - return ""; + $params['flash_chart'] = true; + $params['chart_data'] = $chart_data; + $params['width'] = $width; + $params['height'] = $height; + $params['color'] = $color; + $params['legend'] = $legend; + $params['long_index'] = $long_index; + $params['no_data_image'] = $no_data_image; + $params['xaxisname'] = $xaxisname; + $params['yaxisname'] = $yaxisname; + $params['water_mark'] = $water_mark; + $params['font'] = $font; + $params['font_size'] = $font_size; + $params['unit'] = $unit; + $params['ttl'] = 2; + $params['homeurl'] = $homeurl; + $params['backgroundColor'] = $backgroundColor; + $params['tick_color'] = $tick_color; + $params['val_min'] = $val_min; + $params['val_max'] = $val_max; + return generator_chart_to_pdf('hbar', $params); } } From 51af767549b9d8c202cec42fcaa2d434d5953b9c Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Fri, 21 Sep 2018 09:21:21 +0200 Subject: [PATCH 23/66] Limited number of characters shown in the table - #2783 --- pandora_console/general/logon_ok.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index c2ecec56da..1c720b6373 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -274,7 +274,12 @@ if (!empty($all_data)) { . human_time_comparation($session['utimestamp'], 'tiny'); $data[3] = $session_ip_origen; $description = str_replace(array(',', ', '), ', ', $session['descripcion']); - $data[4] = '
' . io_safe_output($description) . '
'; + if(strlen($description)>100){ + $data[4] = '
' . io_safe_output(substr($description, 0, 150).'...') . '
'; + } + else{ + $data[4] = '
' . io_safe_output($description) . '
'; + } array_push ($table->data, $data); } From a5a92519aa52f29559fb689506f5d4bbbcfa4b76 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Fri, 21 Sep 2018 10:07:01 +0200 Subject: [PATCH 24/66] Fixed bug: bad link in meta tree view's agent data, using relative path --- pandora_console/include/functions_treeview.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index 20d1f577bc..81701e02e2 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -522,7 +522,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals $hashdata = $user.$pwd_deserialiced['auth_token']; $hashdata = md5($hashdata); - $url = $server_data["server_url"] . "/index.php?" . + $url = "//" . $server_data["server_url"] . "index.php?" . "sec=estado&" . "sec2=operation/agentes/ver_agente&" . "id_agente=" . $agent["id_agente"] . "&" . From 1f801d5a3a83cc2b7653866ddb6a6e307f7d3d51 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Fri, 21 Sep 2018 10:14:21 +0200 Subject: [PATCH 25/66] fixed bug: bad link in meta tree view's agent data, go to agent edition button using relative path --- pandora_console/include/functions_treeview.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index 81701e02e2..e9b64c15f5 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -522,7 +522,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals $hashdata = $user.$pwd_deserialiced['auth_token']; $hashdata = md5($hashdata); - $url = "//" . $server_data["server_url"] . "index.php?" . + $url = "//" . $server_data["server_url"] . "/index.php?" . "sec=estado&" . "sec2=operation/agentes/ver_agente&" . "id_agente=" . $agent["id_agente"] . "&" . @@ -608,7 +608,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals $go_to_agent = '
'; if($agent["id_os"] != 100){ - $go_to_agent .= ''; + $go_to_agent .= ''; $go_to_agent .= html_print_submit_button (__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true); } else{ From 028cca0d66b4d519d3b614516fd87175b0b7ca64 Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Fri, 21 Sep 2018 12:59:15 +0200 Subject: [PATCH 26/66] Changed colors for buttons - #2726 --- pandora_console/include/functions_visual_map_editor.php | 6 +++--- pandora_console/include/styles/pandora.css | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index a20a8c5e42..f3047ce561 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -478,20 +478,20 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['background_row_2']['items'] = array('background', 'datos'); $form_items['background_row_2']['html'] = '' . __('Original Size') . ' - ' . html_print_button(__('Apply'), 'original_false', false, "setAspectRatioBackground('original')", 'class="sub"', true) . ''; + ' . html_print_button(__('Apply'), 'original_false', false, "setAspectRatioBackground('original')", 'class="sub vs_button_ghost"', true) . ''; $form_items['background_row_3'] = array(); $form_items['background_row_3']['items'] = array('background', 'datos'); $form_items['background_row_3']['html'] = '' . __('Aspect ratio') . ' - ' . html_print_button(__('Width proportional'), 'original_false', false, "setAspectRatioBackground('width')", 'class="sub"', true) . ''; + ' . html_print_button(__('Proportional Width'), 'original_false', false, "setAspectRatioBackground('width')", 'class="sub vs_button_ghost"', true) . ''; $form_items['background_row_4'] = array(); $form_items['background_row_4']['items'] = array('background', 'datos'); $form_items['background_row_4']['html'] = ' - ' . html_print_button(__('Height proportional'), 'original_false', false, "setAspectRatioBackground('height')", 'class="sub"', true) . ''; + ' . html_print_button(__('Height proportional'), 'original_false', false, "setAspectRatioBackground('height')", 'class="sub vs_button_ghost"', true) . ''; $form_items['percentile_bar_row_1'] = array(); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 8cdfa3a9e7..eb7567393e 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -653,6 +653,15 @@ input.sub[disabled] { cursor: default; } +input.vs_button_ghost{ + background-color: transparent !important; + border: 1px solid #82b92e; + color: #82b92e !important; + text-align: center; + padding: 4px 12px; + font-weight: bold; +} + input.next, input.upd, input.ok, input.wand, input.delete, input.cog, input.target, input.search, input.copy, input.add, input.graph, input.percentile, input.binary, input.camera, input.config, From e59c40d687dcd48b28d9951c135468c051ad2b78 Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Mon, 24 Sep 2018 14:01:17 +0200 Subject: [PATCH 27/66] Fixed bug in events replication --- pandora_console/include/functions_events.php | 9 +- pandora_console/install.php | 983 ------------------- 2 files changed, 5 insertions(+), 987 deletions(-) delete mode 100755 pandora_console/install.php diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index f6b6da21cc..c6b5a78eee 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -2706,13 +2706,14 @@ function events_page_comments ($event, $childrens_ids = array()) { } break; } - - if ((tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids))) { - $comments_form = '
'.html_print_textarea("comment", 3, 10, '', 'style="min-height: 15px; width: 100%;"', true); + + if (((tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids))) && $config["show_events_in_local"] == false || $config["event_replication"] == false) { + $comments_form = '
'.html_print_textarea("comment", 3, 10, '', 'style="min-height: 15px; width: 100%; disabled"', true); + $comments_form .= '
'.html_print_button(__('Add comment'),'comment_button',false,'event_comment();','class="sub next"',true).'

'; } else { - $comments_form = ''; + $comments_form = ui_print_message(__( 'If event replication is ongoing, it won\'t be possible to enter comments here. This option is only to allow local pandora users to see comments, but not to operate with them. The operation, when event replication is enabled, must be done only in the Metaconsole.')); } $comments = '
'.$comments_form.html_print_table($table_comments, true).'
'; diff --git a/pandora_console/install.php b/pandora_console/install.php deleted file mode 100755 index d9160ee127..0000000000 --- a/pandora_console/install.php +++ /dev/null @@ -1,983 +0,0 @@ - - - - - Pandora FMS - Installation Wizard - - - - - - - - - - - - - -
- -
- - - -"; - echo " $label "; - echo ""; - if (!extension_loaded($ext)) { - echo ""; - return 1; - } - else { - echo ""; - return 0; - } - echo ""; -} - -function check_include ( $ext, $label ) { - echo ""; - echo " $label "; - echo ""; - if (!include($ext)) { - echo ""; - return 1; - } - else { - echo ""; - return 0; - } - echo ""; -} - -function check_exists ( $file, $label ) { - echo ""; - echo " $label "; - echo ""; - if (!file_exists ($file)) { - echo " "; - return 1; - } - else { - echo " "; - return 0; - } - echo ""; -} - -function check_generic ( $ok, $label ) { - echo ""; - if ($ok == 0 ) { - echo " "; - echo ""; - echo " $label "; - echo ""; - echo ""; - return 1; - } - else { - echo " "; - echo ""; - echo " $label "; - echo ""; - echo ""; - return 0; - } -} - -function check_writable ( $fullpath, $label ) { - echo ""; - if (file_exists($fullpath)) - if (is_writable($fullpath)) { - echo " "; - echo ""; - echo " $label "; - echo ""; - echo ""; - return 0; - } - else { - echo " "; - echo ""; - echo " $label "; - echo ""; - echo ""; - return 1; - } - else { - echo " "; - echo ""; - echo " $label "; - echo ""; - echo ""; - return 1; - } -} - -function check_variable ( $var, $value, $label, $mode ) { - echo ""; - echo " $label "; - echo ""; - if ($mode == 1) { - if ($var >= $value) { - echo " "; - return 0; - } - else { - echo " "; - return 1; - } - } - elseif ($var == $value) { - echo " "; - return 0; - } - else { - echo " "; - return 1; - } - echo ""; -} - -function parse_mysql_dump($url) { - if (file_exists($url)) { - $file_content = file($url); - $query = ""; - foreach($file_content as $sql_line) { - if (trim($sql_line) != "" && strpos($sql_line, "-- ") === false) { - $query .= $sql_line; - if(preg_match("/;[\040]*\$/", $sql_line)) { - if (!$result = mysql_query($query)) { - echo mysql_error(); //Uncomment for debug - echo "
$query
"; - return 0; - } - $query = ""; - } - } - } - return 1; - } - else - return 0; -} - -function parse_mysqli_dump($connection, $url) { - if (file_exists($url)) { - $file_content = file($url); - $query = ""; - foreach($file_content as $sql_line) { - if (trim($sql_line) != "" && strpos($sql_line, "-- ") === false) { - $query .= $sql_line; - if(preg_match("/;[\040]*\$/", $sql_line)) { - if (!$result = mysqli_query($connection, $query)) { - echo mysqli_error(); //Uncomment for debug - echo "
$query
"; - return 0; - } - $query = ""; - } - } - } - return 1; - } - else - return 0; -} - -function random_name ($size) { - $temp = ""; - for ($a=0;$a< $size;$a++) - $temp = $temp. chr(rand(122,97)); - - return $temp; -} - -function print_logo_status ($step, $step_total) { - global $banner; - - $header = " -
-
-
- $banner -
-
"; - $header .= " -
- Install step $step of $step_total -
"; - - return $header; -} - -// -// This function adjusts path settings in pandora db for FreeBSD. -// -// All packages and configuration files except operating system's base files -// are installed under /usr/local in FreeBSD. So, path settings in pandora db -// for some programs should be changed from the Linux default. -// -function adjust_paths_for_freebsd($engine, $connection = false) { - - $adjust_sql = array( - "update trecon_script set script = REPLACE(script,'/usr/share','/usr/local/share');", - "update tconfig set value = REPLACE(value,'/usr/bin','/usr/local/bin') where token='netflow_daemon' OR token='netflow_nfdump' OR token='netflow_nfexpire';", - "update talert_commands set command = REPLACE(command,'/usr/bin','/usr/local/bin');", - "update talert_commands set command = REPLACE(command,'/usr/share', '/usr/local/share');", - "update tplugin set execute = REPLACE(execute,'/usr/share','/usr/local/share');", - "update tevent_response set target = REPLACE(target,'/usr/share','/usr/local/share');", - "insert into tconfig (token, value) VALUES ('graphviz_bin_dir', '/usr/local/bin');" - ); - - for ($i = 0; $i < count ($adjust_sql); $i++) { - switch ($engine) { - case 'mysql': - $result = mysql_query($adjust_sql[$i]); - break; - case 'mysqli': - $result = mysqli_query($connection, $adjust_sql[$i]); - break; - case 'oracle': - //Delete the last semicolon from current query - $query = substr($adjust_sql[$i], 0, strlen($adjust_sql[$i]) - 1); - $sql = oci_parse($connection, $query); - $result = oci_execute($sql); - break; - case 'pgsql': - pg_send_query($connection, $adjust_sql[$i]); - $result = pg_get_result($connection); - break; - } - if (!$result) { - return 0; - } - } - - return 1; -} - -function install_step1() { - global $banner; - - echo " -
"; -} - -function install_step1_licence() { - echo " -
-
- " . print_logo_status (2,6) . " -
-

GPL2 Licence terms agreement

-

Pandora FMS is an OpenSource software project licensed under the GPL2 licence. Pandora FMS includes, as well, another software also licensed under LGPL and BSD licenses. Before continue, you must accept the licence terms.. -

For more information, please refer to our website at http://pandorafms.org and contact us if you have any kind of question about the usage of Pandora FMS

-

If you dont accept the licence terms, please, close your browser and delete Pandora FMS files.

- "; - - if (!file_exists("COPYING")) { - echo "
Licence file 'COPYING' is not present in your distribution. This means you have some 'partial' Pandora FMS distribution. We cannot continue without accepting the licence file."; - echo "
"; - } - else { - echo "
"; - echo ""; - echo "

"; - echo "

"; - } - echo "
"; - - echo "
-
-
- Pandora FMS is an OpenSource Software project registered at - SourceForge -
-
"; -} - -function install_step2() { - - echo " -
-
- " . print_logo_status (3,6) . " -
"; - echo "

Checking software dependencies

"; - echo ""; - $res = 0; - $res += check_variable(phpversion(),"5.2","PHP version >= 5.2",1); - $res += check_extension("gd","PHP GD extension"); - $res += check_extension("ldap","PHP LDAP extension"); - $res += check_extension("snmp","PHP SNMP extension"); - $res += check_extension("session","PHP session extension"); - $res += check_extension("gettext","PHP gettext extension"); - $res += check_extension("mbstring","PHP Multibyte String"); - $res += check_extension("zip","PHP Zip"); - $res += check_extension("zlib","PHP Zlib extension"); - $res += check_extension("json","PHP json extension"); - $res += check_extension("curl","CURL (Client URL Library)"); - $res += check_extension("filter","PHP filter extension"); - $res += check_extension("calendar","PHP calendar extension"); - if (PHP_OS == "FreeBSD") { - $res += check_exists ("/usr/local/bin/twopi","Graphviz Binary"); - } - else if (PHP_OS == "NetBSD") { - $res += check_exists ("/usr/pkg/bin/twopi","Graphviz Binary"); - } - else if ( substr(PHP_OS, 0, 3) == 'WIN' ) { - $res += check_exists ("..\\..\\..\\Graphviz\\bin\\twopi.exe", "Graphviz Binary"); - } - else { - $res += check_exists ("/usr/bin/twopi","Graphviz Binary"); - } - - echo ""; - check_extension("mysql", "PHP MySQL extension"); - check_extension("mysqli", "PHP MySQL(mysqli) extension"); - echo "
"; - echo "DB Engines"; - echo ""; - echo "
"; - - if ($res > 0) { - echo " -
You have some incomplete - dependencies. Please correct them or this installer - will not be able to finish your installation. -
-
- Remember, if you install any PHP module to comply - with these dependences, you need to restart - your HTTP/Apache server after it to use the new - modules. -
-
- Ignore it. -
"; - } - else { - echo "
"; - echo " - "; - echo "
"; - } - echo "
"; - echo "
"; - echo " -
-
-
-
- Pandora FMS is an OpenSource Software project registered at - SourceForge -
-
"; -} - - -function install_step3() { - $options = ''; - if (extension_loaded("mysql")) { - $options .= ""; - } - if (extension_loaded("mysqli")) { - $options .= ""; - } - - $error = false; - if (empty($options)) { - $error = true; - } - - echo " -
-
- " . print_logo_status (4,6) . " -
-

Environment and database setup

-

- This wizard will create your Pandora FMS database, - and populate it with all the data needed to run for the first time. -

-

- You need a privileged user to create database schema, this is usually root user. - Information about root user will not be used or stored anymore. -

-

- You can also deploy the scheme into an existing Database. - In this case you need a privileged Database user and password of that instance. -

-

- Now, please, complete all details to configure your database and environment setup. -

-
- Warning: This installer will overwrite and destroy your existing - Pandora FMS configuration and Database. Before continue, - please be sure that you have no valuable Pandora FMS data in your Database. -

-
"; - - if (extension_loaded("oci8")) { - echo "
For Oracle installation an existing Database with a privileged user is needed.
"; - } - if (!$error) { - echo ""; - } - - echo ""; - echo ""; - - // the field dbgrant is only shown when the DB host is different from 127.0.0.1 or localhost - echo " - - "; - - - echo " "; - - echo ""; - if ($_SERVER['SERVER_ADDR'] == 'localhost' || $_SERVER['SERVER_ADDR'] == '127.0.0.1') { - echo "
"; - echo "DB Engine
"; - - - if ($error) { - echo " -
- Warning: You haven't a any DB engine with PHP. Please check the previous step to DB engine dependencies. -
"; - } - else { - echo ""; - - echo "
"; - echo " Installation in
"; - echo ""; - } - echo "
DB User with privileges
- - -
DB Password for this user
- - -
DB Hostname
- - -
DB Name (pandora by default)
- - -
Drop Database if exists
- -
Full path to HTTP publication directory
- For example /var/www/pandora_console/ -
- - -
- Drop Database if exists
- - "; - } else { - echo "
"; - } - echo "URL path to Pandora FMS Console
- For example '/pandora_console' -
- -
- "; - - if (!$error) { - echo "
"; - echo " - "; - echo "
"; - } - - echo "
"; - - echo ""; - - echo "
"; - echo "
-
- Pandora FMS is an OpenSource Software project registered at - SourceForge -
-
"; -} - -function install_step4() { - $pandora_config = "include/config.php"; - - if ( (! isset($_POST["user"])) || (! isset($_POST["dbname"])) || (! isset($_POST["host"])) || - (! isset($_POST["pass"])) || (!isset($_POST['engine'])) || (! isset($_POST["db_action"])) ) { - $dbpassword = ""; - $dbuser = ""; - $dbhost = ""; - $dbname = ""; - $engine = ""; - $dbaction = ""; - $dbgrant = ""; - } - else { - $engine = $_POST['engine']; - $dbpassword = $_POST["pass"]; - $dbuser = $_POST["user"]; - $dbhost = $_POST["host"]; - $dbaction = $_POST["db_action"]; - if (isset($_POST["dbgrant"]) && $_POST["dbgrant"] != "") - $dbgrant = $_POST["dbgrant"]; - else - $dbgrant = $_SERVER["SERVER_ADDR"]; - if (isset($_POST["drop"])) - $dbdrop = $_POST["drop"]; - else - $dbdrop = 0; - - $dbname = $_POST["dbname"]; - if (isset($_POST["url"])) - $url = $_POST["url"]; - else - $url = "http://localhost"; - if (isset($_POST["path"])) { - $path = $_POST["path"]; - $path = str_replace("\\", "/", $path); // Windows compatibility - } - else - $path = "/var/www"; - } - $everything_ok = 0; - $step1=0; - $step2=0; - $step3=0; - $step4=0; $step5=0; $step6=0; $step7=0; - - echo " -
-
- " . print_logo_status(5,6) . " -
-

Creating database and default configuration file

- "; - switch ($engine) { - case 'mysql': - if (! mysql_connect ($dbhost, $dbuser, $dbpassword)) { - check_generic ( 0, "Connection with Database"); - } - else { - check_generic ( 1, "Connection with Database"); - - // Drop database if needed and don't want to install over an existing DB - if ($dbdrop == 1) { - mysql_query ("DROP DATABASE IF EXISTS `$dbname`"); - } - - // Create schema - if ($dbaction == 'db_new' || $dbdrop == 1) { - $step1 = mysql_query ("CREATE DATABASE `$dbname`"); - check_generic ($step1, "Creating database '$dbname'"); - } - else { - $step1 = 1; - } - if ($step1 == 1) { - $step2 = mysql_select_db($dbname); - check_generic ($step2, "Opening database '$dbname'"); - - $step3 = parse_mysql_dump("pandoradb.sql"); - check_generic ($step3, "Creating schema"); - - $step4 = parse_mysql_dump("pandoradb_data.sql"); - check_generic ($step4, "Populating database"); - if (PHP_OS == "FreeBSD") { - $step_freebsd = adjust_paths_for_freebsd ($engine); - check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD"); - } - - $random_password = random_name (8); - $host = $dbhost; // set default granted origin to the origin of the queries - if (($dbhost != 'localhost') && ($dbhost != '127.0.0.1')) - $host = $dbgrant; // if the granted origin is different from local machine, set the valid origin - $step5 = mysql_query ("GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host - IDENTIFIED BY '".$random_password."'"); - mysql_query ("FLUSH PRIVILEGES"); - check_generic ($step5, "Established privileges for user pandora. A new random password has been generated: $random_password
Please write it down, you will need to setup your Pandora FMS server, editing the /etc/pandora/pandora_server.conf file
"); - - $step6 = is_writable("include"); - check_generic ($step6, "Write permissions to save config file in './include'"); - - $cfgin = fopen ("include/config.inc.php","r"); - $cfgout = fopen ($pandora_config,"w"); - $config_contents = fread ($cfgin, filesize("include/config.inc.php")); - $dbtype = 'mysql'; - $config_new = ''; - $step7 = fputs ($cfgout, $config_new); - $step7 = $step7 + fputs ($cfgout, $config_contents); - if ($step7 > 0) - $step7 = 1; - fclose ($cfgin); - fclose ($cfgout); - chmod ($pandora_config, 0600); - check_generic ($step7, "Created new config file at '".$pandora_config."'"); - } - } - - if (($step7 + $step6 + $step5 + $step4 + $step3 + $step2 + $step1) == 7) { - $everything_ok = 1; - } - break; - case 'mysqli': - $connection = mysqli_connect ($dbhost, $dbuser, $dbpassword); - if (mysqli_connect_error() > 0) { - check_generic ( 0, "Connection with Database"); - } - else { - check_generic ( 1, "Connection with Database"); - - // Drop database if needed and don't want to install over an existing DB - if ($dbdrop == 1) { - mysqli_query ($connection, "DROP DATABASE IF EXISTS `$dbname`"); - } - - // Create schema - if ($dbaction == 'db_new' || $dbdrop == 1) { - $step1 = mysqli_query ($connection, "CREATE DATABASE `$dbname`"); - check_generic ($step1, "Creating database '$dbname'"); - } - else { - $step1 = 1; - } - if ($step1 == 1) { - $step2 = mysqli_select_db($connection, $dbname); - check_generic ($step2, "Opening database '$dbname'"); - - $step3 = parse_mysqli_dump($connection, "pandoradb.sql"); - check_generic ($step3, "Creating schema"); - - $step4 = parse_mysqli_dump($connection, "pandoradb_data.sql"); - check_generic ($step4, "Populating database"); - if (PHP_OS == "FreeBSD") { - $step_freebsd = adjust_paths_for_freebsd ($engine, $connection); - check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD"); - } - - $random_password = random_name (8); - $host = $dbhost; // set default granted origin to the origin of the queries - if (($dbhost != 'localhost') && ($dbhost != '127.0.0.1')) - $host = $dbgrant; // if the granted origin is different from local machine, set the valid origin - $step5 = mysqli_query ($connection, "GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host - IDENTIFIED BY '".$random_password."'"); - mysqli_query ($connection, "FLUSH PRIVILEGES"); - check_generic ($step5, "Established privileges for user pandora. A new random password has been generated: $random_password
Please write it down, you will need to setup your Pandora FMS server, editing the /etc/pandora/pandora_server.conf file
"); - - $step6 = is_writable("include"); - check_generic ($step6, "Write permissions to save config file in './include'"); - - $cfgin = fopen ("include/config.inc.php","r"); - $cfgout = fopen ($pandora_config,"w"); - $config_contents = fread ($cfgin, filesize("include/config.inc.php")); - $dbtype = 'mysql'; - $config_new = ''; - $step7 = fputs ($cfgout, $config_new); - $step7 = $step7 + fputs ($cfgout, $config_contents); - if ($step7 > 0) - $step7 = 1; - fclose ($cfgin); - fclose ($cfgout); - chmod ($pandora_config, 0600); - check_generic ($step7, "Created new config file at '".$pandora_config."'"); - } - } - - if (($step7 + $step6 + $step5 + $step4 + $step3 + $step2 + $step1) == 7) { - $everything_ok = 1; - } - break; - } - echo "
"; - - if ($everything_ok == 1) { - echo "
"; - echo " - "; - echo "
"; - } - else { - $info = "
There were some problems. - Installation was not completed. -

Please correct failures before trying again. - All database "; - if ($engine == 'oracle') - $info .= "objects "; - else - $info .= "schemes "; - - $info .= "created in this step have been dropped.

-
"; - echo $info; - - switch ($engine) { - case 'mysql': - if (mysql_error() != "") { - echo "
ERROR: ". mysql_error().".
"; - } - - if ($step1 == 1) { - mysql_query ("DROP DATABASE $dbname"); - } - break; - case 'mysqli': - if (mysqli_error($connection) != "") { - echo "
ERROR: ". mysqli_error($connection).".
"; - } - - if ($step1 == 1) { - mysqli_query ($connection, "DROP DATABASE $dbname"); - } - break; - } - echo "
"; - } - echo "
"; - echo "
"; - echo " -
-
- Pandora FMS is an Open Source Software project registered at - SourceForge -
-
"; -} - - -function install_step5() { - echo " -
-
- " . print_logo_status (6,6) . " -
-

Installation complete

-

For security, you now must manually delete this installer - ('install.php') file before trying to access to your Pandora FMS console. -

You should also install Pandora FMS Servers before trying to monitor anything; - please read documentation on how to install it.

-

Default user is 'admin' with password 'pandora', - please change it both as soon as possible.

-

Don't forget to check http://pandorafms.com - for updates. -

Select if you want to rename 'install.php'.

-
- - -
-


. -

-
"; - - echo "
-
- Pandora FMS is an OpenSource Software project registered at - SourceForge -
-
"; -} -?> From 9a5675438484ebdbfecad9d5967221422b774f30 Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Tue, 25 Sep 2018 11:59:37 +0200 Subject: [PATCH 28/66] Revert "Fixed bug in events replication" This reverts commit e59c40d687dcd48b28d9951c135468c051ad2b78. --- pandora_console/include/functions_events.php | 9 +- pandora_console/install.php | 983 +++++++++++++++++++ 2 files changed, 987 insertions(+), 5 deletions(-) create mode 100755 pandora_console/install.php diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index c6b5a78eee..f6b6da21cc 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -2706,14 +2706,13 @@ function events_page_comments ($event, $childrens_ids = array()) { } break; } - - if (((tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids))) && $config["show_events_in_local"] == false || $config["event_replication"] == false) { - $comments_form = '
'.html_print_textarea("comment", 3, 10, '', 'style="min-height: 15px; width: 100%; disabled"', true); - + + if ((tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids))) { + $comments_form = '
'.html_print_textarea("comment", 3, 10, '', 'style="min-height: 15px; width: 100%;"', true); $comments_form .= '
'.html_print_button(__('Add comment'),'comment_button',false,'event_comment();','class="sub next"',true).'

'; } else { - $comments_form = ui_print_message(__( 'If event replication is ongoing, it won\'t be possible to enter comments here. This option is only to allow local pandora users to see comments, but not to operate with them. The operation, when event replication is enabled, must be done only in the Metaconsole.')); + $comments_form = ''; } $comments = '
'.$comments_form.html_print_table($table_comments, true).'
'; diff --git a/pandora_console/install.php b/pandora_console/install.php new file mode 100755 index 0000000000..d9160ee127 --- /dev/null +++ b/pandora_console/install.php @@ -0,0 +1,983 @@ + + + + + Pandora FMS - Installation Wizard + + + + + + + + + + + + + +
+ +
+ + + +"; + echo " $label "; + echo ""; + if (!extension_loaded($ext)) { + echo ""; + return 1; + } + else { + echo ""; + return 0; + } + echo ""; +} + +function check_include ( $ext, $label ) { + echo ""; + echo " $label "; + echo ""; + if (!include($ext)) { + echo ""; + return 1; + } + else { + echo ""; + return 0; + } + echo ""; +} + +function check_exists ( $file, $label ) { + echo ""; + echo " $label "; + echo ""; + if (!file_exists ($file)) { + echo " "; + return 1; + } + else { + echo " "; + return 0; + } + echo ""; +} + +function check_generic ( $ok, $label ) { + echo ""; + if ($ok == 0 ) { + echo " "; + echo ""; + echo " $label "; + echo ""; + echo ""; + return 1; + } + else { + echo " "; + echo ""; + echo " $label "; + echo ""; + echo ""; + return 0; + } +} + +function check_writable ( $fullpath, $label ) { + echo ""; + if (file_exists($fullpath)) + if (is_writable($fullpath)) { + echo " "; + echo ""; + echo " $label "; + echo ""; + echo ""; + return 0; + } + else { + echo " "; + echo ""; + echo " $label "; + echo ""; + echo ""; + return 1; + } + else { + echo " "; + echo ""; + echo " $label "; + echo ""; + echo ""; + return 1; + } +} + +function check_variable ( $var, $value, $label, $mode ) { + echo ""; + echo " $label "; + echo ""; + if ($mode == 1) { + if ($var >= $value) { + echo " "; + return 0; + } + else { + echo " "; + return 1; + } + } + elseif ($var == $value) { + echo " "; + return 0; + } + else { + echo " "; + return 1; + } + echo ""; +} + +function parse_mysql_dump($url) { + if (file_exists($url)) { + $file_content = file($url); + $query = ""; + foreach($file_content as $sql_line) { + if (trim($sql_line) != "" && strpos($sql_line, "-- ") === false) { + $query .= $sql_line; + if(preg_match("/;[\040]*\$/", $sql_line)) { + if (!$result = mysql_query($query)) { + echo mysql_error(); //Uncomment for debug + echo "
$query
"; + return 0; + } + $query = ""; + } + } + } + return 1; + } + else + return 0; +} + +function parse_mysqli_dump($connection, $url) { + if (file_exists($url)) { + $file_content = file($url); + $query = ""; + foreach($file_content as $sql_line) { + if (trim($sql_line) != "" && strpos($sql_line, "-- ") === false) { + $query .= $sql_line; + if(preg_match("/;[\040]*\$/", $sql_line)) { + if (!$result = mysqli_query($connection, $query)) { + echo mysqli_error(); //Uncomment for debug + echo "
$query
"; + return 0; + } + $query = ""; + } + } + } + return 1; + } + else + return 0; +} + +function random_name ($size) { + $temp = ""; + for ($a=0;$a< $size;$a++) + $temp = $temp. chr(rand(122,97)); + + return $temp; +} + +function print_logo_status ($step, $step_total) { + global $banner; + + $header = " +
+
+
+ $banner +
+
"; + $header .= " +
+ Install step $step of $step_total +
"; + + return $header; +} + +// +// This function adjusts path settings in pandora db for FreeBSD. +// +// All packages and configuration files except operating system's base files +// are installed under /usr/local in FreeBSD. So, path settings in pandora db +// for some programs should be changed from the Linux default. +// +function adjust_paths_for_freebsd($engine, $connection = false) { + + $adjust_sql = array( + "update trecon_script set script = REPLACE(script,'/usr/share','/usr/local/share');", + "update tconfig set value = REPLACE(value,'/usr/bin','/usr/local/bin') where token='netflow_daemon' OR token='netflow_nfdump' OR token='netflow_nfexpire';", + "update talert_commands set command = REPLACE(command,'/usr/bin','/usr/local/bin');", + "update talert_commands set command = REPLACE(command,'/usr/share', '/usr/local/share');", + "update tplugin set execute = REPLACE(execute,'/usr/share','/usr/local/share');", + "update tevent_response set target = REPLACE(target,'/usr/share','/usr/local/share');", + "insert into tconfig (token, value) VALUES ('graphviz_bin_dir', '/usr/local/bin');" + ); + + for ($i = 0; $i < count ($adjust_sql); $i++) { + switch ($engine) { + case 'mysql': + $result = mysql_query($adjust_sql[$i]); + break; + case 'mysqli': + $result = mysqli_query($connection, $adjust_sql[$i]); + break; + case 'oracle': + //Delete the last semicolon from current query + $query = substr($adjust_sql[$i], 0, strlen($adjust_sql[$i]) - 1); + $sql = oci_parse($connection, $query); + $result = oci_execute($sql); + break; + case 'pgsql': + pg_send_query($connection, $adjust_sql[$i]); + $result = pg_get_result($connection); + break; + } + if (!$result) { + return 0; + } + } + + return 1; +} + +function install_step1() { + global $banner; + + echo " +
+
+ " . print_logo_status (1,6) . " +
+

Welcome to Pandora FMS installation Wizard

+

This wizard helps you to quick install Pandora FMS console and main database in your system.

+

In four steps, this installer will check all dependencies and will create your configuration, ready to use.

+

For more information, please refer to documentation.
+ Pandora FMS Development Team

+ "; + if (file_exists("include/config.php")) { + echo "
Warning: You already have a config.php file. + Configuration and database would be overwritten if you continued.
"; + } + echo "
"; + echo ""; + $writable = check_writable ( "include", "Checking if ./include is writable"); + if (file_exists("include/config.php")) + $writable += check_writable ( "include/config.php", "Checking if include/config.php is writable"); + echo "
"; + + echo "
Warning: This installer will overwrite and destroy + your existing Pandora FMS configuration and Database. Before continue, + please be sure that you have no valuable Pandora FMS data in your Database.
+
"; + + echo "
Upgrade: + If you want to upgrade from Pandora FMS 4.x to 5.0 version, please use the migration tool inside /extras directory in this setup. +
"; + + echo "
"; + + if ($writable == 0) { + echo "
"; + echo ""; + echo "
"; + } + else { + echo "
ERROR:You need to setup permissions to be able to write in ./include directory
"; + } + echo "
"; + + echo "
"; + echo " +
+
+ Pandora FMS is an OpenSource Software project registered at + SourceForge +
+
"; +} + +function install_step1_licence() { + echo " +
+
+ " . print_logo_status (2,6) . " +
+

GPL2 Licence terms agreement

+

Pandora FMS is an OpenSource software project licensed under the GPL2 licence. Pandora FMS includes, as well, another software also licensed under LGPL and BSD licenses. Before continue, you must accept the licence terms.. +

For more information, please refer to our website at http://pandorafms.org and contact us if you have any kind of question about the usage of Pandora FMS

+

If you dont accept the licence terms, please, close your browser and delete Pandora FMS files.

+ "; + + if (!file_exists("COPYING")) { + echo "
Licence file 'COPYING' is not present in your distribution. This means you have some 'partial' Pandora FMS distribution. We cannot continue without accepting the licence file."; + echo "
"; + } + else { + echo "
"; + echo ""; + echo "

"; + echo "

"; + } + echo "
"; + + echo "
+
+
+ Pandora FMS is an OpenSource Software project registered at + SourceForge +
+
"; +} + +function install_step2() { + + echo " +
+
+ " . print_logo_status (3,6) . " +
"; + echo "

Checking software dependencies

"; + echo ""; + $res = 0; + $res += check_variable(phpversion(),"5.2","PHP version >= 5.2",1); + $res += check_extension("gd","PHP GD extension"); + $res += check_extension("ldap","PHP LDAP extension"); + $res += check_extension("snmp","PHP SNMP extension"); + $res += check_extension("session","PHP session extension"); + $res += check_extension("gettext","PHP gettext extension"); + $res += check_extension("mbstring","PHP Multibyte String"); + $res += check_extension("zip","PHP Zip"); + $res += check_extension("zlib","PHP Zlib extension"); + $res += check_extension("json","PHP json extension"); + $res += check_extension("curl","CURL (Client URL Library)"); + $res += check_extension("filter","PHP filter extension"); + $res += check_extension("calendar","PHP calendar extension"); + if (PHP_OS == "FreeBSD") { + $res += check_exists ("/usr/local/bin/twopi","Graphviz Binary"); + } + else if (PHP_OS == "NetBSD") { + $res += check_exists ("/usr/pkg/bin/twopi","Graphviz Binary"); + } + else if ( substr(PHP_OS, 0, 3) == 'WIN' ) { + $res += check_exists ("..\\..\\..\\Graphviz\\bin\\twopi.exe", "Graphviz Binary"); + } + else { + $res += check_exists ("/usr/bin/twopi","Graphviz Binary"); + } + + echo ""; + check_extension("mysql", "PHP MySQL extension"); + check_extension("mysqli", "PHP MySQL(mysqli) extension"); + echo "
"; + echo "DB Engines"; + echo ""; + echo "
"; + + if ($res > 0) { + echo " +
You have some incomplete + dependencies. Please correct them or this installer + will not be able to finish your installation. +
+
+ Remember, if you install any PHP module to comply + with these dependences, you need to restart + your HTTP/Apache server after it to use the new + modules. +
+
+ Ignore it. +
"; + } + else { + echo "
"; + echo " + "; + echo "
"; + } + echo "
"; + echo "
"; + echo " +
+
+
+
+ Pandora FMS is an OpenSource Software project registered at + SourceForge +
+
"; +} + + +function install_step3() { + $options = ''; + if (extension_loaded("mysql")) { + $options .= ""; + } + if (extension_loaded("mysqli")) { + $options .= ""; + } + + $error = false; + if (empty($options)) { + $error = true; + } + + echo " +
+
+ " . print_logo_status (4,6) . " +
+

Environment and database setup

+

+ This wizard will create your Pandora FMS database, + and populate it with all the data needed to run for the first time. +

+

+ You need a privileged user to create database schema, this is usually root user. + Information about root user will not be used or stored anymore. +

+

+ You can also deploy the scheme into an existing Database. + In this case you need a privileged Database user and password of that instance. +

+

+ Now, please, complete all details to configure your database and environment setup. +

+
+ Warning: This installer will overwrite and destroy your existing + Pandora FMS configuration and Database. Before continue, + please be sure that you have no valuable Pandora FMS data in your Database. +

+
"; + + if (extension_loaded("oci8")) { + echo "
For Oracle installation an existing Database with a privileged user is needed.
"; + } + if (!$error) { + echo ""; + } + + echo ""; + echo ""; + + // the field dbgrant is only shown when the DB host is different from 127.0.0.1 or localhost + echo " + + "; + + + echo " "; + + echo ""; + if ($_SERVER['SERVER_ADDR'] == 'localhost' || $_SERVER['SERVER_ADDR'] == '127.0.0.1') { + echo "
"; + echo "DB Engine
"; + + + if ($error) { + echo " +
+ Warning: You haven't a any DB engine with PHP. Please check the previous step to DB engine dependencies. +
"; + } + else { + echo ""; + + echo "
"; + echo " Installation in
"; + echo ""; + } + echo "
DB User with privileges
+ + +
DB Password for this user
+ + +
DB Hostname
+ + +
DB Name (pandora by default)
+ + +
Drop Database if exists
+ +
Full path to HTTP publication directory
+ For example /var/www/pandora_console/ +
+ + +
+ Drop Database if exists
+ + "; + } else { + echo "
"; + } + echo "URL path to Pandora FMS Console
+ For example '/pandora_console' +
+ +
+ "; + + if (!$error) { + echo "
"; + echo " + "; + echo "
"; + } + + echo "
"; + + echo ""; + + echo "
"; + echo "
+
+ Pandora FMS is an OpenSource Software project registered at + SourceForge +
+
"; +} + +function install_step4() { + $pandora_config = "include/config.php"; + + if ( (! isset($_POST["user"])) || (! isset($_POST["dbname"])) || (! isset($_POST["host"])) || + (! isset($_POST["pass"])) || (!isset($_POST['engine'])) || (! isset($_POST["db_action"])) ) { + $dbpassword = ""; + $dbuser = ""; + $dbhost = ""; + $dbname = ""; + $engine = ""; + $dbaction = ""; + $dbgrant = ""; + } + else { + $engine = $_POST['engine']; + $dbpassword = $_POST["pass"]; + $dbuser = $_POST["user"]; + $dbhost = $_POST["host"]; + $dbaction = $_POST["db_action"]; + if (isset($_POST["dbgrant"]) && $_POST["dbgrant"] != "") + $dbgrant = $_POST["dbgrant"]; + else + $dbgrant = $_SERVER["SERVER_ADDR"]; + if (isset($_POST["drop"])) + $dbdrop = $_POST["drop"]; + else + $dbdrop = 0; + + $dbname = $_POST["dbname"]; + if (isset($_POST["url"])) + $url = $_POST["url"]; + else + $url = "http://localhost"; + if (isset($_POST["path"])) { + $path = $_POST["path"]; + $path = str_replace("\\", "/", $path); // Windows compatibility + } + else + $path = "/var/www"; + } + $everything_ok = 0; + $step1=0; + $step2=0; + $step3=0; + $step4=0; $step5=0; $step6=0; $step7=0; + + echo " +
+
+ " . print_logo_status(5,6) . " +
+

Creating database and default configuration file

+ "; + switch ($engine) { + case 'mysql': + if (! mysql_connect ($dbhost, $dbuser, $dbpassword)) { + check_generic ( 0, "Connection with Database"); + } + else { + check_generic ( 1, "Connection with Database"); + + // Drop database if needed and don't want to install over an existing DB + if ($dbdrop == 1) { + mysql_query ("DROP DATABASE IF EXISTS `$dbname`"); + } + + // Create schema + if ($dbaction == 'db_new' || $dbdrop == 1) { + $step1 = mysql_query ("CREATE DATABASE `$dbname`"); + check_generic ($step1, "Creating database '$dbname'"); + } + else { + $step1 = 1; + } + if ($step1 == 1) { + $step2 = mysql_select_db($dbname); + check_generic ($step2, "Opening database '$dbname'"); + + $step3 = parse_mysql_dump("pandoradb.sql"); + check_generic ($step3, "Creating schema"); + + $step4 = parse_mysql_dump("pandoradb_data.sql"); + check_generic ($step4, "Populating database"); + if (PHP_OS == "FreeBSD") { + $step_freebsd = adjust_paths_for_freebsd ($engine); + check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD"); + } + + $random_password = random_name (8); + $host = $dbhost; // set default granted origin to the origin of the queries + if (($dbhost != 'localhost') && ($dbhost != '127.0.0.1')) + $host = $dbgrant; // if the granted origin is different from local machine, set the valid origin + $step5 = mysql_query ("GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host + IDENTIFIED BY '".$random_password."'"); + mysql_query ("FLUSH PRIVILEGES"); + check_generic ($step5, "Established privileges for user pandora. A new random password has been generated: $random_password
Please write it down, you will need to setup your Pandora FMS server, editing the /etc/pandora/pandora_server.conf file
"); + + $step6 = is_writable("include"); + check_generic ($step6, "Write permissions to save config file in './include'"); + + $cfgin = fopen ("include/config.inc.php","r"); + $cfgout = fopen ($pandora_config,"w"); + $config_contents = fread ($cfgin, filesize("include/config.inc.php")); + $dbtype = 'mysql'; + $config_new = ''; + $step7 = fputs ($cfgout, $config_new); + $step7 = $step7 + fputs ($cfgout, $config_contents); + if ($step7 > 0) + $step7 = 1; + fclose ($cfgin); + fclose ($cfgout); + chmod ($pandora_config, 0600); + check_generic ($step7, "Created new config file at '".$pandora_config."'"); + } + } + + if (($step7 + $step6 + $step5 + $step4 + $step3 + $step2 + $step1) == 7) { + $everything_ok = 1; + } + break; + case 'mysqli': + $connection = mysqli_connect ($dbhost, $dbuser, $dbpassword); + if (mysqli_connect_error() > 0) { + check_generic ( 0, "Connection with Database"); + } + else { + check_generic ( 1, "Connection with Database"); + + // Drop database if needed and don't want to install over an existing DB + if ($dbdrop == 1) { + mysqli_query ($connection, "DROP DATABASE IF EXISTS `$dbname`"); + } + + // Create schema + if ($dbaction == 'db_new' || $dbdrop == 1) { + $step1 = mysqli_query ($connection, "CREATE DATABASE `$dbname`"); + check_generic ($step1, "Creating database '$dbname'"); + } + else { + $step1 = 1; + } + if ($step1 == 1) { + $step2 = mysqli_select_db($connection, $dbname); + check_generic ($step2, "Opening database '$dbname'"); + + $step3 = parse_mysqli_dump($connection, "pandoradb.sql"); + check_generic ($step3, "Creating schema"); + + $step4 = parse_mysqli_dump($connection, "pandoradb_data.sql"); + check_generic ($step4, "Populating database"); + if (PHP_OS == "FreeBSD") { + $step_freebsd = adjust_paths_for_freebsd ($engine, $connection); + check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD"); + } + + $random_password = random_name (8); + $host = $dbhost; // set default granted origin to the origin of the queries + if (($dbhost != 'localhost') && ($dbhost != '127.0.0.1')) + $host = $dbgrant; // if the granted origin is different from local machine, set the valid origin + $step5 = mysqli_query ($connection, "GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host + IDENTIFIED BY '".$random_password."'"); + mysqli_query ($connection, "FLUSH PRIVILEGES"); + check_generic ($step5, "Established privileges for user pandora. A new random password has been generated: $random_password
Please write it down, you will need to setup your Pandora FMS server, editing the /etc/pandora/pandora_server.conf file
"); + + $step6 = is_writable("include"); + check_generic ($step6, "Write permissions to save config file in './include'"); + + $cfgin = fopen ("include/config.inc.php","r"); + $cfgout = fopen ($pandora_config,"w"); + $config_contents = fread ($cfgin, filesize("include/config.inc.php")); + $dbtype = 'mysql'; + $config_new = ''; + $step7 = fputs ($cfgout, $config_new); + $step7 = $step7 + fputs ($cfgout, $config_contents); + if ($step7 > 0) + $step7 = 1; + fclose ($cfgin); + fclose ($cfgout); + chmod ($pandora_config, 0600); + check_generic ($step7, "Created new config file at '".$pandora_config."'"); + } + } + + if (($step7 + $step6 + $step5 + $step4 + $step3 + $step2 + $step1) == 7) { + $everything_ok = 1; + } + break; + } + echo "
"; + + if ($everything_ok == 1) { + echo "
"; + echo " + "; + echo "
"; + } + else { + $info = "
There were some problems. + Installation was not completed. +

Please correct failures before trying again. + All database "; + if ($engine == 'oracle') + $info .= "objects "; + else + $info .= "schemes "; + + $info .= "created in this step have been dropped.

+
"; + echo $info; + + switch ($engine) { + case 'mysql': + if (mysql_error() != "") { + echo "
ERROR: ". mysql_error().".
"; + } + + if ($step1 == 1) { + mysql_query ("DROP DATABASE $dbname"); + } + break; + case 'mysqli': + if (mysqli_error($connection) != "") { + echo "
ERROR: ". mysqli_error($connection).".
"; + } + + if ($step1 == 1) { + mysqli_query ($connection, "DROP DATABASE $dbname"); + } + break; + } + echo "
"; + } + echo "
"; + echo "
"; + echo " +
+
+ Pandora FMS is an Open Source Software project registered at + SourceForge +
+ "; +} + + +function install_step5() { + echo " +
+
+ " . print_logo_status (6,6) . " +
+

Installation complete

+

For security, you now must manually delete this installer + ('install.php') file before trying to access to your Pandora FMS console. +

You should also install Pandora FMS Servers before trying to monitor anything; + please read documentation on how to install it.

+

Default user is 'admin' with password 'pandora', + please change it both as soon as possible.

+

Don't forget to check http://pandorafms.com + for updates. +

Select if you want to rename 'install.php'.

+
+ + +
+


. +

+
"; + + echo "
+
+ Pandora FMS is an OpenSource Software project registered at + SourceForge +
+
"; +} +?> From c77bc2328f30e5a6d72212a4b0470dcf6c2eb33c Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Tue, 25 Sep 2018 12:04:18 +0200 Subject: [PATCH 29/66] Fixed bug in events replication --- pandora_console/include/functions_events.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index f6b6da21cc..c6b5a78eee 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -2706,13 +2706,14 @@ function events_page_comments ($event, $childrens_ids = array()) { } break; } - - if ((tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids))) { - $comments_form = '
'.html_print_textarea("comment", 3, 10, '', 'style="min-height: 15px; width: 100%;"', true); + + if (((tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids))) && $config["show_events_in_local"] == false || $config["event_replication"] == false) { + $comments_form = '
'.html_print_textarea("comment", 3, 10, '', 'style="min-height: 15px; width: 100%; disabled"', true); + $comments_form .= '
'.html_print_button(__('Add comment'),'comment_button',false,'event_comment();','class="sub next"',true).'

'; } else { - $comments_form = ''; + $comments_form = ui_print_message(__( 'If event replication is ongoing, it won\'t be possible to enter comments here. This option is only to allow local pandora users to see comments, but not to operate with them. The operation, when event replication is enabled, must be done only in the Metaconsole.')); } $comments = '
'.$comments_form.html_print_table($table_comments, true).'
'; From cc5104024d78c445367fd3d11b08622b2e477cd1 Mon Sep 17 00:00:00 2001 From: samucarc Date: Tue, 25 Sep 2018 13:33:10 +0200 Subject: [PATCH 30/66] Fixed problems in scheduled downtime CLI --- pandora_console/include/functions_api.php | 2 +- pandora_console/include/functions_planned_downtimes.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 189cc4203b..62786471aa 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -100,7 +100,7 @@ function returnError($typeError, $returnType = 'string') { break; default: returnData("string", - array('type' => 'string', 'data' => __($typeError))); + array('type' => 'string', 'data' => __($returnType))); break; } } diff --git a/pandora_console/include/functions_planned_downtimes.php b/pandora_console/include/functions_planned_downtimes.php index eb0b730649..67f9ec9f29 100644 --- a/pandora_console/include/functions_planned_downtimes.php +++ b/pandora_console/include/functions_planned_downtimes.php @@ -666,6 +666,7 @@ function planned_downtimes_stop ($downtime) { function planned_downtimes_created ($values) { global $config; + $check_group = (bool) db_get_value ('id_grupo', 'tgrupo', 'id_grupo', $values['id_group']); $check = (bool) db_get_value ('name', 'tplanned_downtime', 'name', $values['name']); $datetime_from = strtotime ($values['once_date_from'] . ' ' . $values['once_time_from']); @@ -702,6 +703,11 @@ function planned_downtimes_created ($values) { 'message' => __('Not created. Error inserting data') . ". " . __('The end day must be higher than the start day')); } + else if (!$check_group && $values['id_group'] != 0) { + return array('return' => false, + 'message' => __('Not created. Error inserting data') . ". " + . __('Group not exist')); + } else { if (trim(io_safe_output($values['name'])) != '') { if (!$check) { From 93f4b74c9c3ea6e7843ef01d01941fd8c1f95a64 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Wed, 26 Sep 2018 18:48:27 +0200 Subject: [PATCH 31/66] fixed bug: admin users not able to log in to node when they are created in metaconsole and included option assigned node at admin user creation form --- pandora_console/godmode/users/configure_user.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index f5b7fdc5bc..209817feff 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -154,6 +154,8 @@ if ($create_user) { } if (html_print_csrf_error()) return; + $user_is_admin = (int) get_parameter ('is_admin', 0); + $values = array (); $values['id_user'] = (string) get_parameter ('id_user'); $values['fullname'] = (string) get_parameter ('fullname'); @@ -164,7 +166,7 @@ if ($create_user) { $values['email'] = (string) get_parameter ('email'); $values['phone'] = (string) get_parameter ('phone'); $values['comments'] = (string) get_parameter ('comments'); - $values['is_admin'] = (int) get_parameter ('is_admin', 0); + $values['is_admin'] = $user_is_admin; $values['language'] = get_parameter ('language', 'default'); $values['timezone'] = (string) get_parameter('timezone'); $values['default_event_filter'] = (int) get_parameter('default_event_filter'); @@ -193,9 +195,9 @@ if ($create_user) { $values['last_pass_change'] = date ("Y/m/d H:i:s", get_system_time()); if(defined('METACONSOLE')) { $values['metaconsole_access'] = get_parameter ('metaconsole_access', 'basic'); - $values['metaconsole_agents_manager'] = get_parameter ('metaconsole_agents_manager', '0'); + $values['metaconsole_agents_manager'] = ($user_is_admin == 1 ? 1 : get_parameter ('metaconsole_agents_manager', '0')); $values['metaconsole_assigned_server'] = get_parameter ('metaconsole_assigned_server', ''); - $values['metaconsole_access_node'] = get_parameter ('metaconsole_access_node', '0'); + $values['metaconsole_access_node'] = ($user_is_admin == 1 ? 1 : get_parameter ('metaconsole_access_node', '0')); } } $values["not_login"] = (bool)get_parameter ('not_login', false); @@ -738,12 +740,11 @@ $(document).ready (function () { $('input:radio[name="is_admin"]').change(function() { if($('#radiobtn0002').prop('checked')) { $('#user_configuration_table-metaconsole_agents_manager').show(); - $('#user_configuration_table-metaconsole_assigned_server').show(); $('#user_configuration_table-metaconsole_access_node').show(); } else { $('#user_configuration_table-metaconsole_agents_manager').hide(); - $('#user_configuration_table-metaconsole_assigned_server').hide(); + $('#user_configuration_table-metaconsole_assigned_server').show(); $('#user_configuration_table-metaconsole_access_node').hide(); } }); From 712103c308472baf280ef95b52803ba8aa87bcaf Mon Sep 17 00:00:00 2001 From: "manuel.montes" Date: Thu, 27 Sep 2018 17:35:52 +0200 Subject: [PATCH 32/66] Fixed bug in csv export graph --- .../include/graphs/flot/pandora.flot.js | 16 ++++++++++++---- pandora_console/operation/agentes/stat_win.php | 5 ++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index a71cb5eb19..7a00258620 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -2263,17 +2263,25 @@ function pandoraFlotArea( graph_id, values, legend, } $('#overview_' + graph_id).css('display', 'none'); - + if (menu) { var parent_height; $('#menu_overview_' + graph_id).click(function() { $('#overview_' + graph_id).toggle(); }); - $("#menu_export_csv_"+graph_id) - .click(function (event) { - event.preventDefault(); + $("#menu_export_csv_"+graph_id).click(function (e) { + e.preventDefault(); plot.exportDataCSV(); + var es_firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1; + if(es_firefox){ + $("#dialog").css('visibility', 'visible').dialog(); + } + delete data_base[0].threshold; + plot = $.plot($('#' + graph_id), data_base, + $.extend(true, {}, options, { + legend: { show: true } + })); }); $('#menu_threshold_' + graph_id).click(function() { diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php index 6b98cc931c..a9e3666a28 100644 --- a/pandora_console/operation/agentes/stat_win.php +++ b/pandora_console/operation/agentes/stat_win.php @@ -100,8 +100,11 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent); + "; + echo"

" . __('The CSV export has been successful.') . "

"; + echo"
"; // Module id $id = (int) get_parameter ("id", 0); // Agent id From 9977f1ddf9b7665104079d0e04a9b54bf5387550 Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Mon, 1 Oct 2018 09:51:58 +0200 Subject: [PATCH 33/66] Added code for function api_get_agent_alias for the API of the metaconsole - #2708 --- pandora_console/include/functions_agents.php | 12 ++++++---- pandora_console/include/functions_api.php | 25 +++++++++++++------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 45c72b2b83..5691750c69 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -28,13 +28,14 @@ require_once($config['homedir'] . '/include/functions_users.php'); * * @param int $id_agent The agent id. * @param boolean $show_disabled Show the agent found althought it is disabled. By default false. + * @param boolean $force_meta * * @return boolean The result to check if the agent is in the DB. */ -function agents_check_agent_exists($id_agent, $show_disabled = true) { +function agents_check_agent_exists($id_agent, $show_disabled = true, $force_meta = false) { $agent = db_get_value_filter( 'id_agente', - 'tagente', + $force_meta ? 'tmetaconsole_agent' : 'tagente', array('id_agente' => $id_agent, 'disabled' => !$show_disabled) ); @@ -2735,17 +2736,18 @@ function agents_count_agents_filter ($filter = array(), $access = "AR") { * * @param int Id agent * @param string ACL access bit + * @param boolean $force_meta * * @return True if user has access, false if user has not permissions and * null if id agent does not exist */ -function agents_check_access_agent ($id_agent, $access = "AR") { +function agents_check_access_agent ($id_agent, $access = "AR", $force_meta = false) { global $config; - if (users_access_to_agent($id_agent, $access)) return true; + if (users_access_to_agent($id_agent, $access, false, $force_meta)) return true; // If agent exist return false - if (agents_check_agent_exists($id_agent)) return false; + if (agents_check_agent_exists($id_agent, true, $force_meta)) return false; // Return null otherwise return null; } diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 189cc4203b..ca08e773c0 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -9186,18 +9186,27 @@ function api_get_agent_id($trash1, $trash2, $data, $returnType) { * Agent alias for a given id * * @param int $id_agent + * @param int $id_node Only for metaconsole + * @param $thrash1 Don't use. + * @param $returnType * **/ -// http://localhost/pandora_console/include/api.php?op=get&op2=agent_name&id=1&apipass=1234&user=admin&pass=pandora -function api_get_agent_alias($id_agent, $trash1, $trash2, $returnType) { - if (defined ('METACONSOLE')) { - return; +// http://localhost/pandora_console/include/api.php?op=get&op2=agent_alias&id=1&apipass=1234&user=admin&pass=pandora +// http://localhost/pandora_console/enterprise/meta/include/api.php?op=get&op2=agent_alias&id=1&id2=1&apipass=1234&user=admin&pass=pandora +function api_get_agent_alias($id_agent, $id_node, $trash1, $returnType) { + $table_agent_alias = 'tagente'; + $force_meta=false; + + if (is_metaconsole()) { + $table_agent_alias = 'tmetaconsole_agent'; + $force_meta = true; + $id_agent = db_get_value_sql("SELECT id_agente FROM tmetaconsole_agent WHERE id_tagente = $id_agent AND id_tmetaconsole_setup = $id_node"); } - if (!util_api_check_agent_and_print_error($id_agent, $returnType)) return; + if (!util_api_check_agent_and_print_error($id_agent, $returnType, 'AR', $force_meta)) return; $sql = sprintf('SELECT alias - FROM tagente + FROM ' . $table_agent_alias . ' WHERE id_agente = %d', $id_agent); $value = db_get_value_sql($sql); @@ -11383,10 +11392,10 @@ function api_get_cluster_items ($cluster_id){ // AUX FUNCTIONS ///////////////////////////////////////////////////////////////////// -function util_api_check_agent_and_print_error($id_agent, $returnType, $access = "AR") { +function util_api_check_agent_and_print_error($id_agent, $returnType, $access = "AR", $force_meta = false) { global $config; - $check_agent = agents_check_access_agent($id_agent, $access); + $check_agent = agents_check_access_agent($id_agent, $access, $force_meta); if ($check_agent === true) return true; if ($check_agent === false || !check_acl($config['id_user'], 0, $access)) { From 04226c79402cda4cc449c098a3efb8797affa945 Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Mon, 1 Oct 2018 12:26:06 +0200 Subject: [PATCH 34/66] Changed styles for the button create_network_component - #2814 --- pandora_console/operation/snmpconsole/snmp_browser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/snmpconsole/snmp_browser.php b/pandora_console/operation/snmpconsole/snmp_browser.php index 22fa43e5a6..435aaeade2 100644 --- a/pandora_console/operation/snmpconsole/snmp_browser.php +++ b/pandora_console/operation/snmpconsole/snmp_browser.php @@ -50,7 +50,7 @@ if (is_ajax()) { else { snmp_browser_print_tree ($snmp_tree); echo html_print_submit_button(__('Create network components'),'create_network_component', - false, array('style' => 'display: none; position: fixed; bottom: 55px; right: 80px;', 'class' => 'sub add'), true); + false, array('style' => 'display: none; position: absolute; bottom: 0px; right: 35px;', 'class' => 'sub add'), true); echo '