From 471c01a4c52d2876f7c3eef414652a8aad80cada Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Wed, 9 Jan 2019 10:20:17 +0100 Subject: [PATCH 01/16] fixed bad link to node in metaconsole's custom graph item editor Former-commit-id: 22fb4302de980d8b3e16fb90d087b71c218598a1 --- .../godmode/reporting/reporting_builder.item_editor.php | 2 +- pandora_console/include/ajax/reporting.ajax.php | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index a929740e39..4f4b5e7c22 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -2492,7 +2492,7 @@ function edit_custom_graph() { } }); - window.location.href = server_url + "/index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id=" + id_element_graph + hash_data; + window.location.href = server_url + "index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id=" + id_element_graph + hash_data; Date: Wed, 9 Jan 2019 16:20:24 +0100 Subject: [PATCH 02/16] Added option in setup for unique main IP in agents - #1744 Former-commit-id: f8f9668a14818a01b811a73052e2e7e82e9a8c7a --- .../godmode/agentes/agent_manager.php | 4 +++- .../godmode/agentes/configurar_agente.php | 22 ++++++++++++++++++- .../godmode/setup/setup_general.php | 5 +++++ pandora_console/include/functions_config.php | 10 +++++++-- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index f94cb7737b..40469f75b2 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -228,7 +228,9 @@ if($new_agent){ } $table->data[2][0] = __('IP Address'); -$table->data[2][1] = html_print_input_text ('direccion', $direccion_agente, '', 16, 100, true); +$table->data[2][1] = html_print_input_text ('direccion', $direccion_agente, '', 16, 100, true). + html_print_checkbox ("unique_ip", 1, $config['unique_ip'], true).__('Unique IP') . + ui_print_help_tip (__("Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent"), true); if ($id_agente) { $table->data[2][1] .= '    '; diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index fab0ad7637..92c3cc4b73 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -81,6 +81,7 @@ $alias_as_name = 0; $direccion_agente = get_parameter('direccion', ''); $direccion_agente = trim(io_safe_output($direccion_agente)); $direccion_agente = io_safe_input($direccion_agente); +$unique_ip = 0; $intervalo = SECONDS_5MINUTES; $ff_interval = 0; $quiet_module = 0; @@ -160,6 +161,7 @@ if ($create_agent) { $alias = (string) get_parameter_post("alias",''); $alias_as_name = (int) get_parameter_post("alias_as_name", 0); $direccion_agente = (string) get_parameter_post("direccion",''); + $unique_ip = (int) get_parameter_post("unique_ip", 0); //safe_output only validate ip $direccion_agente = trim(io_safe_output($direccion_agente)); @@ -214,7 +216,12 @@ if ($create_agent) { $nombre_agente = $alias; } - if(!$exists_alias){ + if($unique_ip && $direccion_agente != ''){ + $sql = 'SELECT direccion FROM tagente WHERE direccion = "' . $direccion_agente . '"'; + $exists_ip = db_get_row_sql($sql); + } + + if(!$exists_alias && !$exists_ip){ $id_agente = db_process_sql_insert ( 'tagente', array ( @@ -304,6 +311,9 @@ if ($create_agent) { if($exists_alias){ $agent_creation_error = __('Could not be created, because name already exists'); } + elseif($exists_ip){ + $agent_creation_error = __('Could not be created, because IP already exists'); + } } } } @@ -712,6 +722,7 @@ if ($update_agent) { // if modified some agent paramenter $alias = str_replace('`','‘',(string) get_parameter_post ("alias", "")); $alias_as_name = (int) get_parameter_post ('alias_as_name', 0); $direccion_agente = (string) get_parameter_post ("direccion", ''); + $unique_ip = (int) get_parameter_post ('unique_ip', 0); //safe_output only validate ip $direccion_agente = trim(io_safe_output($direccion_agente)); @@ -795,9 +806,18 @@ if ($update_agent) { // if modified some agent paramenter ui_print_error_message(__('No agent alias specified')); //If there is an agent with the same name, but a different ID } + + if($unique_ip && $direccion_agente != ''){ + $sql = 'SELECT direccion FROM tagente WHERE direccion = "' . $direccion_agente . '"'; + $exists_ip = db_get_row_sql($sql); + } + if ($grupo <= 0) { ui_print_error_message(__('The group id %d is incorrect.', $grupo)); } + elseif($exists_ip){ + ui_print_error_message(__('Duplicate main IP address')); + } else { //If different IP is specified than previous, add the IP if ($direccion_agente != '' && diff --git a/pandora_console/godmode/setup/setup_general.php b/pandora_console/godmode/setup/setup_general.php index b935f4fc13..aedeec5173 100644 --- a/pandora_console/godmode/setup/setup_general.php +++ b/pandora_console/godmode/setup/setup_general.php @@ -230,6 +230,11 @@ $table->data[38][0] = __('Set alias as name by default in agent creation'); $table->data[38][1] = __('Yes').'   '.html_print_radio_button ('alias_as_name', 1, '', $config["alias_as_name"], true).'  '; $table->data[38][1] .= __('No').'   '.html_print_radio_button ('alias_as_name', 0, '', $config["alias_as_name"], true); +$table->data[39][0] = __('Unique IP') . + ui_print_help_tip (__("Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent"), true); +$table->data[39][1] = __('Yes').'   '.html_print_radio_button ('unique_ip', 1, '', $config["unique_ip"], true).'  '; +$table->data[39][1] .= __('No').'   '.html_print_radio_button ('unique_ip', 0, '', $config["unique_ip"], true); + echo '
'; echo "
"; diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index bd0c78bd76..a1f2320d9f 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -204,10 +204,12 @@ function config_update_config () { $error_update[] = __('Identification_reminder'); if (!config_update_value ('include_agents', (bool)get_parameter('include_agents'))) $error_update[] = __('Include_agents'); - if (!config_update_value ('alias_as_name', get_parameter('alias_as_name'))) - $error_update[] = __('alias_as_name'); + if (!config_update_value ('alias_as_name', get_parameter('alias_as_name'))) + $error_update[] = __('alias_as_name'); if (!config_update_value ('auditdir', get_parameter('auditdir'))) $error_update[] = __('Audit log directory'); + if (!config_update_value ('unique_ip', get_parameter('unique_ip'))) + $error_update[] = __('unique_ip'); break; case 'enterprise': if (isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) { @@ -1123,6 +1125,10 @@ function config_process_config () { config_update_value ('limit_parameters_massive', ini_get("max_input_vars") / 2); } + if (!isset ($config["unique_ip"])) { + config_update_value ('unique_ip', 0); + } + /* *Parse the ACL IP list for access API */ From e316977d4b407bd7ae393d087de35bf930c7d947 Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Wed, 16 Jan 2019 12:23:19 +0100 Subject: [PATCH 03/16] Refactorize and add two new fields to api_get_groups api function Former-commit-id: 2d59091279c284d549c09744ee61c8fee1e33564 --- pandora_console/include/functions_api.php | 34 +++++++++++------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 53479ae7ed..aa21faad1a 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -283,30 +283,28 @@ function api_get_test_event_replication_db() { //-------------------------DEFINED OPERATIONS FUNCTIONS----------------- function api_get_groups($thrash1, $thrash2, $other, $returnType, $user_in_db) { - if (defined ('METACONSOLE')) { - return; - } - if ($other['type'] == 'string') { - if ($other['data'] != '') { - returnError('error_parameter', 'Error in the parameters.'); - return; - } - else {//Default values - $separator = ';'; - } - } - else if ($other['type'] == 'array') { - $separator = $other['data'][0]; - } - - $groups = users_get_groups ($user_in_db, "IR"); + $returnAllGroup = true; + $returnAllColumns = false; + + if (isset($other['data'][1])) + $returnAllGroup = ( $other['data'][1] == '1' ? true : false); + + if (isset($other['data'][2])) + $returnAllColumns = ( $other['data'][2] == '1' ? true : false); + + $groups = users_get_groups ($user_in_db, "IR", $returnAllGroup, $returnAllColumns); $data_groups = array(); foreach ($groups as $id => $group) { $data_groups[] = array($id, $group); } - + + if (!isset($other['data'][0])) + $separator = ';'; // by default + else + $separator = $other['data'][0]; + $data['type'] = 'array'; $data['data'] = $data_groups; From 4d4569cadbbf4656ae23553951792735036094e2 Mon Sep 17 00:00:00 2001 From: "tatiana.llorente@artica.es" Date: Fri, 25 Jan 2019 13:52:49 +0100 Subject: [PATCH 04/16] Fixed error with slashes - #3426 Former-commit-id: 8dbead7acd73faa66e406cccf1fe81ed775eb933 --- pandora_console/include/functions_config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 2fd79d6d43..3e414f636a 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -2248,7 +2248,7 @@ function config_check () { __('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'), __("Problems with disable functions in PHP.INI")); } - $result_ejecution = exec($config['phantomjs_bin'] . '/phantomjs --version'); + $result_ejecution = exec('"'.io_safe_output($config['phantomjs_bin']) . '/phantomjs" --version'); if(!isset($result_ejecution) || $result_ejecution == '') { if ($config['language'] == 'es') { set_pandora_error_for_header( From 0adf941008340ac2680a88a4343ebb828147d48e Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 29 Jan 2019 15:44:34 +0100 Subject: [PATCH 05/16] Fixed slow query in template item Former-commit-id: 97c9abbd6a4c86bd3de4294e7012ded98ecb5ff1 --- pandora_console/godmode/massive/massive_edit_modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 35d5bd1abc..be3c34e13d 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -275,7 +275,7 @@ else { } $names = agents_get_modules (array_keys ($agents), - 'DISTINCT(tagente_modulo.nombre)', $filter, false); + 'tagente_modulo.nombre', $filter, false); foreach ($names as $name) { $modules[$name['nombre']] = $name['nombre']; } From 1d7f5365ab7097160a5ad3ba8d1fc534e8d731d9 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 30 Jan 2019 12:07:17 +0100 Subject: [PATCH 06/16] add params setup historic database Former-commit-id: 6a2d0cf00f18ceee467ca98279adf5285ea161dd --- pandora_console/godmode/setup/performance.php | 754 +++++++++++++++--- pandora_console/godmode/setup/setup.php | 304 +++---- 2 files changed, 824 insertions(+), 234 deletions(-) diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index ceeae084c8..4c99c79232 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -1,107 +1,545 @@ -width = '100%'; +$table_status->class = 'databox filters'; +$table_status->style[0] = 'font-weight: bold'; +$table_status->size[0] = '10%'; + +$table_status->data = []; + +$sql = "SELECT UNIX_TIMESTAMP(NOW()) - `value` AS updated_at + FROM tconfig + WHERE token = 'db_maintance'"; + +$time_pandora_db_active = db_get_sql($sql); + +if ($time_pandora_db_active < SECONDS_12HOURS) { + $table_status->data[0][0] = html_print_image( + 'images/dot_green.png', + true + ); +} else { + $table_status->data[0][0] = html_print_image( + 'images/dot_red.png', + true + ); +} + +$table_status->data[0][0] .= ' '.__('Pandora_db running in active database.'); +$table_status->data[0][0] .= ' '.__('Executed:').' '; +$table_status->data[0][0] .= human_time_description_raw( + $time_pandora_db_active, + true +); + +$table_status->data[0][0] .= ' '.__('ago').'.'; + +$table_status->data[0][0] .= ui_print_help_tip( + __('WIP'), + true +); + +if ($config['history_db_enabled'] == 1) { + if (! isset($config['history_db_connection']) + || $config['history_db_connection'] === false + ) { + $config['history_db_connection'] = db_connect( + $config['history_db_host'], + $config['history_db_name'], + $config['history_db_user'], + io_output_password($config['history_db_pass']), + $config['history_db_port'], + false + ); + } + + if ($config['history_db_connection'] !== false) { + $time_pandora_db_history = mysql_db_process_sql( + $sql, + 'insert_id', + $config['history_db_connection'], + false + ); + } + + if ($time_pandora_db_history !== false + && $time_pandora_db_history[0]['updated_at'] < SECONDS_12HOURS + ) { + $table_status->data[1][0] = html_print_image( + 'images/dot_green.png', + true + ); + } else { + $table_status->data[1][0] = html_print_image( + 'images/dot_red.png', + true + ); + } + + $table_status->data[1][0] .= ' '.__('Pandora_db running in historical database.'); + $table_status->data[1][0] .= ' '.__('Executed:').' '; + if ($time_pandora_db_history !== false) { + $table_status->data[1][0] .= human_time_description_raw( + $time_pandora_db_history[0]['updated_at'], + true + ).' '.__('ago').'.'; + } else { + $table_status->data[1][0] .= __('not executed'); + } + + $table_status->data[1][0] .= ui_print_help_tip( + __('WIP'), + true + ); +} -Update operation is done in config_process.php -This is done in that way so the user can see the changes inmediatly. -If you added a new token, please check config_update_config() in functions_config.php -to add it there. -*/ $table = new StdClass(); $table->width = '100%'; -$table->class = "databox filters"; -$table->data = array (); -$table->style[0] = "font-weight: bold"; +$table->class = 'databox filters'; +$table->data = []; +$table->style[0] = 'font-weight: bold'; $table->size[0] = '70%'; $table->size[1] = '30%'; enterprise_hook('enterprise_warnings_history_days'); -$table->data[1][0] = __('Max. days before delete events') . ui_print_help_tip(__('If the compaction or purge of the data is more frequent than the events deletion, anomalies in module graphs could appear'), true); -$table->data[1][1] = html_print_input_text ('event_purge', $config["event_purge"], '', 5, 5, true); +$table->data[1][0] = __('Max. days before delete events'); +$table->data[1][0] .= ui_print_help_tip( + __('If the compaction or purge of the data is more frequent than the events deletion, anomalies in module graphs could appear'), + true +); + +$table->data[1][1] = html_print_input_text( + 'event_purge', + $config['event_purge'], + '', + 5, + 5, + true +); $table->data[2][0] = __('Max. days before delete traps'); -$table->data[2][1] = html_print_input_text ('trap_purge', $config["trap_purge"], '', 5, 5, true); +$table->data[2][1] = html_print_input_text( + 'trap_purge', + $config['trap_purge'], + '', + 5, + 5, + true +); $table->data[3][0] = __('Max. days before delete audit events'); -$table->data[3][1] = html_print_input_text ('audit_purge', $config["audit_purge"], '', 5, 5, true); +$table->data[3][1] = html_print_input_text( + 'audit_purge', + $config['audit_purge'], + '', + 5, + 5, + true +); $table->data[4][0] = __('Max. days before delete string data'); -$table->data[4][1] = html_print_input_text ('string_purge', $config["string_purge"], '', 5, 5, true); +$table->data[4][1] = html_print_input_text( + 'string_purge', + $config['string_purge'], + '', + 5, + 5, + true +); $table->data[5][0] = __('Max. days before delete GIS data'); -$table->data[5][1] = html_print_input_text ('gis_purge', $config["gis_purge"], '', 5, 5, true); +$table->data[5][1] = html_print_input_text( + 'gis_purge', + $config['gis_purge'], + '', + 5, + 5, + true +); -$table->data[6][0] = __('Max. days before purge') . ui_print_help_tip(__('Configure a purge period more frequent than a compact data period has no sense'), true); -$table->data[6][1] = html_print_input_text ('days_purge', $config["days_purge"], '', 5, 5, true); +$table->data[6][0] = __('Max. days before purge'); +$table->data[6][0] .= ui_print_help_tip( + __('Configure a purge period more frequent than a compact data period has no sense'), + true +); +$table->data[6][1] = html_print_input_text( + 'days_purge', + $config['days_purge'], + '', + 5, + 5, + true +); $table->data[7][0] = __('Max. days before compact data'); -$table->data[7][1] = html_print_input_text ('days_compact', $config["days_compact"], '', 5, 5, true); +$table->data[7][1] = html_print_input_text( + 'days_compact', + $config['days_compact'], + '', + 5, + 5, + true +); $table->data[8][0] = __('Max. days before delete unknown modules'); -$table->data[8][1] = html_print_input_text ('days_delete_unknown', $config["days_delete_unknown"], '', 5, 5, true); +$table->data[8][1] = html_print_input_text( + 'days_delete_unknown', + $config['days_delete_unknown'], + '', + 5, + 5, + true +); $table->data[9][0] = __('Max. days before delete autodisabled agents'); -$table->data[9][1] = html_print_input_text ('days_autodisable_deletion', $config["days_autodisable_deletion"], '', 5, 5, true); +$table->data[9][1] = html_print_input_text( + 'days_autodisable_deletion', + $config['days_autodisable_deletion'], + '', + 5, + 5, + true +); -$table->data[10][0] = __('Retention period of past special days') . ui_print_help_tip(__('This number is days to keep past special days. 0 means never remove.'), true); -$table->data[10][1] = html_print_input_text ('num_past_special_days', $config["num_past_special_days"], '', 5, 5, true); +$table->data[10][0] = __('Retention period of past special days'); +$table->data[10][0] .= ui_print_help_tip( + __('This number is days to keep past special days. 0 means never remove.'), + true +); +$table->data[10][1] = html_print_input_text( + 'num_past_special_days', + $config['num_past_special_days'], + '', + 5, + 5, + true +); -$table->data[11][0] = __('Max. macro data fields') . ui_print_help_tip(__('Number of macro fields in alerts and templates between 1 and 15'), true); -$table->data[11][1] = html_print_input_text ('max_macro_fields', $config["max_macro_fields"], '', 5, 5, true, false, false, "onChange=\"change_macro_fields()\""); +$table->data[11][0] = __('Max. macro data fields'); +$table->data[11][0] .= ui_print_help_tip( + __('Number of macro fields in alerts and templates between 1 and 15'), + true +); +$table->data[11][1] = html_print_input_text( + 'max_macro_fields', + $config['max_macro_fields'], + '', + 5, + 5, + true, + false, + false, + 'onChange="change_macro_fields()"' +); -if (enterprise_installed ()) { - $table->data[12][0] = __('Max. days before delete inventory data'); - $table->data[12][1] = html_print_input_text ('inventory_purge', $config["inventory_purge"], '', 5, 5, true); +if (enterprise_installed()) { + $table->data[12][0] = __('Max. days before delete inventory data'); + $table->data[12][1] = html_print_input_text( + 'inventory_purge', + $config['inventory_purge'], + '', + 5, + 5, + true + ); +} + +if ($config['history_db_enabled'] == 1) { + if (! isset($config['history_db_connection']) + || $config['history_db_connection'] === false + ) { + $config['history_db_connection'] = db_connect( + $config['history_db_host'], + $config['history_db_name'], + $config['history_db_user'], + io_output_password($config['history_db_pass']), + $config['history_db_port'], + false + ); + } + + if ($config['history_db_connection'] != false) { + $config_history_array = mysql_db_process_sql( + 'SELECT * FROM tconfig', + 'affected_rows', + $config['history_db_connection'], + false + ); + + $config_history = false; + + if (isset($config_history_array) && is_array($config_history_array)) { + foreach ($config_history_array as $key => $value) { + $config_history[$value['token']] = $value['value']; + } + } + } + + if ($config_history === false) { + $config_history = []; + $config_history['days_purge'] = 180; + $config_history['days_compact'] = 120; + $config_history['step_compact'] = 1; + $config_history['event_purge'] = 180; + $config_history['string_purge'] = 180; + } + + $table_historical = new StdClass(); + $table_historical->width = '100%'; + $table_historical->class = 'databox filters'; + $table_historical->data = []; + $table_historical->style[0] = 'font-weight: bold'; + + $table_historical->size[0] = '70%'; + $table_historical->size[1] = '30%'; + + enterprise_hook('enterprise_warnings_history_days'); + + $table_historical->data[0][0] = __('Max. days before purge'); + $table_historical->data[0][0] .= ui_print_help_tip( + __('Configure a purge period more frequent than a compact data period has no sense'), + true + ); + $table_historical->data[0][1] = html_print_input_text( + 'historical_days_purge', + $config_history['days_purge'], + '', + 5, + 5, + true + ); + + $table_historical->data[1][0] = __('Max. days before compact data'); + $table_historical->data[1][1] = html_print_input_text( + 'historical_days_compact', + $config_history['days_compact'], + '', + 5, + 5, + true + ); + + $table_historical->data[2][0] = __('Compact interpolation in hours (1 Fine-20 bad)'); + $table_historical->data[2][0] .= ui_print_help_tip( + __('Data will be compacted in intervals of the specified length.'), + true + ); + $table_historical->data[2][1] = html_print_input_text( + 'historical_step_compact', + $config_history['step_compact'], + '', + 5, + 5, + true + ); + + $table_historical->data[3][0] = __('Max. days before delete events'); + $table_historical->data[3][0] .= ui_print_help_tip( + __('If the compaction or purge of the data is more frequent than the events deletion, anomalies in module graphs could appear'), + true + ); + + $table_historical->data[3][1] = html_print_input_text( + 'historical_event_purge', + $config_history['event_purge'], + '', + 5, + 5, + true + ); + + $table_historical->data[4][0] = __('Max. days before delete string data'); + $table_historical->data[4][1] = html_print_input_text( + 'historical_string_purge', + $config_history['string_purge'], + '', + 5, + 5, + true + ); + + $table_historical->data[4][1] .= html_print_input_hidden( + 'historical_history_db_enabled', + 0, + true + ); } $table_other = new stdClass(); $table_other->width = '100%'; $table_other->class = 'databox filters'; -$table_other->data = array (); -$table_other->style[0] = "font-weight: bold"; +$table_other->data = []; +$table_other->style[0] = 'font-weight: bold'; $table_other->size[0] = '70%'; $table_other->size[1] = '30%'; -$table_other->data[1][0] = __('Item limit for realtime reports') . ui_print_help_tip(__('Set a value too high cause a slowdown on console and a performance penalty in the system.'), true); -$table_other->data[1][1] = html_print_input_text ('report_limit', - $config["report_limit"], '', 5, 5, true); - -$table_other->data[2][0] = __('Compact interpolation in hours (1 Fine-20 bad)') . ui_print_help_tip(__('Data will be compacted in intervals of the specified length.'), true); -$table_other->data[2][1] = html_print_input_text ('step_compact', - $config["step_compact"], '', 5, 5, true); +$table_other->data[1][0] = __('Item limit for realtime reports'); +$table_other->data[1][0] .= ui_print_help_tip( + __('Set a value too high cause a slowdown on console and a performance penalty in the system.'), + true +); +$table_other->data[1][1] = html_print_input_text( + 'report_limit', + $config['report_limit'], + '', + 5, + 5, + true +); -$intervals = array (); +$table_other->data[2][0] = __('Compact interpolation in hours (1 Fine-20 bad)'); +$table_other->data[2][0] .= ui_print_help_tip( + __('Data will be compacted in intervals of the specified length.'), + true +); +$table_other->data[2][1] = html_print_input_text( + 'step_compact', + $config['step_compact'], + '', + 5, + 5, + true +); + +$intervals = []; $intervals[SECONDS_1HOUR] = __('1 hour'); $intervals[SECONDS_12HOURS] = __('12 hours'); $intervals[SECONDS_1DAY] = __('Last day'); @@ -112,49 +550,172 @@ $intervals[SECONDS_2WEEK] = __('2 weeks'); $intervals[SECONDS_1MONTH] = __('Last month'); $table_other->data[3][0] = __('Default hours for event view'); -$table_other->data[3][1] = html_print_input_text ('event_view_hr', $config["event_view_hr"], '', 5, 5, true); +$table_other->data[3][1] = html_print_input_text( + 'event_view_hr', + $config['event_view_hr'], + '', + 5, + 5, + true +); $table_other->data[5][0] = __('Use realtime statistics'); -$table_other->data[5][1] = __('Yes').' '.html_print_radio_button ('realtimestats', 1, '', $config["realtimestats"], true).'  '; -$table_other->data[5][1] .= __('No').' '.html_print_radio_button ('realtimestats', 0, '', $config["realtimestats"], true); +$table_other->data[5][1] = __('Yes').' '.html_print_radio_button( + 'realtimestats', + 1, + '', + $config['realtimestats'], + true +).'  '; +$table_other->data[5][1] .= __('No').' '.html_print_radio_button( + 'realtimestats', + 0, + '', + $config['realtimestats'], + true +); -$table_other->data[6][0] = __('Batch statistics period (secs)') . ui_print_help_tip(__('If realtime statistics are disabled, statistics interval resfresh will be set here.'), true); -$table_other->data[6][1] = html_print_input_text ('stats_interval', $config["stats_interval"], '', 5, 5, true); +$table_other->data[6][0] = __('Batch statistics period (secs)'); +$table_other->data[6][0] .= ui_print_help_tip( + __('If realtime statistics are disabled, statistics interval resfresh will be set here.'), + true +); +$table_other->data[6][1] = html_print_input_text( + 'stats_interval', + $config['stats_interval'], + '', + 5, + 5, + true +); -$table_other->data[7][0] = __('Use agent access graph') . ui_print_help_icon("agent_access", true); -$table_other->data[7][1] = __('Yes').' '.html_print_radio_button ('agentaccess', 1, '', $config["agentaccess"], true).'  '; -$table_other->data[7][1] .= __('No').' '.html_print_radio_button ('agentaccess', 0, '', $config["agentaccess"], true); +$table_other->data[7][0] = __('Use agent access graph'); +$table_other->data[7][0] .= ui_print_help_icon( + 'agent_access', + true +); +$table_other->data[7][1] = __('Yes').' '; +$table_other->data[7][1] .= html_print_radio_button( + 'agentaccess', + 1, + '', + $config['agentaccess'], + true +).'  '; +$table_other->data[7][1] .= __('No').' '; +$table_other->data[7][1] .= html_print_radio_button( + 'agentaccess', + 0, + '', + $config['agentaccess'], + true +); -$table_other->data[8][0] = __('Max. recommended number of files in attachment directory') . ui_print_help_tip(__('This number is the maximum number of files in attachment directory. If this number is reached then a warning message will appear in the header notification space.'), true); -$table_other->data[8][1] = html_print_input_text ('num_files_attachment', $config["num_files_attachment"], '', 5, 5, true); +$table_other->data[8][0] = __('Max. recommended number of files in attachment directory'); +$table_other->data[8][0] .= ui_print_help_tip( + __('This number is the maximum number of files in attachment directory. If this number is reached then a warning message will appear in the header notification space.'), + true +); +$table_other->data[8][1] = html_print_input_text( + 'num_files_attachment', + $config['num_files_attachment'], + '', + 5, + 5, + true +); $table_other->data[9][0] = __('Delete not init modules'); -$table_other->data[9][1] = __('Yes').' '.html_print_radio_button ('delete_notinit', 1, '', $config["delete_notinit"], true).'  '; -$table_other->data[9][1] .= __('No').' '.html_print_radio_button ('delete_notinit', 0, '', $config["delete_notinit"], true); +$table_other->data[9][1] = __('Yes').' '; +$table_other->data[9][1] .= html_print_radio_button( + 'delete_notinit', + 1, + '', + $config['delete_notinit'], + true +).'  '; +$table_other->data[9][1] .= __('No').' '.html_print_radio_button( + 'delete_notinit', + 0, + '', + $config['delete_notinit'], + true +); -$table_other->data[10][0] = __('Big Operation Step to purge old data') . ui_print_help_tip(__('The number of blocks that a time interval is split into. A bigger value means bigger blocks, which is faster but heavier on the database. Default is 100.'), true); -$table_other->data[10][1] = html_print_input_text ('big_operation_step_datos_purge', $config["big_operation_step_datos_purge"], '', 5, 5, true); +$table_other->data[10][0] = __('Big Operation Step to purge old data'); +$table_other->data[10][0] .= ui_print_help_tip( + __('The number of blocks that a time interval is split into. A bigger value means bigger blocks, which is faster but heavier on the database. Default is 100.'), + true +); +$table_other->data[10][1] = html_print_input_text( + 'big_operation_step_datos_purge', + $config['big_operation_step_datos_purge'], + '', + 5, + 5, + true +); -$table_other->data[11][0] = __('Small Operation Step to purge old data') . ui_print_help_tip(__('The number of rows that are processed in a single query in deletion. Default is 1000. Increase to 3000-5000 in fast systems. Decrease to 500 or 250 on systems with locks.'), true); -$table_other->data[11][1] = html_print_input_text ('small_operation_step_datos_purge', $config["small_operation_step_datos_purge"], '', 5, 5, true); +$table_other->data[11][0] = __('Small Operation Step to purge old data'); +$table_other->data[11][0] .= ui_print_help_tip( + __('The number of rows that are processed in a single query in deletion. Default is 1000. Increase to 3000-5000 in fast systems. Decrease to 500 or 250 on systems with locks.'), + true +); +$table_other->data[11][1] = html_print_input_text( + 'small_operation_step_datos_purge', + $config['small_operation_step_datos_purge'], + '', + 5, + 5, + true +); -$table_other->data[12][0] = __('Graph container - Max. Items') . ui_print_help_tip(__('The number of graphs that are viewed in a container. Default is 10 .Increasing this number could lead to performance problems'), true); -$table_other->data[12][1] = html_print_input_text ('max_graph_container', $config["max_graph_container"], '', 5, 5, true); +$table_other->data[12][0] = __('Graph container - Max. Items'); +$table_other->data[12][0] .= ui_print_help_tip( + __('The number of graphs that are viewed in a container. Default is 10 .Increasing this number could lead to performance problems'), + true +); +$table_other->data[12][1] = html_print_input_text( + 'max_graph_container', + $config['max_graph_container'], + '', + 5, + 5, + true +); echo ''; -echo "
"; -echo "" . __('Database maintenance options') . ""; -html_print_input_hidden ('update_config', 1); -html_print_table ($table); -echo "
"; -echo "
"; -echo "" . __('Others') . ""; -html_print_input_hidden ('update_config', 1); -html_print_table ($table_other); -echo "
"; +echo '
'; + echo ''.__('Database maintenance status').''; + html_print_table($table_status); +echo '
'; + +echo '
'; + echo ''.__('Database maintenance options').''; + html_print_table($table); +echo '
'; + +if ($config['history_db_enabled'] == 1) { + echo '
'; + echo ''.__('Historical database maintenance options').''; + html_print_table($table_historical); + echo '
'; +} + +echo '
'; + echo ''.__('Others').''; + html_print_table($table_other); +echo '
'; + echo '
'; -html_print_submit_button (__('Update'), 'update_button', false, 'class="sub upd"'); +html_print_input_hidden('update_config', 1); +html_print_submit_button( + __('Update'), + 'update_button', + false, + 'class="sub upd"' +); echo '
'; echo ''; ?> @@ -162,14 +723,13 @@ echo ''; diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 1b4f2a208c..7f88982a14 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -1,175 +1,205 @@ - $timezone) { - if (strpos($timezone, $zone) === false) { - unset($timezones[$timezone_key]); - } - } - - echo json_encode($timezones); - } - return; +if (is_ajax()) { + $get_os_icon = (bool) get_parameter('get_os_icon'); + $select_timezone = get_parameter('select_timezone', 0); + + if ($get_os_icon) { + $id_os = (int) get_parameter('id_os'); + ui_print_os_icon($id_os, false); + return; + } + + if ($select_timezone) { + $zone = get_parameter('zone'); + + $timezones = timezone_identifiers_list(); + foreach ($timezones as $timezone_key => $timezone) { + if (strpos($timezone, $zone) === false) { + unset($timezones[$timezone_key]); + } + } + + echo json_encode($timezones); + } + + return; } -if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { - db_pandora_audit("ACL Violation", "Trying to access Setup Management"); - require ("general/noaccess.php"); - return; +if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) { + db_pandora_audit('ACL Violation', 'Trying to access Setup Management'); + include 'general/noaccess.php'; + return; } -// Load enterprise extensions -enterprise_include_once ('include/functions_setup.php'); -enterprise_include_once ('include/functions_io.php'); -enterprise_include_once ('godmode/setup/setup.php'); + +// Load enterprise extensions. +enterprise_include_once('include/functions_setup.php'); +enterprise_include_once('include/functions_io.php'); +enterprise_include_once('godmode/setup/setup.php'); /* -NOTICE FOR DEVELOPERS: + NOTICE FOR DEVELOPERS: -Update operation is done in config_process.php -This is done in that way so the user can see the changes inmediatly. -If you added a new token, please check config_update_config() in functions_config.php -to add it there. + Update operation is done in config_process.php + This is done in that way so the user can see the changes inmediatly. + If you added a new token, please check config_update_config() in functions_config.php + to add it there. */ -// Gets section to jump to another section -$section = (string) get_parameter ("section", "general"); +// Gets section to jump to another section. +$section = (string) get_parameter('section', 'general'); -$buttons = array(); +$buttons = []; -// Draws header -$buttons['general'] = array('active' => false, - 'text' => '' . - html_print_image("images/gm_setup.png", true, array ("title" => __('General'))) . ''); +// Draws header. +$buttons['general'] = [ + 'active' => false, + 'text' => ''.html_print_image('images/gm_setup.png', true, ['title' => __('General')]).'', +]; if (enterprise_installed()) { - $buttons = setup_enterprise_add_Tabs($buttons); + $buttons = setup_enterprise_add_Tabs($buttons); } -$buttons['auth'] = array('active' => false, - 'text' => '' . - html_print_image("images/key.png", true, array ("title" => __('Authentication'))) . ''); +$buttons['auth'] = [ + 'active' => false, + 'text' => ''.html_print_image('images/key.png', true, ['title' => __('Authentication')]).'', +]; -$buttons['perf'] = array('active' => false, - 'text' => '' . - html_print_image("images/performance.png", true, array ("title" => __('Performance'))) . ''); +$buttons['perf'] = [ + 'active' => false, + 'text' => ''.html_print_image('images/performance.png', true, ['title' => __('Performance')]).'', +]; -$buttons['vis'] = array('active' => false, - 'text' => '' . - html_print_image("images/chart.png", true, array ("title" => __('Visual styles'))) . ''); +$buttons['vis'] = [ + 'active' => false, + 'text' => ''.html_print_image('images/chart.png', true, ['title' => __('Visual styles')]).'', +]; -if (check_acl ($config['id_user'], 0, "AW")) { - if ($config['activate_netflow']) { - $buttons['net'] = array('active' => false, - 'text' => '' . - html_print_image("images/op_netflow.png", true, array ("title" => __('Netflow'))) . ''); - } +if (check_acl($config['id_user'], 0, 'AW')) { + if ($config['activate_netflow']) { + $buttons['net'] = [ + 'active' => false, + 'text' => ''.html_print_image('images/op_netflow.png', true, ['title' => __('Netflow')]).'', + ]; + } } -$buttons['ehorus'] = array('active' => false, - 'text' => '' . - html_print_image("images/ehorus/ehorus.png", true, array ("title" => __('eHorus'))) . ''); +$buttons['ehorus'] = [ + 'active' => false, + 'text' => ''.html_print_image('images/ehorus/ehorus.png', true, ['title' => __('eHorus')]).'', +]; $help_header = ''; if (enterprise_installed()) { - $subpage = setup_enterprise_add_subsection_main($section, $buttons, $help_header); + $subpage = setup_enterprise_add_subsection_main($section, $buttons, $help_header); } switch ($section) { - case 'general': - $buttons['general']['active'] = true; - $subpage = ' » ' . __('General'); - break; - case 'auth': - $buttons['auth']['active'] = true; - $subpage = ' » ' . __('Authentication'); - break; - case 'perf': - $buttons['perf']['active'] = true; - $subpage = ' » ' . __('Performance'); - $help_header = 'performance'; - break; - case 'vis': - $buttons['vis']['active'] = true; - $subpage = ' » ' . __('Visual styles'); - break; - case 'net': - $buttons['net']['active'] = true; - $subpage = ' » ' . __('Netflow'); - break; - case 'ehorus': - $buttons['ehorus']['active'] = true; - $subpage = ' » ' . __('eHorus'); - break; + case 'general': + default: + $buttons['general']['active'] = true; + $subpage = ' » '.__('General'); + break; + + case 'auth': + $buttons['auth']['active'] = true; + $subpage = ' » '.__('Authentication'); + break; + + case 'perf': + $buttons['perf']['active'] = true; + $subpage = ' » '.__('Performance'); + $help_header = 'performance'; + break; + + case 'vis': + $buttons['vis']['active'] = true; + $subpage = ' » '.__('Visual styles'); + break; + + case 'net': + $buttons['net']['active'] = true; + $subpage = ' » '.__('Netflow'); + break; + + case 'ehorus': + $buttons['ehorus']['active'] = true; + $subpage = ' » '.__('eHorus'); + break; } -// Header -ui_print_page_header (__('Configuration') . $subpage, "", false, $help_header, true, $buttons); +// Header. +ui_print_page_header(__('Configuration').$subpage, '', false, $help_header, true, $buttons); if (isset($config['error_config_update_config'])) { - if ($config['error_config_update_config']['correct'] == false) { - ui_print_error_message($config['error_config_update_config']['message']); - } - else { - ui_print_success_message(__('Correct update the setup options')); - } - - unset($config['error_config_update_config']); + if ($config['error_config_update_config']['correct'] == false) { + ui_print_error_message($config['error_config_update_config']['message']); + } else { + ui_print_success_message(__('Correct update the setup options')); + } + + unset($config['error_config_update_config']); } switch ($section) { - case "general": - require_once($config['homedir'] . "/godmode/setup/setup_general.php"); - break; - case "auth": - require_once($config['homedir'] . "/godmode/setup/setup_auth.php"); - break; - case "perf": - require_once($config['homedir'] . "/godmode/setup/performance.php"); - break; - case "net": - require_once($config['homedir'] . "/godmode/setup/setup_netflow.php"); - break; - case "vis": - require_once($config['homedir'] . "/godmode/setup/setup_visuals.php"); - break; - case "ehorus": - require_once($config['homedir'] . "/godmode/setup/setup_ehorus.php"); - break; - default: - enterprise_hook('setup_enterprise_select_tab', array($section)); - break; -} + case 'general': + include_once $config['homedir'].'/godmode/setup/setup_general.php'; + break; -?> + case 'auth': + include_once $config['homedir'].'/godmode/setup/setup_auth.php'; + break; + + case 'perf': + include_once $config['homedir'].'/godmode/setup/performance.php'; + break; + + case 'net': + include_once $config['homedir'].'/godmode/setup/setup_netflow.php'; + break; + + case 'vis': + include_once $config['homedir'].'/godmode/setup/setup_visuals.php'; + break; + + case 'ehorus': + include_once $config['homedir'].'/godmode/setup/setup_ehorus.php'; + break; + + default: + enterprise_hook('setup_enterprise_select_tab', [$section]); + break; +} From c1ee43a064aa98b0525b5d3b624be4fea060cc98 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Wed, 6 Feb 2019 17:00:15 +0100 Subject: [PATCH 07/16] resolved conflicts Former-commit-id: 6934eb56d50cfaa16a978472de044cfe135e906a --- .../godmode/massive/massive_edit_modules.php | 3085 +++++++++-------- 1 file changed, 1729 insertions(+), 1356 deletions(-) diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index be3c34e13d..700aab40ee 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -4,7 +4,6 @@ // ================================================== // Copyright (c) 2005-2009 Artica Soluciones Tecnologicas // Please see http://pandorafms.org for full contribution list - // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation for version 2. @@ -12,229 +11,256 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. - // Load global vars -check_login (); +check_login(); -if (! check_acl ($config['id_user'], 0, "AW")) { - db_pandora_audit("ACL Violation", - "Trying to access massive module update"); - require ("general/noaccess.php"); - return; +if (! check_acl($config['id_user'], 0, 'AW')) { + db_pandora_audit( + 'ACL Violation', + 'Trying to access massive module update' + ); + include 'general/noaccess.php'; + return; } -require_once ('include/functions_modules.php'); -require_once($config['homedir'] . "/include/functions_agents.php"); -require_once($config['homedir'] . "/include/functions_groups.php"); -require_once($config['homedir'] . '/include/functions_users.php'); -require_once($config['homedir'] . '/include/functions_categories.php'); +require_once 'include/functions_modules.php'; +require_once $config['homedir'].'/include/functions_agents.php'; +require_once $config['homedir'].'/include/functions_groups.php'; +require_once $config['homedir'].'/include/functions_users.php'; +require_once $config['homedir'].'/include/functions_categories.php'; -$module_type = (int) get_parameter ('module_type'); +$module_type = (int) get_parameter('module_type'); $idGroupMassive = (int) get_parameter('id_group_massive'); $idAgentMassive = (int) get_parameter('id_agent_massive'); $group_select = get_parameter('groups_select'); -$module_name = get_parameter ('module_name'); -$agents_select = get_parameter('agents', array()); +$module_name = get_parameter('module_name'); +$agents_select = get_parameter('agents', []); $agents_id = get_parameter('id_agents'); $modules_select = get_parameter('module'); $selection_mode = get_parameter('selection_mode', 'modules'); $recursion = get_parameter('recursion'); $modules_selection_mode = get_parameter('modules_selection_mode'); -$update = (bool) get_parameter_post ('update'); +$update = (bool) get_parameter_post('update'); if ($update) { - $agents_ = ''; - if ($selection_mode == 'modules') { + $agents_ = ''; + if ($selection_mode == 'modules') { + $agents_ = []; - $agents_ = array(); + $force = get_parameter('force_type', false); - $force = get_parameter('force_type', false); + if ($agents_select == false) { + $agents_select = []; + } - if ($agents_select == false) { - $agents_select = array(); - } + $agents_ = $agents_select; + $modules_ = $module_name; + } else if ($selection_mode == 'agents') { + $force = get_parameter('force_group', false); - $agents_ = $agents_select; - $modules_ = $module_name; - } - else if ($selection_mode == 'agents') { - $force = get_parameter('force_group', false); + $agents_ = $agents_id; + $modules_ = $modules_select; + } - $agents_ = $agents_id; - $modules_ = $modules_select; - } + $success = 0; + $count = 0; - $success = 0; - $count = 0; + if ($agents_ == false) { + $agents_ = []; + } - if ($agents_ == false) - $agents_ = array(); + // If the option to select all of one group or module type is checked + if ($force) { + if ($force == 'type') { + $type_condition = ''; + if ($module_type != 0) { + $type_condition = "AND tam.id_tipo_modulo = $module_type"; + } - // If the option to select all of one group or module type is checked - if ($force) { - if ($force == 'type') { - - $type_condition = ''; - if ($module_type != 0) - $type_condition = "AND tam.id_tipo_modulo = $module_type"; - - $sql = "SELECT ta.id_agente + $sql = "SELECT ta.id_agente FROM tagente ta INNER JOIN tagente_modulo tam ON ta.id_agente = tam.id_agente AND tam.delete_pending = 0 $type_condition GROUP BY ta.id_agente"; - $agents_ = db_get_all_rows_sql($sql); - if ($agents_ === false) - $agents_ = array(); - - // Create an array of agent ids - $agents_ = extract_column($agents_, 'id_agente'); - - foreach ($agents_ as $id_agent) { - $filter = array( - 'id_agente' => $id_agent, - 'delete_pending' => 0 - ); - if ($module_type != 0) - $filter['id_tipo_modulo'] = $module_type; - - $module_name = db_get_all_rows_filter('tagente_modulo', $filter, 'nombre'); - if ($module_name === false) - $module_name = array(); - - foreach ($module_name as $mod_name) { - $result = process_manage_edit($mod_name['nombre'], $id_agent, $modules_selection_mode); - $count++; - $success += (int)$result; - } - } - if ($success == 0) { - $error_msg = __("Error updating the modules from a module type"); - } - } - else if ($force == 'group') { - $agents_ = array_keys(agents_get_group_agents($group_select, false, 'none')); - - foreach ($agents_ as $id_agent) { - $filter = array( - 'id_agente' => $id_agent, - 'delete_pending' => 0 - ); - $module_name = db_get_all_rows_filter('tagente_modulo', $filter, 'nombre'); - if ($module_name === false) - $module_name = array(); - - foreach($module_name as $mod_name) { - $result = process_manage_edit($mod_name['nombre'], $id_agent, $modules_selection_mode); - $count++; - $success += (int)$result; - } - } - if ($success == 0) { - $error_msg = __("Error updating the modules from an agent group"); - } - } - } - else { - // Standard procedure - foreach ($agents_ as $agent_) { + $agents_ = db_get_all_rows_sql($sql); + if ($agents_ === false) { + $agents_ = []; + } - if ($modules_ == false) - $modules_ = array(); - - foreach ($modules_ as $module_) { - $result = process_manage_edit ($module_, $agent_, $modules_selection_mode); - $count++; - $success += (int)$result; - - } - } - if ($success == 0) { - $error_msg = __("Error updating the modules (maybe there was no field to update)"); - } - } - - ui_print_result_message ($success > 0, - __('Successfully updated') . "(" . $success . "/" . $count . ")", - $error_msg); - - $info = '{"Modules":"'.implode(",",$modules_).'","Agents":"'.implode(",",$agents_).'"}'; - if ($success > 0) { - db_pandora_audit("Massive management", "Edit module", false, false, $info); - } - else { - db_pandora_audit("Massive management", "Fail try to edit module", false, false, $info); - } + // Create an array of agent ids + $agents_ = extract_column($agents_, 'id_agente'); + + foreach ($agents_ as $id_agent) { + $filter = [ + 'id_agente' => $id_agent, + 'delete_pending' => 0, + ]; + if ($module_type != 0) { + $filter['id_tipo_modulo'] = $module_type; + } + + $module_name = db_get_all_rows_filter('tagente_modulo', $filter, 'nombre'); + if ($module_name === false) { + $module_name = []; + } + + foreach ($module_name as $mod_name) { + $result = process_manage_edit($mod_name['nombre'], $id_agent, $modules_selection_mode); + $count++; + $success += (int) $result; + } + } + + if ($success == 0) { + $error_msg = __('Error updating the modules from a module type'); + } + } else if ($force == 'group') { + $agents_ = array_keys(agents_get_group_agents($group_select, false, 'none')); + + foreach ($agents_ as $id_agent) { + $filter = [ + 'id_agente' => $id_agent, + 'delete_pending' => 0, + ]; + $module_name = db_get_all_rows_filter('tagente_modulo', $filter, 'nombre'); + if ($module_name === false) { + $module_name = []; + } + + foreach ($module_name as $mod_name) { + $result = process_manage_edit($mod_name['nombre'], $id_agent, $modules_selection_mode); + $count++; + $success += (int) $result; + } + } + + if ($success == 0) { + $error_msg = __('Error updating the modules from an agent group'); + } + } + } else { + // Standard procedure. + foreach ($agents_ as $agent_) { + if ($modules_ == false) { + $modules_ = []; + } + + foreach ($modules_ as $module_) { + $result = process_manage_edit($module_, $agent_, $modules_selection_mode); + $count++; + $success += (int) $result; + } + } + + if ($success == 0) { + $error_msg = __('Error updating the modules (maybe there was no field to update)'); + } + } + + ui_print_result_message( + $success > 0, + __('Successfully updated').'('.$success.'/'.$count.')', + $error_msg + ); + + $info = '{"Modules":"'.implode(',', $modules_).'","Agents":"'.implode(',', $agents_).'"}'; + if ($success > 0) { + db_pandora_audit('Massive management', 'Edit module', false, false, $info); + } else { + db_pandora_audit('Massive management', 'Fail try to edit module', false, false, $info); + } } $table = new stdClass(); $table->id = 'delete_table'; $table->class = 'databox filters'; $table->width = '100%'; -$table->data = array (); -$table->style = array (); +$table->data = []; +$table->style = []; $table->style[0] = 'font-weight: bold;'; $table->style[2] = 'font-weight: bold'; -$table->rowstyle = array (); -$table->size = array (); +$table->rowstyle = []; +$table->size = []; $table->size[0] = '15%'; $table->size[1] = '35%'; $table->size[2] = '15%'; $table->size[3] = '35%'; if (! $module_type) { - $table->rowstyle['edit1'] = 'display: none'; - $table->rowstyle['edit0'] = 'display: none'; - $table->rowstyle['edit1_1'] = 'display: none'; - $table->rowstyle['edit2'] = 'display: none'; - $table->rowstyle['edit3'] = 'display: none'; - $table->rowstyle['edit35'] = 'display: none'; - $table->rowstyle['edit4'] = 'display: none'; - $table->rowstyle['edit5'] = 'display: none'; - $table->rowstyle['edit6'] = 'display: none'; - $table->rowstyle['edit7'] = 'display: none'; -} -$agents = agents_get_group_agents (array_keys (users_get_groups ()), - false, "none"); -switch ($config["dbtype"]) { - case "mysql": - $module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo', - array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo', - 'id_agente' => array_keys ($agents), - 'disabled' => 0, - 'order' => 'ttipo_modulo.nombre'), - array ('DISTINCT(id_tipo)', - 'CONCAT(ttipo_modulo.descripcion," (",ttipo_modulo.nombre,")") AS description')); - break; - case "oracle": - $module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo', - array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo', - 'id_agente' => array_keys ($agents), - 'disabled' => 0, - 'order' => 'ttipo_modulo.nombre'), - array ('id_tipo', - 'ttipo_modulo.descripcion || \' (\' || ttipo_modulo.nombre || \')\' AS description')); - break; - case "postgresql": - $module_types = db_get_all_rows_filter ('tagente_modulo,ttipo_modulo', - array ('tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo', - 'id_agente' => array_keys ($agents), - 'disabled' => 0, - 'order' => 'description'), - array ('DISTINCT(id_tipo)', - 'ttipo_modulo.descripcion || \' (\' || ttipo_modulo.nombre || \')\' AS description')); - break; + $table->rowstyle['edit1'] = 'display: none'; + $table->rowstyle['edit0'] = 'display: none'; + $table->rowstyle['edit1_1'] = 'display: none'; + $table->rowstyle['edit2'] = 'display: none'; + $table->rowstyle['edit3'] = 'display: none'; + $table->rowstyle['edit35'] = 'display: none'; + $table->rowstyle['edit4'] = 'display: none'; + $table->rowstyle['edit5'] = 'display: none'; + $table->rowstyle['edit6'] = 'display: none'; + $table->rowstyle['edit7'] = 'display: none'; } -if ($module_types === false) - $module_types = array (); +$agents = agents_get_group_agents( + array_keys(users_get_groups()), + false, + 'none' +); +switch ($config['dbtype']) { + case 'mysql': + $module_types = db_get_all_rows_filter( + 'tagente_modulo,ttipo_modulo', + ['tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo', + 'id_agente' => array_keys($agents), + 'disabled' => 0, + 'order' => 'ttipo_modulo.nombre' + ], + [ + 'DISTINCT(id_tipo)', + 'CONCAT(ttipo_modulo.descripcion," (",ttipo_modulo.nombre,")") AS description', + ] + ); + break; -$types = array(); + case 'oracle': + $module_types = db_get_all_rows_filter( + 'tagente_modulo,ttipo_modulo', + ['tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo', + 'id_agente' => array_keys($agents), + 'disabled' => 0, + 'order' => 'ttipo_modulo.nombre' + ], + [ + 'id_tipo', + 'ttipo_modulo.descripcion || \' (\' || ttipo_modulo.nombre || \')\' AS description', + ] + ); + break; + + case 'postgresql': + $module_types = db_get_all_rows_filter( + 'tagente_modulo,ttipo_modulo', + ['tagente_modulo.id_tipo_modulo = ttipo_modulo.id_tipo', + 'id_agente' => array_keys($agents), + 'disabled' => 0, + 'order' => 'description' + ], + [ + 'DISTINCT(id_tipo)', + 'ttipo_modulo.descripcion || \' (\' || ttipo_modulo.nombre || \')\' AS description', + ] + ); + break; +} + +if ($module_types === false) { + $module_types = []; +} + +$types = []; foreach ($module_types as $type) { - $types[$type['id_tipo']] = $type['description']; + $types[$type['id_tipo']] = $type['description']; } $snmp_versions['1'] = 'v. 1'; @@ -243,13 +269,11 @@ $snmp_versions['2c'] = 'v. 2c'; $snmp_versions['3'] = 'v. 3'; $table->width = '100%'; -$table->data = array (); +$table->data = []; $table->data['selection_mode'][0] = __('Selection mode'); -$table->data['selection_mode'][1] = ''.__('Select modules first ') . '' . - html_print_radio_button_extended ("selection_mode", 'modules', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true).'
'; -$table->data['selection_mode'][1] .= ''.__('Select agents first ') . '' . - html_print_radio_button_extended ("selection_mode", 'agents', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true); +$table->data['selection_mode'][1] = ''.__('Select modules first ').''.html_print_radio_button_extended('selection_mode', 'modules', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true).'
'; +$table->data['selection_mode'][1] .= ''.__('Select agents first ').''.html_print_radio_button_extended('selection_mode', 'agents', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true); $table->rowclass['form_modules_1'] = 'select_modules_row'; $table->data['form_modules_1'][0] = __('Module type'); @@ -259,25 +283,44 @@ $table->data['form_modules_1'][0] .= ''; $types[0] = __('All'); $table->colspan['form_modules_1'][1] = 2; -$table->data['form_modules_1'][1] = html_print_select ($types, - 'module_type', '', false, __('Select'), -1, true, false, true); +$table->data['form_modules_1'][1] = html_print_select( + $types, + 'module_type', + '', + false, + __('Select'), + -1, + true, + false, + true +); -$table->data['form_modules_1'][3] = __('Select all modules of this type') . ' ' . - html_print_checkbox_extended ("force_type", 'type', '', '', false, - 'style="margin-right: 40px;"', true, ''); +$table->data['form_modules_1'][3] = __('Select all modules of this type').' '.html_print_checkbox_extended( + 'force_type', + 'type', + '', + '', + false, + 'style="margin-right: 40px;"', + true, + '' +); -$modules = array (); +$modules = []; if ($module_type != '') { - $filter = array ('id_tipo_modulo' => $module_type); -} -else { - $filter = false; + $filter = ['id_tipo_modulo' => $module_type]; +} else { + $filter = false; } -$names = agents_get_modules (array_keys ($agents), - 'tagente_modulo.nombre', $filter, false); +$names = agents_get_modules( + array_keys($agents), + 'tagente_modulo.nombre', + $filter, + false +); foreach ($names as $name) { - $modules[$name['nombre']] = $name['nombre']; + $modules[$name['nombre']] = $name['nombre']; } @@ -287,434 +330,708 @@ $table->data['form_agents_1'][0] = __('Agent group'); $groups = groups_get_all(true); $groups[0] = __('All'); $table->colspan['form_agents_1'][1] = 2; -$table->data['form_agents_1'][1] = html_print_select_groups (false, 'AW', true, 'groups_select', - '', false, '', '', true) . - ' ' . __('Group recursion') . ' ' . - html_print_checkbox ("recursion", 1, false, true, false); -$table->data['form_agents_1'][3] = __('Select all modules of this group') . ' ' . - html_print_checkbox_extended ("force_group", 'group', '', '', false, - '', 'style="margin-right: 40px;"'); +$table->data['form_agents_1'][1] = html_print_select_groups( + false, + 'AW', + true, + 'groups_select', + '', + false, + '', + '', + true +).' '.__('Group recursion').' '.html_print_checkbox('recursion', 1, false, true, false); +$table->data['form_agents_1'][3] = __('Select all modules of this group').' '.html_print_checkbox_extended( + 'force_group', + 'group', + '', + '', + false, + '', + 'style="margin-right: 40px;"' +); $table->rowclass['form_modules_3'] = ''; $table->data['form_modules_3'][0] = __('Module Status'); $table->colspan['form_modules_3'][1] = 2; -$status_list = array (); +$status_list = []; $status_list[AGENT_MODULE_STATUS_NORMAL] = __('Normal'); $status_list[AGENT_MODULE_STATUS_WARNING] = __('Warning'); $status_list[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical'); $status_list[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown'); $status_list[AGENT_MODULE_STATUS_NOT_NORMAL] = __('Not normal'); $status_list[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init'); -$table->data['form_modules_3'][1] = html_print_select($status_list, - 'status_module', 'selected', '', __('All'), AGENT_MODULE_STATUS_ALL, true); +$table->data['form_modules_3'][1] = html_print_select( + $status_list, + 'status_module', + 'selected', + '', + __('All'), + AGENT_MODULE_STATUS_ALL, + true +); $table->data['form_modules_3'][3] = ''; $tags = tags_get_user_tags(); $table->rowstyle['form_modules_4'] = 'vertical-align: top;'; $table->rowclass['form_modules_4'] = 'select_modules_row select_modules_row_2'; $table->data['form_modules_4'][0] = __('Tags'); -$table->data['form_modules_4'][1] = html_print_select ($tags, 'tags[]', - $tags_name, false, __('Any'), -1, true, true, true); +$table->data['form_modules_4'][1] = html_print_select( + $tags, + 'tags[]', + $tags_name, + false, + __('Any'), + -1, + true, + true, + true +); $table->rowstyle['form_modules_2'] = 'vertical-align: top;'; $table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2'; $table->data['form_modules_2'][0] = __('Modules'); -$table->data['form_modules_2'][1] = html_print_select ($modules, 'module_name[]', - $module_name, false, __('Select'), -1, true, true, true); +$table->data['form_modules_2'][1] = html_print_select( + $modules, + 'module_name[]', + $module_name, + false, + __('Select'), + -1, + true, + true, + true +); $table->data['form_modules_2'][2] = __('When select modules'); $table->data['form_modules_2'][2] .= '
'; -$table->data['form_modules_2'][2] .= html_print_select ( - array('common' => __('Show common agents'), - 'all' => __('Show all agents')), - 'agents_selection_mode', - 'common', false, '', '', true); +$table->data['form_modules_2'][2] .= html_print_select( + [ + 'common' => __('Show common agents'), + 'all' => __('Show all agents'), + ], + 'agents_selection_mode', + 'common', + false, + '', + '', + true +); -$table->data['form_modules_2'][3] = html_print_select (array(), 'agents[]', - $agents_select, false, __('None'), 0, true, true, false); +$table->data['form_modules_2'][3] = html_print_select( + [], + 'agents[]', + $agents_select, + false, + __('None'), + 0, + true, + true, + false +); $table->rowclass['form_agents_2'] = 'select_agents_row'; $table->data['form_agents_2'][0] = __('Agent Status'); $table->colspan['form_agents_2'][1] = 2; -$status_list = array (); +$status_list = []; $status_list[AGENT_STATUS_NORMAL] = __('Normal'); $status_list[AGENT_STATUS_WARNING] = __('Warning'); $status_list[AGENT_STATUS_CRITICAL] = __('Critical'); $status_list[AGENT_STATUS_UNKNOWN] = __('Unknown'); $status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); $status_list[AGENT_STATUS_NOT_INIT] = __('Not init'); -$table->data['form_agents_2'][1] = html_print_select($status_list, - 'status_agents', 'selected', '', __('All'), AGENT_STATUS_ALL, true); +$table->data['form_agents_2'][1] = html_print_select( + $status_list, + 'status_agents', + 'selected', + '', + __('All'), + AGENT_STATUS_ALL, + true +); $table->data['form_agents_2'][3] = ''; $tags = tags_get_user_tags(); $table->rowstyle['form_agents_4'] = 'vertical-align: top;'; $table->rowclass['form_agents_4'] = 'select_agents_row select_agents_row_2'; $table->data['form_agents_4'][0] = __('Tags'); -$table->data['form_agents_4'][1] = html_print_select ($tags, 'tags[]', - $tags_name, false, __('Any'), -1, true, true, true); +$table->data['form_agents_4'][1] = html_print_select( + $tags, + 'tags[]', + $tags_name, + false, + __('Any'), + -1, + true, + true, + true +); $table->rowstyle['form_agents_3'] = 'vertical-align: top;'; $table->rowclass['form_agents_3'] = 'select_agents_row select_agents_row_2'; $table->data['form_agents_3'][0] = __('Agents'); -$table->data['form_agents_3'][1] = html_print_select ($agents, 'id_agents[]', - $agents_id, false, '', '', true, true, false); +$table->data['form_agents_3'][1] = html_print_select( + $agents, + 'id_agents[]', + $agents_id, + false, + '', + '', + true, + true, + false +); $table->data['form_agents_3'][2] = __('When select agents'); $table->data['form_agents_3'][2] .= '
'; -$table->data['form_agents_3'][2] .= html_print_select ( - array('common' => __('Show common modules'), - 'all' => __('Show all modules'),'unknown' => __('Show unknown and not init modules')), - 'modules_selection_mode', - 'common', false, '', '', true); -$table->data['form_agents_3'][3] = html_print_select (array(), 'module[]', - $modules_select, false, '', '', true, true, false); +$table->data['form_agents_3'][2] .= html_print_select( + [ + 'common' => __('Show common modules'), + 'all' => __('Show all modules'), + 'unknown' => __('Show unknown and not init modules'), + ], + 'modules_selection_mode', + 'common', + false, + '', + '', + true +); +$table->data['form_agents_3'][3] = html_print_select( + [], + 'module[]', + $modules_select, + false, + '', + '', + true, + true, + false +); $table->data['edit0'][0] = __('Dynamic Interval'); -$table->data['edit0'][1] = html_print_extended_select_for_time ('dynamic_interval', '', '', 'None', '0', 10, true, 'width:150px',false); -$table->data['edit0'][2] = ''; -$table->data['edit0'][2] .= ''; -$table->data['edit0'][2] .= ''; -$table->data['edit0'][2] .= '
' . __('Dynamic Min.') . '' . - html_print_input_text ('dynamic_min', '', '', 10, 255, true) . '
' . __('Dynamic Max.') . '' . - html_print_input_text ('dynamic_max', '', '', 10, 255, true) . '
'; +$table->data['edit0'][1] = html_print_extended_select_for_time('dynamic_interval', '', '', 'None', '0', 10, true, 'width:150px', false); +$table->data['edit0'][2] = ''; +$table->data['edit0'][2] .= ''; +$table->data['edit0'][2] .= ''; +$table->data['edit0'][2] .= '
'.__('Dynamic Min.').''.html_print_input_text('dynamic_min', '', '', 10, 255, true).'
'.__('Dynamic Max.').''.html_print_input_text('dynamic_max', '', '', 10, 255, true).'
'; $table->data['edit0'][3] = __('Dynamic Two Tailed: '); -$table->data['edit0'][3] .= html_print_checkbox ("dynamic_two_tailed", 1, '', true); +$table->data['edit0'][3] .= html_print_checkbox('dynamic_two_tailed', 1, '', true); $table->data['edit1'][0] = __('Warning status'); $table->data['edit1'][1] = ''; - $table->data['edit1'][1] .= ""; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ""; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ""; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= ''; -$table->data['edit1'][1] .= '
'; - $table->data['edit1'][1] .= '' . __('Min.') . ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= html_print_input_text( - 'min_warning', '', '', 5, 255, true); - $table->data['edit1'][1] .= '
'; - $table->data['edit1'][1] .= '' . __('Max.') . ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= html_print_input_text ( - 'max_warning', '', '', 5, 255, true); - $table->data['edit1'][1] .= '
'; - $table->data['edit1'][1] .= '' . __('Str.') . ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= html_print_input_text ( - 'str_warning', '', '', 5, 255, true); - $table->data['edit1'][1] .= '
'; - $table->data['edit1'][1] .= '' . - __('Inverse interval') . ''; - $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= - html_print_select( - array( - '' => __('No change'), - '1' => __('Yes'), - '0' => __('No')), - 'warning_inverse','','','', '', true); - $table->data['edit1'][1] .= '
'; + $table->data['edit1'][1] .= ""; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''.__('Min.').''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= html_print_input_text( + 'min_warning', + '', + '', + 5, + 255, + true + ); + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ""; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''.__('Max.').''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= html_print_input_text( + 'max_warning', + '', + '', + 5, + 255, + true + ); + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ""; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''.__('Str.').''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= html_print_input_text( + 'str_warning', + '', + '', + 5, + 255, + true + ); + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''.__('Inverse interval').''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= html_print_select( + [ + '' => __('No change'), + '1' => __('Yes'), + '0' => __('No'), + ], + 'warning_inverse', + '', + '', + '', + '', + true + ); + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; + $table->data['edit1'][1] .= ''; -$table->data['edit1'][2] = __('Critical status'); -$table->data['edit1'][3] = ''; - $table->data['edit1'][3] .= ""; - $table->data['edit1'][3] .= "'; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ""; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ""; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= ''; -$table->data['edit1'][3] .= '
"; - $table->data['edit1'][3] .= '' . __('Min.') . ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= html_print_input_text( - 'min_critical', '', '', 5, 255, true); - $table->data['edit1'][3] .= '
'; - $table->data['edit1'][3] .= '' . __('Max.') . ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= html_print_input_text( - 'max_critical', '', '', 5, 255, true); - $table->data['edit1'][3] .= '
'; - $table->data['edit1'][3] .= ''.__('Str.').''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= html_print_input_text( - 'str_critical', '', '', 5, 255, true); - $table->data['edit1'][3] .= '
'; - $table->data['edit1'][3] .= '' . - __('Inverse interval') . ''; - $table->data['edit1'][3] .= ''; - $table->data['edit1'][3] .= - html_print_select( - array('' => __('No change'), - '1' => __('Yes'), - '0' => __('No')), - 'critical_inverse','','','', '', true); - $table->data['edit1'][3] .= '
'; + $table->data['edit1'][2] = __('Critical status'); + $table->data['edit1'][3] = ''; + $table->data['edit1'][3] .= ""; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ""; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ""; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= '
'; + $table->data['edit1'][3] .= ''.__('Min.').''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= html_print_input_text( + 'min_critical', + '', + '', + 5, + 255, + true + ); + $table->data['edit1'][3] .= '
'; + $table->data['edit1'][3] .= ''.__('Max.').''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= html_print_input_text( + 'max_critical', + '', + '', + 5, + 255, + true + ); + $table->data['edit1'][3] .= '
'; + $table->data['edit1'][3] .= ''.__('Str.').''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= html_print_input_text( + 'str_critical', + '', + '', + 5, + 255, + true + ); + $table->data['edit1'][3] .= '
'; + $table->data['edit1'][3] .= ''.__('Inverse interval').''; + $table->data['edit1'][3] .= ''; + $table->data['edit1'][3] .= html_print_select( + [ + '' => __('No change'), + '1' => __('Yes'), + '0' => __('No'), + ], + 'critical_inverse', + '', + '', + '', + '', + true + ); + $table->data['edit1'][3] .= '
'; -$table->data['edit1_1'][0] = ''.__('Description'). ''; -$table->data['edit1_1'][1] = html_print_textarea ('descripcion', 2, 50, - '', '', true); -$table->colspan['edit1_1'][1] = 3; + $table->data['edit1_1'][0] = ''.__('Description').''; + $table->data['edit1_1'][1] = html_print_textarea( + 'descripcion', + 2, + 50, + '', + '', + true + ); + $table->colspan['edit1_1'][1] = 3; -$table->data['edit2'][0] = __('Interval'); -$table->data['edit2'][1] = html_print_extended_select_for_time( - 'module_interval', 0, '', __('No change'), '0', 10, true, 'width: 150px'); -$table->data['edit2'][2] = __('Disabled'); -$table->data['edit2'][3] = html_print_select( - array( - '' => __('No change'), - '1' => __('Yes'), - '0' => __('No')), - 'disabled', '', '', '', '', true); + $table->data['edit2'][0] = __('Interval'); + $table->data['edit2'][1] = html_print_extended_select_for_time( + 'module_interval', + 0, + '', + __('No change'), + '0', + 10, + true, + 'width: 150px' + ); + $table->data['edit2'][2] = __('Disabled'); + $table->data['edit2'][3] = html_print_select( + [ + '' => __('No change'), + '1' => __('Yes'), + '0' => __('No'), + ], + 'disabled', + '', + '', + '', + '', + true + ); -$table->data['edit3'][0] = __('Post process') . - ui_print_help_icon ('postprocess', true); - -$table->data['edit3'][1] = html_print_extended_select_for_post_process('post_process', - -1, '','', 0, false, true, 'width:150px;', true, false, 1); - -$table->data['edit3'][2] = __('SMNP community'); -$table->data['edit3'][3] = html_print_input_text ('snmp_community', '', - '', 10, 100, true); + $table->data['edit3'][0] = __('Post process').ui_print_help_icon('postprocess', true); -$table->data['edit15'][2] = __('SNMP OID'); -$table->data['edit15'][3] = html_print_input_text ('snmp_oid', '', - '', 80, 80, true); + $table->data['edit3'][1] = html_print_extended_select_for_post_process( + 'post_process', + -1, + '', + '', + 0, + false, + true, + 'width:150px;', + true, + false, + 1 + ); -$target_ip_values = array(); -$target_ip_values['auto'] = __('Auto'); -$target_ip_values['force_pri'] = __('Force primary key'); -$target_ip_values['custom'] = __('Custom'); + $table->data['edit3'][2] = __('SMNP community'); + $table->data['edit3'][3] = html_print_input_text( + 'snmp_community', + '', + '', + 10, + 100, + true + ); -$table->data['edit35'][0] = __('Target IP'); -$table->data['edit35'][1] = html_print_select ($target_ip_values, - 'ip_target', '', '', __('No change'), '', true, false, false, '', false, 'width:200px;'); + $table->data['edit15'][2] = __('SNMP OID'); + $table->data['edit15'][3] = html_print_input_text( + 'snmp_oid', + '', + '', + 80, + 80, + true + ); -$table->data['edit35'][1] .= html_print_input_text ('custom_ip_target', '', '', 15, 60, true); + $target_ip_values = []; + $target_ip_values['auto'] = __('Auto'); + $target_ip_values['force_pri'] = __('Force primary key'); + $target_ip_values['custom'] = __('Custom'); -$table->data['edit35'][2] = __('SNMP version'); -$table->data['edit35'][3] = html_print_select ($snmp_versions, - 'tcp_send', '', '', __('No change'), '', true, false, false, ''); -$table->data['edit36'][0] = __('Auth user'); -$table->data['edit36'][1] = html_print_input_text ('plugin_user_snmp', - '', '', 15, 60, true); -$table->data['edit36'][2] = __('Auth password') . - ui_print_help_tip(__("The pass length must be eight character minimum."), true); -$table->data['edit36'][3] = html_print_input_text ('plugin_pass_snmp', '', '', 15, 60, true); -$table->data['edit37'][0] = __('Privacy method'); -$table->data['edit37'][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'custom_string_1', '', '', __('No change'), '', true); -$table->data['edit37'][2] = __('Privacy pass') . ui_print_help_tip(__("The pass length must be eight character minimum."), true); -$table->data['edit37'][3] = html_print_input_text ('custom_string_2', '', '', 15, 60, true); -$table->data['edit38'][0] = __('Auth method'); -$table->data['edit38'][1] = html_print_select(array('MD5' => __('MD5'), 'SHA' => __('SHA')), 'plugin_parameter', '', '', __('No change'), '', true); -$table->data['edit38'][2] = __('Security level'); -$table->data['edit38'][3] = html_print_select(array('noAuthNoPriv' => __('Not auth and not privacy method'), - 'authNoPriv' => __('Auth and not privacy method'), 'authPriv' => __('Auth and privacy method')), 'custom_string_3', '', '', __('No change'), '', true); + $table->data['edit35'][0] = __('Target IP'); + $table->data['edit35'][1] = html_print_select( + $target_ip_values, + 'ip_target', + '', + '', + __('No change'), + '', + true, + false, + false, + '', + false, + 'width:200px;' + ); -$table->data['edit4'][0] = __('Value'); -$table->data['edit4'][1] = ''.__('Min.').''; -$table->data['edit4'][1] .= html_print_input_text ('min', '', '', 5, 15, true); -$table->data['edit4'][1] .= '
'.__('Max.').''; -$table->data['edit4'][1] .= html_print_input_text ('max', '', '', 5, 15, true); -$table->data['edit4'][2] = __('Module group'); -// Create module groups values for select -$module_groups = modules_get_modulegroups(); -$module_groups[0] = __('Not assigned'); + $table->data['edit35'][1] .= html_print_input_text('custom_ip_target', '', '', 15, 60, true); -$table->data['edit4'][3] = html_print_select ($module_groups, - 'id_module_group', '', '', __('No change'), '', true, false, false); + $table->data['edit35'][2] = __('SNMP version'); + $table->data['edit35'][3] = html_print_select( + $snmp_versions, + 'tcp_send', + '', + '', + __('No change'), + '', + true, + false, + false, + '' + ); + $table->data['edit36'][0] = __('Auth user'); + $table->data['edit36'][1] = html_print_input_text( + 'plugin_user_snmp', + '', + '', + 15, + 60, + true + ); + $table->data['edit36'][2] = __('Auth password').ui_print_help_tip(__('The pass length must be eight character minimum.'), true); + $table->data['edit36'][3] = html_print_input_text('plugin_pass_snmp', '', '', 15, 60, true); + $table->data['edit37'][0] = __('Privacy method'); + $table->data['edit37'][1] = html_print_select(['DES' => __('DES'), 'AES' => __('AES')], 'custom_string_1', '', '', __('No change'), '', true); + $table->data['edit37'][2] = __('Privacy pass').ui_print_help_tip(__('The pass length must be eight character minimum.'), true); + $table->data['edit37'][3] = html_print_input_text('custom_string_2', '', '', 15, 60, true); + $table->data['edit38'][0] = __('Auth method'); + $table->data['edit38'][1] = html_print_select(['MD5' => __('MD5'), 'SHA' => __('SHA')], 'plugin_parameter', '', '', __('No change'), '', true); + $table->data['edit38'][2] = __('Security level'); + $table->data['edit38'][3] = html_print_select( + [ + 'noAuthNoPriv' => __('Not auth and not privacy method'), + 'authNoPriv' => __('Auth and not privacy method'), + 'authPriv' => __('Auth and privacy method'), + ], + 'custom_string_3', + '', + '', + __('No change'), + '', + true + ); -$table->data['edit5'][0] = __('Username'); -$table->data['edit5'][1] = html_print_input_text ('plugin_user', '', '', 15, 60, true); -$table->data['edit5'][2] = __('Password'); -$table->data['edit5'][3] = html_print_input_password ('plugin_pass', '', '', 15, 60, true); + $table->data['edit4'][0] = __('Value'); + $table->data['edit4'][1] = ''.__('Min.').''; + $table->data['edit4'][1] .= html_print_input_text('min', '', '', 5, 15, true); + $table->data['edit4'][1] .= '
'.__('Max.').''; + $table->data['edit4'][1] .= html_print_input_text('max', '', '', 5, 15, true); + $table->data['edit4'][2] = __('Module group'); + // Create module groups values for select + $module_groups = modules_get_modulegroups(); + $module_groups[0] = __('Not assigned'); -// Export target -$table->data['edit6'][0] = __('Export target'); -$targets2 = db_get_all_rows_sql ("SELECT id, name FROM tserver_export ORDER by name"); -if ($targets2 === false) - $targets2 = array(); + $table->data['edit4'][3] = html_print_select( + $module_groups, + 'id_module_group', + '', + '', + __('No change'), + '', + true, + false, + false + ); -$targets = array(); -$targets[0] = __('None'); -foreach ($targets2 as $t) { - $targets[$t['id']] = $t['name']; -} + $table->data['edit5'][0] = __('Username'); + $table->data['edit5'][1] = html_print_input_text('plugin_user', '', '', 15, 60, true); + $table->data['edit5'][2] = __('Password'); + $table->data['edit5'][3] = html_print_input_password('plugin_pass', '', '', 15, 60, true); -$table->data['edit6'][1] = html_print_select ($targets, 'id_export', '','', __('No change'), '', true, false, false); -$table->data['edit6'][2] = __('Unit'); -$table->data['edit6'][3] = html_print_extended_select_for_unit('unit','-1', '', '', '0', '15', true, false, false, false , 1); + // Export target + $table->data['edit6'][0] = __('Export target'); + $targets2 = db_get_all_rows_sql('SELECT id, name FROM tserver_export ORDER by name'); + if ($targets2 === false) { + $targets2 = []; + } + + $targets = []; + $targets[0] = __('None'); + foreach ($targets2 as $t) { + $targets[$t['id']] = $t['name']; + } + + $table->data['edit6'][1] = html_print_select($targets, 'id_export', '', '', __('No change'), '', true, false, false); + $table->data['edit6'][2] = __('Unit'); + $table->data['edit6'][3] = html_print_extended_select_for_unit('unit', '-1', '', '', '0', '15', true, false, false, false, 1); -/* FF stands for Flip-flop */ -$table->data['edit7'][0] = __('FF threshold') . ' ' . ui_print_help_icon ('ff_threshold', true); -$table->colspan['edit7'][1] = 3; -$table->data['edit7'][1] = __('Mode') . ' ' . html_print_select(array('' => __('No change'), '1' => __('Each state changing'), '0' => __('All state changing')),'each_ff','','','', '', true) . '
'; -$table->data['edit7'][1] .= __('All state changing') . ' : ' . html_print_input_text ('min_ff_event', '', '', 5, 15, true) . '
'; -$table->data['edit7'][1] .= __('Each state changing') . ' : '; -$table->data['edit7'][1] .= __('To normal') . html_print_input_text ('min_ff_event_normal', '', '', 5, 15, true) . ' '; -$table->data['edit7'][1] .= __('To warning') . html_print_input_text ('min_ff_event_warning', '', '', 5, 15, true) . ' '; -$table->data['edit7'][1] .= __('To critical') . html_print_input_text ('min_ff_event_critical', '', '', 5, 15, true) . ' '; + // FF stands for Flip-flop + $table->data['edit7'][0] = __('FF threshold').' '.ui_print_help_icon('ff_threshold', true); + $table->colspan['edit7'][1] = 3; + $table->data['edit7'][1] = __('Mode').' '.html_print_select(['' => __('No change'), '1' => __('Each state changing'), '0' => __('All state changing')], 'each_ff', '', '', '', '', true).'
'; + $table->data['edit7'][1] .= __('All state changing').' : '.html_print_input_text('min_ff_event', '', '', 5, 15, true).'
'; + $table->data['edit7'][1] .= __('Each state changing').' : '; + $table->data['edit7'][1] .= __('To normal').html_print_input_text('min_ff_event_normal', '', '', 5, 15, true).' '; + $table->data['edit7'][1] .= __('To warning').html_print_input_text('min_ff_event_warning', '', '', 5, 15, true).' '; + $table->data['edit7'][1] .= __('To critical').html_print_input_text('min_ff_event_critical', '', '', 5, 15, true).' '; -$table->data['edit8'][0] = __('FF interval'); -$table->data['edit8'][1] = html_print_input_text ('module_ff_interval', '', '', 5, 10, true) . ui_print_help_tip (__('Module execution flip flop time interval (in secs).'), true); -$table->data['edit8'][2] = __('FF timeout'); -$table->data['edit8'][3] = html_print_input_text ('ff_timeout', '', '', 5, 10, true).ui_print_help_tip (__('Timeout in secs from start of flip flop counting. If this value is exceeded, FF counter is reset. Set to 0 for no timeout.'), true); + $table->data['edit8'][0] = __('FF interval'); + $table->data['edit8'][1] = html_print_input_text('module_ff_interval', '', '', 5, 10, true).ui_print_help_tip(__('Module execution flip flop time interval (in secs).'), true); + $table->data['edit8'][2] = __('FF timeout'); + $table->data['edit8'][3] = html_print_input_text('ff_timeout', '', '', 5, 10, true).ui_print_help_tip(__('Timeout in secs from start of flip flop counting. If this value is exceeded, FF counter is reset. Set to 0 for no timeout.'), true); -$table->data['edit9'][0] = __('Historical data'); -$table->data['edit9'][1] = html_print_select(array('' => __('No change'), '1' => __('Yes'), '0' => __('No')),'history_data','','','', '', true); + $table->data['edit9'][0] = __('Historical data'); + $table->data['edit9'][1] = html_print_select(['' => __('No change'), '1' => __('Yes'), '0' => __('No')], 'history_data', '', '', '', '', true); -/* Tags avalaible */ -$id_tag = array(); -$table->data['edit10'][0] = __('Tags'); -$table->data['edit10'][1] = html_print_select_from_sql ('SELECT id_tag, name FROM ttag ORDER BY name', - 'id_tag[]', $id_tag, '',__('None'),'0', true, true, false, false); -$table->data['edit10'][2] = __('Category'); -$table->data['edit10'][3] = html_print_select (categories_get_all_categories('forselect'), 'id_category', '','', __('No change'), '', true, false, false); + // Tags avalaible + $id_tag = []; + $table->data['edit10'][0] = __('Tags'); + $table->data['edit10'][1] = html_print_select_from_sql( + 'SELECT id_tag, name FROM ttag ORDER BY name', + 'id_tag[]', + $id_tag, + '', + __('None'), + '0', + true, + true, + false, + false + ); + $table->data['edit10'][2] = __('Category'); + $table->data['edit10'][3] = html_print_select(categories_get_all_categories('forselect'), 'id_category', '', '', __('No change'), '', true, false, false); -if (enterprise_installed()) { - $table->rowspan['edit10'][0] = $table->rowspan['edit10'][1] = 2; - - $table->data['edit101'][2] = __('Policy linking status') . ui_print_help_tip(__("This field only has sense in modules adopted by a policy."), true); - $table->data['edit101'][3] = html_print_select (array(MODULE_PENDING_LINK => __('Linked'), MODULE_PENDING_UNLINK => __('Unlinked')), 'policy_linked', '','', __('No change'), '', true, false, false); -} + if (enterprise_installed()) { + $table->rowspan['edit10'][0] = $table->rowspan['edit10'][1] = 2; -if ($table->rowspan['edit10'][0] == 2) { - $table->rowspan['edit10'][0] = $table->rowspan['edit10'][1] = 3; -} -else { - $table->rowspan['edit10'][0] = $table->rowspan['edit10'][1] = 2; -} -$table->data['edit102'][2] = __('Discard unknown events'); + $table->data['edit101'][2] = __('Policy linking status').ui_print_help_tip(__('This field only has sense in modules adopted by a policy.'), true); + $table->data['edit101'][3] = html_print_select([MODULE_PENDING_LINK => __('Linked'), MODULE_PENDING_UNLINK => __('Unlinked')], 'policy_linked', '', '', __('No change'), '', true, false, false); + } -$table->data['edit102'][3] = html_print_select( - array('' => __('No change'), - '1' => __('Yes'), - '0' => __('No')), - 'throw_unknown_events','','','', '', true); + if ($table->rowspan['edit10'][0] == 2) { + $table->rowspan['edit10'][0] = $table->rowspan['edit10'][1] = 3; + } else { + $table->rowspan['edit10'][0] = $table->rowspan['edit10'][1] = 2; + } -$table->data['edit12'][0] = ''.__('Critical instructions'). ''. ui_print_help_tip(__("Instructions when the status is critical"), true); -$table->data['edit12'][1] = html_print_textarea ('critical_instructions', 2, 50, '', '', true); -$table->colspan['edit12'][1] = 3; + $table->data['edit102'][2] = __('Discard unknown events'); -$table->data['edit13'][0] = ''.__('Warning instructions'). ''. ui_print_help_tip(__("Instructions when the status is warning"), true); -$table->data['edit13'][1] = html_print_textarea ('warning_instructions', 2, 50, '', '', true); -$table->colspan['edit13'][1] = 3; + $table->data['edit102'][3] = html_print_select( + [ + '' => __('No change'), + '1' => __('Yes'), + '0' => __('No'), + ], + 'throw_unknown_events', + '', + '', + '', + '', + true + ); -$table->data['edit14'][0] = ''.__('Unknown instructions').''. ui_print_help_tip(__("Instructions when the status is unknown"), true); -$table->data['edit14'][1] = html_print_textarea ('unknown_instructions', 2, 50, '', '', true); -$table->colspan['edit14'][1] = 3; + $table->data['edit12'][0] = ''.__('Critical instructions').''.ui_print_help_tip(__('Instructions when the status is critical'), true); + $table->data['edit12'][1] = html_print_textarea('critical_instructions', 2, 50, '', '', true); + $table->colspan['edit12'][1] = 3; -$table->data['edit11'][0] = __('Quiet'); -$table->data['edit11'][0] .= ui_print_help_tip(__('The module still store data but the alerts and events will be stop'), true); -$table->data['edit11'][1] = html_print_select(array(-1 => __('No change'), - 1 => __('Yes'), 0 => __('No')), - "quiet_select", -1, "", '', 0, true); + $table->data['edit13'][0] = ''.__('Warning instructions').''.ui_print_help_tip(__('Instructions when the status is warning'), true); + $table->data['edit13'][1] = html_print_textarea('warning_instructions', 2, 50, '', '', true); + $table->colspan['edit13'][1] = 3; + + $table->data['edit14'][0] = ''.__('Unknown instructions').''.ui_print_help_tip(__('Instructions when the status is unknown'), true); + $table->data['edit14'][1] = html_print_textarea('unknown_instructions', 2, 50, '', '', true); + $table->colspan['edit14'][1] = 3; + + $table->data['edit11'][0] = __('Quiet'); + $table->data['edit11'][0] .= ui_print_help_tip(__('The module still store data but the alerts and events will be stop'), true); + $table->data['edit11'][1] = html_print_select( + [ + -1 => __('No change'), + 1 => __('Yes'), + 0 => __('No'), + ], + 'quiet_select', + -1, + '', + '', + 0, + true + ); -$table->data['edit11'][2] = __('Timeout'); -$table->data['edit11'][3] = html_print_input_text( - 'max_timeout', '', '', 5, 10, true) . ' ' . - ui_print_help_tip ( - __('Seconds that agent will wait for the execution of the module.'), true); + $table->data['edit11'][2] = __('Timeout'); + $table->data['edit11'][3] = html_print_input_text( + 'max_timeout', + '', + '', + 5, + 10, + true + ).' '.ui_print_help_tip( + __('Seconds that agent will wait for the execution of the module.'), + true + ); -$table->data['edit16'][0] = __('Retries'); -$table->data['edit16'][1] = html_print_input_text ('max_retries', '', '', 5, 10, true) . ' ' . - ui_print_help_tip ( - __('Number of retries that the module will attempt to run.'), true); + $table->data['edit16'][0] = __('Retries'); + $table->data['edit16'][1] = html_print_input_text('max_retries', '', '', 5, 10, true).' '.ui_print_help_tip( + __('Number of retries that the module will attempt to run.'), + true + ); -$table->data['edit22'][0] = __('Web checks').ui_print_help_icon ("web_checks", true);; -$table->data['edit22'][1] = ''; + $table->data['edit22'][0] = __('Web checks').ui_print_help_icon('web_checks', true); + ; + $table->data['edit22'][1] = ''; -$table->data['edit16'][2] = __('Port'); -$table->data['edit16'][3] = html_print_input_text ('tcp_port', '', '', 5, 20, true); + $table->data['edit16'][2] = __('Port'); + $table->data['edit16'][3] = html_print_input_text('tcp_port', '', '', 5, 20, true); -$table->data['edit17'][0] = __('TCP send') . ' ' . ui_print_help_icon ("tcp_send", true); -$table->data['edit17'][1] = html_print_textarea ('tcp_send2', 2, 65, '', '', true); + $table->data['edit17'][0] = __('TCP send').' '.ui_print_help_icon('tcp_send', true); + $table->data['edit17'][1] = html_print_textarea('tcp_send2', 2, 65, '', '', true); -$table->data['edit17'][2] = __('TCP receive'); -$table->data['edit17'][3] = html_print_textarea ('tcp_rcv', 2, 65, '', '', true); + $table->data['edit17'][2] = __('TCP receive'); + $table->data['edit17'][3] = html_print_textarea('tcp_rcv', 2, 65, '', '', true); -$table->data['edit18'][0] = __('WMI query') . ui_print_help_icon ('wmiquery', true); -$table->data['edit18'][1] = html_print_input_text ('wmi_query', '', '', 35, 255, true); + $table->data['edit18'][0] = __('WMI query').ui_print_help_icon('wmiquery', true); + $table->data['edit18'][1] = html_print_input_text('wmi_query', '', '', 35, 255, true); -$table->data['edit18'][2] = __('Key string'); -$table->data['edit18'][3] = html_print_input_text ('key_string', '', '', 20, 60, true); - -$table->data['edit19'][0] = __('Field number') . ui_print_help_icon ('wmifield', true); -$table->data['edit19'][1] = html_print_input_text ('field_number', '', '', 5, 15, true); + $table->data['edit18'][2] = __('Key string'); + $table->data['edit18'][3] = html_print_input_text('key_string', '', '', 20, 60, true); -$table->data['edit20'][0] = __('Plugin') . ui_print_help_icon ('plugin_macros', true); -$table->data['edit20'][1] = html_print_select_from_sql ('SELECT id, name FROM tplugin ORDER BY name', - 'id_plugin', '', 'changePluginSelect();', __('None'), 0, true, false, false); - - - // Store the macros in base64 into a hidden control to move between pages - $table->data['edit21'][0] = html_print_input_hidden('macros',base64_encode($macros),true); + $table->data['edit19'][0] = __('Field number').ui_print_help_icon('wmifield', true); + $table->data['edit19'][1] = html_print_input_text('field_number', '', '', 5, 15, true); - if (!empty($id_plugin)) { - $preload = db_get_sql ("SELECT description FROM tplugin WHERE id = $id_plugin"); - $preload = io_safe_output ($preload); - $preload = str_replace ("\n", "
", $preload); - } - else { - $preload = ""; - } - - $table->data['edit21'][1] = ''.$preload.''; + $table->data['edit20'][0] = __('Plugin').ui_print_help_icon('plugin_macros', true); + $table->data['edit20'][1] = html_print_select_from_sql( + 'SELECT id, name FROM tplugin ORDER BY name', + 'id_plugin', + '', + 'changePluginSelect();', + __('None'), + 0, + true, + false, + false + ); -echo '
'; -html_print_table ($table); + // Store the macros in base64 into a hidden control to move between pages + $table->data['edit21'][0] = html_print_input_hidden('macros', base64_encode($macros), true); -echo '
'; -html_print_input_hidden ('update', 1); -html_print_submit_button (__('Update'), 'go', false, 'class="sub upd"'); -echo '
'; -echo '
'; + if (!empty($id_plugin)) { + $preload = db_get_sql("SELECT description FROM tplugin WHERE id = $id_plugin"); + $preload = io_safe_output($preload); + $preload = str_replace("\n", '
', $preload); + } else { + $preload = ''; + } -echo ''; -//Hack to translate text "none" in PHP to javascript -echo ''; -echo ''; -ui_require_jquery_file ('pandora.controls'); + $table->data['edit21'][1] = ''.$preload.''; -if ($selection_mode == 'modules') { - $modules_row = ''; - $agents_row = 'none'; -} -else { - $modules_row = 'none'; - $agents_row = ''; -} -?> + echo '
'; + html_print_table($table); + + echo '
'; + html_print_input_hidden('update', 1); + html_print_submit_button(__('Update'), 'go', false, 'class="sub upd"'); + echo '
'; + echo '
'; + + echo ''; + // Hack to translate text "none" in PHP to javascript + echo ''; + echo ''; + ui_require_jquery_file('pandora.controls'); + + if ($selection_mode == 'modules') { + $modules_row = ''; + $agents_row = 'none'; + } else { + $modules_row = 'none'; + $agents_row = ''; + } + + ?> @@ -723,872 +1040,928 @@ else { var limit_parameters_massive = ; $(document).ready (function () { - $("#form_edit").submit(function() { - var get_parameters_count = window.location.href.slice( - window.location.href.indexOf('?') + 1).split('&').length; - var post_parameters_count = $("#form_edit").serializeArray().length; - - var count_parameters = - get_parameters_count + post_parameters_count; - - if (count_parameters > limit_parameters_massive) { - alert(""); - return false; - } - }); - - $("#text-custom_ip_target").hide(); - - $("#id_agents").change(agent_changed_by_multiple_agents); - $("#module_name").change(module_changed_by_multiple_modules); - - clean_lists(); - - $(".select_modules_row").css('display', ''); - $(".select_agents_row").css('display', ''); - $(".select_modules_row_2").css('display', 'none'); - - // Trigger change to refresh selection when change selection mode - $("#agents_selection_mode").change (function() { - $("#module_name").trigger('change'); - }); - $("#modules_selection_mode").change (function() { - $("#id_agents").trigger('change'); - }); - - $("#module_type").change (function () { - $('input[type=checkbox]').attr('checked', false); - if (this.value < 0) { - clean_lists(); - $(".select_modules_row_2").css('display', 'none'); - return; - } - else { - $("#module").html(''); - $("#module_name").html(''); - $('input[type=checkbox]').removeAttr('disabled'); - $(".select_modules_row_2").css('display', ''); - } - - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10, " + - "tr#delete_table-edit101, " + - "tr#delete_table-edit102, " + - "tr#delete_table-edit11, " + - "tr#delete_table-edit12, " + - "tr#delete_table-edit13, " + - "tr#delete_table-edit14, " + - "tr#delete_table-edit16, " + - "tr#delete_table-edit17, " + - "tr#delete_table-edit18, " + - "tr#delete_table-edit19, " + - "tr#delete_table-edit20, " + - "tr#delete_table-edit21, " + - "tr#delete_table-edit22, " + - "tr#delete_table-edit15").hide (); - - var params = { - "page" : "operation/agentes/ver_agente", - "get_agent_modules_json" : 1, - "get_distinct_name" : 1, - "indexed" : 0 - }; - - if (this.value != '0') - params['id_tipo_modulo'] = this.value; - - var status_module = $('#status_module').val(); - if (status_module != '-1') - params['status_module'] = status_module; + $("#form_edit").submit(function() { + var get_parameters_count = window.location.href.slice( + window.location.href.indexOf('?') + 1).split('&').length; + var post_parameters_count = $("#form_edit").serializeArray().length; + + var count_parameters = + get_parameters_count + post_parameters_count; + + if (count_parameters > limit_parameters_massive) { + alert(""); + return false; + } + }); + + $("#text-custom_ip_target").hide(); + + $("#id_agents").change(agent_changed_by_multiple_agents); + $("#module_name").change(module_changed_by_multiple_modules); + + clean_lists(); + + $(".select_modules_row").css('display', ''); + $(".select_agents_row").css('display', ''); + $(".select_modules_row_2").css('display', 'none'); + + // Trigger change to refresh selection when change selection mode + $("#agents_selection_mode").change (function() { + $("#module_name").trigger('change'); + }); + $("#modules_selection_mode").change (function() { + $("#id_agents").trigger('change'); + }); + + $("#module_type").change (function () { + $('input[type=checkbox]').attr('checked', false); + if (this.value < 0) { + clean_lists(); + $(".select_modules_row_2").css('display', 'none'); + return; + } + else { + $("#module").html(''); + $("#module_name").html(''); + $('input[type=checkbox]').removeAttr('disabled'); + $(".select_modules_row_2").css('display', ''); + } + + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10, " + + "tr#delete_table-edit101, " + + "tr#delete_table-edit102, " + + "tr#delete_table-edit11, " + + "tr#delete_table-edit12, " + + "tr#delete_table-edit13, " + + "tr#delete_table-edit14, " + + "tr#delete_table-edit16, " + + "tr#delete_table-edit17, " + + "tr#delete_table-edit18, " + + "tr#delete_table-edit19, " + + "tr#delete_table-edit20, " + + "tr#delete_table-edit21, " + + "tr#delete_table-edit22, " + + "tr#delete_table-edit15").hide (); + + var params = { + "page" : "operation/agentes/ver_agente", + "get_agent_modules_json" : 1, + "get_distinct_name" : 1, + "indexed" : 0 + }; + + if (this.value != '0') + params['id_tipo_modulo'] = this.value; + + var status_module = $('#status_module').val(); + if (status_module != '-1') + params['status_module'] = status_module; - var tags_to_search = $('#tags').val(); - if (tags_to_search != null) { - if (tags_to_search[0] != -1) { - params['tags'] = tags_to_search; - } - } - - $("#module_loading").show (); - $("tr#delete_table-edit1, tr#delete_table-edit0, tr#delete_table-edit2").hide (); - $("#module_name").attr ("disabled", "disabled") - $("#module_name option[value!=0]").remove (); - jQuery.post ("ajax.php", - params, - function (data, status) { - jQuery.each (data, function (id, value) { - option = $("").attr ("value", value["nombre"]).html (value["nombre"]); - $("#module_name").append (option); - }); - $("#module_loading").hide (); - $("#module_name").removeAttr ("disabled"); - }, - "json" - ); - }); - function show_form() { - $("td#delete_table-0-1, " + - "td#delete_table-edit1-1, " + - "td#delete_table-edit2-1").css ("width", "300px"); - $("#form_edit input[type=text]").attr ("value", ""); - $("#form_edit input[type=checkbox]").not ("#checkbox-recursion").removeAttr ("checked"); - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10, " + - "tr#delete_table-edit101, " + - "tr#delete_table-edit102, " + - "tr#delete_table-edit11, " + - "tr#delete_table-edit12, " + - "tr#delete_table-edit13, " + - "tr#delete_table-edit14, " + - "tr#delete_table-edit16, " + - "tr#delete_table-edit17, " + - "tr#delete_table-edit18, " + - "tr#delete_table-edit19, " + - "tr#delete_table-edit20, " + - "tr#delete_table-edit21, " + - "tr#delete_table-edit22, " + - "tr#delete_table-edit15").show (); - - switch($('#module_type').val()) { - case '3': - case '23': - case '33': - $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max,#delete_table-edit15," + - "#delete_table-edit3-2,#delete_table-edit3-3,#delete_table-edit35").hide(); - $("#edit1-1-str,#edit1-3-str").show(); - break; - case '6': - case '7': - $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); - $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + - "#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," + - "#delete_table-edit5").hide(); - break; - case '8': - case '9': - case '11': - $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); - $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + - "#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," + - "#delete_table-edit5").hide(); - break; - case '10': - $("#edit1-1-str,#edit1-3-str").show(); - $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + - "#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," + - "#delete_table-edit5").hide(); - break; - case '15': - case '16': - case '18': - $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); - $("#edit1-1-str,#edit1-3-str,#delete_table-edit5").hide(); - break; - case '17': - $("#edit1-1-str,#edit1-3-str").show(); - $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max,#delete_table-edit5").hide(); - break; - case '1': - case '2': - case '4': - case '5': - case '21': - case '22': - case '24': - case '25': - case '30': - case '31': - case '32': - case '100': - $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); - $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + - "#delete_table-edit3-3,#delete_table-edit35").hide(); - break; - default: - } - } - - function clean_lists() { - $("#id_agents").html(''); - $("#module_name").html(''); - $("#agents").html(''); - $("#module").html(''); - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit36, " + - "tr#delete_table-edit37, " + - "tr#delete_table-edit38, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10, " + - "tr#delete_table-edit101, " + - "tr#delete_table-edit102, " + - "tr#delete_table-edit11, " + - "tr#delete_table-edit12, " + - "tr#delete_table-edit13, " + - "tr#delete_table-edit14, " + - "tr#delete_table-edit16, " + - "tr#delete_table-edit17, " + - "tr#delete_table-edit18, " + - "tr#delete_table-edit19, " + - "tr#delete_table-edit20, " + - "tr#delete_table-edit21, " + - "tr#delete_table-edit22, " + - "tr#delete_table-edit15").hide (); - $('input[type=checkbox]').attr('checked', false); - $('input[type=checkbox]').attr('disabled', true); - - $('#module_type').val(-1); - $('#groups_select').val(-1); - } - - $('input[type=checkbox]').change ( - function () { - if (this.id == "checkbox-force_type") { - if (this.checked) { - $(".select_modules_row_2").css('display', 'none'); - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10").show (); - } - else { - $(".select_modules_row_2").css('display', ''); - if ($('#module_name option:selected').val() == undefined) { - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10, " + - "tr#delete_table-edit101, " + - "tr#delete_table-edit102, " + - "tr#delete_table-edit11, " + - "tr#delete_table-edit12, " + - "tr#delete_table-edit13, " + - "tr#delete_table-edit14, " + - "tr#delete_table-edit16, " + - "tr#delete_table-edit17, " + - "tr#delete_table-edit18, " + - "tr#delete_table-edit19, " + - "tr#delete_table-edit20, " + - "tr#delete_table-edit21, " + - "tr#delete_table-edit22, " + - "tr#delete_table-edit15").hide (); - } - } - } - else if (this.id == "checkbox-recursion") { - $("#checkbox-force_group").prop("checked", false); - $("#groups_select").trigger("change"); - } - else if (this.id == "checkbox-warning_inverse") { - return; //Do none - } - else if (this.id == "checkbox-critical_inverse") { - return; //Do none - } - else if (this.id == "checkbox-dynamic_two_tailed") { - return; //Do none - } - else { - if (this.id == "checkbox-force_group") { - $("#checkbox-recursion").prop("checked", false); - } - - if (this.checked) { - $(".select_agents_row_2").css('display', 'none'); - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10, " + - "tr#delete_table-edit101, " + - "tr#delete_table-edit102, " + - "tr#delete_table-edit11, " + - "tr#delete_table-edit12, " + - "tr#delete_table-edit13, " + - "tr#delete_table-edit14, " + - "tr#delete_table-edit16, " + - "tr#delete_table-edit17, " + - "tr#delete_table-edit18, " + - "tr#delete_table-edit19, " + - "tr#delete_table-edit20, " + - "tr#delete_table-edit21, " + - "tr#delete_table-edit22, " + - "tr#delete_table-edit15").show (); - } - else { - $(".select_agents_row_2").css('display', ''); - if ($('#id_agents option:selected').val() == undefined) { - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10, " + - "tr#delete_table-edit101, " + - "tr#delete_table-edit102, " + - "tr#delete_table-edit11, " + - "tr#delete_table-edit12, " + - "tr#delete_table-edit13, " + - "tr#delete_table-edit14, " + - "tr#delete_table-edit16, " + - "tr#delete_table-edit17, " + - "tr#delete_table-edit18, " + - "tr#delete_table-edit19, " + - "tr#delete_table-edit20, " + - "tr#delete_table-edit21, " + - "tr#delete_table-edit22, " + - "tr#delete_table-edit15").hide (); - } - } - } - } - ); - - $("#module_name").change (show_form); - $("#id_agents").change (show_form); - - $("#form_edit input[name=selection_mode]").change (function () { - selector = $("#form_edit input[name=selection_mode]:checked").val(); - clean_lists(); - - if(selector == 'agents') { - $(".select_modules_row").hide(); - $(".select_agents_row").show(); - $("#groups_select").trigger("change"); - } - else if(selector == 'modules') { - $(".select_agents_row").hide(); - $(".select_modules_row").show(); - $("#module_type").trigger("change"); - } - }); - - $('#tcp_send').change(function() { - if($(this).val() == 3) { - $("tr#delete_table-edit36, tr#delete_table-edit37, tr#delete_table-edit38").show(); - } - else { - $("tr#delete_table-edit36, tr#delete_table-edit37, tr#delete_table-edit38").hide(); - } - }); + var tags_to_search = $('#tags').val(); + if (tags_to_search != null) { + if (tags_to_search[0] != -1) { + params['tags'] = tags_to_search; + } + } + + $("#module_loading").show (); + $("tr#delete_table-edit1, tr#delete_table-edit0, tr#delete_table-edit2").hide (); + $("#module_name").attr ("disabled", "disabled") + $("#module_name option[value!=0]").remove (); + jQuery.post ("ajax.php", + params, + function (data, status) { + jQuery.each (data, function (id, value) { + option = $("").attr ("value", value["nombre"]).html (value["nombre"]); + $("#module_name").append (option); + }); + $("#module_loading").hide (); + $("#module_name").removeAttr ("disabled"); + }, + "json" + ); + }); + function show_form() { + $("td#delete_table-0-1, " + + "td#delete_table-edit1-1, " + + "td#delete_table-edit2-1").css ("width", "300px"); + $("#form_edit input[type=text]").attr ("value", ""); + $("#form_edit input[type=checkbox]").not ("#checkbox-recursion").removeAttr ("checked"); + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10, " + + "tr#delete_table-edit101, " + + "tr#delete_table-edit102, " + + "tr#delete_table-edit11, " + + "tr#delete_table-edit12, " + + "tr#delete_table-edit13, " + + "tr#delete_table-edit14, " + + "tr#delete_table-edit16, " + + "tr#delete_table-edit17, " + + "tr#delete_table-edit18, " + + "tr#delete_table-edit19, " + + "tr#delete_table-edit20, " + + "tr#delete_table-edit21, " + + "tr#delete_table-edit22, " + + "tr#delete_table-edit15").show (); + + switch($('#module_type').val()) { + case '3': + case '23': + case '33': + $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max,#delete_table-edit15," + + "#delete_table-edit3-2,#delete_table-edit3-3,#delete_table-edit35").hide(); + $("#edit1-1-str,#edit1-3-str").show(); + break; + case '6': + case '7': + $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); + $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + + "#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," + + "#delete_table-edit5").hide(); + break; + case '8': + case '9': + case '11': + $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); + $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + + "#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," + + "#delete_table-edit5").hide(); + break; + case '10': + $("#edit1-1-str,#edit1-3-str").show(); + $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + + "#delete_table-edit3-3,#delete_table-edit35-2,#delete_table-edit35-3," + + "#delete_table-edit5").hide(); + break; + case '15': + case '16': + case '18': + $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); + $("#edit1-1-str,#edit1-3-str,#delete_table-edit5").hide(); + break; + case '17': + $("#edit1-1-str,#edit1-3-str").show(); + $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max,#delete_table-edit5").hide(); + break; + case '1': + case '2': + case '4': + case '5': + case '21': + case '22': + case '24': + case '25': + case '30': + case '31': + case '32': + case '100': + $("#edit1-1-min,#edit1-1-max,#edit1-3-min,#edit1-3-max").show(); + $("#edit1-1-str,#edit1-3-str,#delete_table-edit15,#delete_table-edit3-2," + + "#delete_table-edit3-3,#delete_table-edit35").hide(); + break; + default: + } + } + + function clean_lists() { + $("#id_agents").html(''); + $("#module_name").html(''); + $("#agents").html(''); + $("#module").html(''); + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit36, " + + "tr#delete_table-edit37, " + + "tr#delete_table-edit38, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10, " + + "tr#delete_table-edit101, " + + "tr#delete_table-edit102, " + + "tr#delete_table-edit11, " + + "tr#delete_table-edit12, " + + "tr#delete_table-edit13, " + + "tr#delete_table-edit14, " + + "tr#delete_table-edit16, " + + "tr#delete_table-edit17, " + + "tr#delete_table-edit18, " + + "tr#delete_table-edit19, " + + "tr#delete_table-edit20, " + + "tr#delete_table-edit21, " + + "tr#delete_table-edit22, " + + "tr#delete_table-edit15").hide (); + $('input[type=checkbox]').attr('checked', false); + $('input[type=checkbox]').attr('disabled', true); + + $('#module_type').val(-1); + $('#groups_select').val(-1); + } + + $('input[type=checkbox]').change ( + function () { + if (this.id == "checkbox-force_type") { + if (this.checked) { + $(".select_modules_row_2").css('display', 'none'); + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10").show (); + } + else { + $(".select_modules_row_2").css('display', ''); + if ($('#module_name option:selected').val() == undefined) { + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10, " + + "tr#delete_table-edit101, " + + "tr#delete_table-edit102, " + + "tr#delete_table-edit11, " + + "tr#delete_table-edit12, " + + "tr#delete_table-edit13, " + + "tr#delete_table-edit14, " + + "tr#delete_table-edit16, " + + "tr#delete_table-edit17, " + + "tr#delete_table-edit18, " + + "tr#delete_table-edit19, " + + "tr#delete_table-edit20, " + + "tr#delete_table-edit21, " + + "tr#delete_table-edit22, " + + "tr#delete_table-edit15").hide (); + } + } + } + else if (this.id == "checkbox-recursion") { + $("#checkbox-force_group").prop("checked", false); + $("#groups_select").trigger("change"); + } + else if (this.id == "checkbox-warning_inverse") { + return; //Do none + } + else if (this.id == "checkbox-critical_inverse") { + return; //Do none + } + else if (this.id == "checkbox-dynamic_two_tailed") { + return; //Do none + } + else { + if (this.id == "checkbox-force_group") { + $("#checkbox-recursion").prop("checked", false); + } + + if (this.checked) { + $(".select_agents_row_2").css('display', 'none'); + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10, " + + "tr#delete_table-edit101, " + + "tr#delete_table-edit102, " + + "tr#delete_table-edit11, " + + "tr#delete_table-edit12, " + + "tr#delete_table-edit13, " + + "tr#delete_table-edit14, " + + "tr#delete_table-edit16, " + + "tr#delete_table-edit17, " + + "tr#delete_table-edit18, " + + "tr#delete_table-edit19, " + + "tr#delete_table-edit20, " + + "tr#delete_table-edit21, " + + "tr#delete_table-edit22, " + + "tr#delete_table-edit15").show (); + } + else { + $(".select_agents_row_2").css('display', ''); + if ($('#id_agents option:selected').val() == undefined) { + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10, " + + "tr#delete_table-edit101, " + + "tr#delete_table-edit102, " + + "tr#delete_table-edit11, " + + "tr#delete_table-edit12, " + + "tr#delete_table-edit13, " + + "tr#delete_table-edit14, " + + "tr#delete_table-edit16, " + + "tr#delete_table-edit17, " + + "tr#delete_table-edit18, " + + "tr#delete_table-edit19, " + + "tr#delete_table-edit20, " + + "tr#delete_table-edit21, " + + "tr#delete_table-edit22, " + + "tr#delete_table-edit15").hide (); + } + } + } + } + ); + + $("#module_name").change (show_form); + $("#id_agents").change (show_form); + + $("#form_edit input[name=selection_mode]").change (function () { + selector = $("#form_edit input[name=selection_mode]:checked").val(); + clean_lists(); + + if(selector == 'agents') { + $(".select_modules_row").hide(); + $(".select_agents_row").show(); + $("#groups_select").trigger("change"); + } + else if(selector == 'modules') { + $(".select_agents_row").hide(); + $(".select_modules_row").show(); + $("#module_type").trigger("change"); + } + }); + + $('#tcp_send').change(function() { + if($(this).val() == 3) { + $("tr#delete_table-edit36, tr#delete_table-edit37, tr#delete_table-edit38").show(); + } + else { + $("tr#delete_table-edit36, tr#delete_table-edit37, tr#delete_table-edit38").hide(); + } + }); - $('#ip_target').change(function() { - if($(this).val() == 'custom') { - $("#text-custom_ip_target").show(); - } - else{ - $("#text-custom_ip_target").hide(); - } - }); + $('#ip_target').change(function() { + if($(this).val() == 'custom') { + $("#text-custom_ip_target").show(); + } + else{ + $("#text-custom_ip_target").hide(); + } + }); - var recursion; + var recursion; - $("#checkbox-recursion").click(function () { - recursion = this.checked ? 1 : 0; - }); + $("#checkbox-recursion").click(function () { + recursion = this.checked ? 1 : 0; + }); - $("#groups_select").change ( - function () { - if (this.value < 0) { - clean_lists(); - $(".select_agents_row_2").css('display', 'none'); - return; - } - else { - $("#module").html(''); - $("#id_agents").html(''); - $('input[type=checkbox]').removeAttr('disabled'); - $(".select_agents_row_2").css('display', ''); - } - - $("tr#delete_table-edit1, " + - "tr#delete_table-edit0, " + - "tr#delete_table-edit1_1, " + - "tr#delete_table-edit2, " + - "tr#delete_table-edit3, " + - "tr#delete_table-edit35, " + - "tr#delete_table-edit4, " + - "tr#delete_table-edit5, " + - "tr#delete_table-edit6, " + - "tr#delete_table-edit7, " + - "tr#delete_table-edit8, " + - "tr#delete_table-edit9, " + - "tr#delete_table-edit10, " + - "tr#delete_table-edit101, " + - "tr#delete_table-edit102, " + - "tr#delete_table-edit11, " + - "tr#delete_table-edit12, " + - "tr#delete_table-edit13, " + - "tr#delete_table-edit14, " + - "tr#delete_table-edit16, " + - "tr#delete_table-edit17, " + - "tr#delete_table-edit18, " + - "tr#delete_table-edit19, " + - "tr#delete_table-edit20, " + - "tr#delete_table-edit21, " + - "tr#delete_table-edit22, " + - "tr#delete_table-edit15").hide (); - - jQuery.post ("ajax.php", - {"page" : "operation/agentes/ver_agente", - "get_agents_group_json" : 1, - "recursion" : recursion, - "id_group" : this.value, - status_agents: function () { - return $("#status_agents").val(); - }, - // Add a key prefix to avoid auto sorting in js object conversion - "keys_prefix" : "_" - }, - function (data, status) { - $("#id_agents").html(''); - - jQuery.each (data, function(id, value) { - // Remove keys_prefix from the index - id = id.substring(1); - - option = $("") - .attr("value", value["id_agente"]) - .html(value["alias"]); - $("#id_agents").append (option); - }); - }, - "json" - ); - } - ); - - $("#status_agents").change(function() { - $("#groups_select").trigger("change"); - }); - - if(""){ - if("" == 'agents'){ - $("#groups_select").trigger("change"); - } - } + $("#groups_select").change ( + function () { + if (this.value < 0) { + clean_lists(); + $(".select_agents_row_2").css('display', 'none'); + return; + } + else { + $("#module").html(''); + $("#id_agents").html(''); + $('input[type=checkbox]').removeAttr('disabled'); + $(".select_agents_row_2").css('display', ''); + } + + $("tr#delete_table-edit1, " + + "tr#delete_table-edit0, " + + "tr#delete_table-edit1_1, " + + "tr#delete_table-edit2, " + + "tr#delete_table-edit3, " + + "tr#delete_table-edit35, " + + "tr#delete_table-edit4, " + + "tr#delete_table-edit5, " + + "tr#delete_table-edit6, " + + "tr#delete_table-edit7, " + + "tr#delete_table-edit8, " + + "tr#delete_table-edit9, " + + "tr#delete_table-edit10, " + + "tr#delete_table-edit101, " + + "tr#delete_table-edit102, " + + "tr#delete_table-edit11, " + + "tr#delete_table-edit12, " + + "tr#delete_table-edit13, " + + "tr#delete_table-edit14, " + + "tr#delete_table-edit16, " + + "tr#delete_table-edit17, " + + "tr#delete_table-edit18, " + + "tr#delete_table-edit19, " + + "tr#delete_table-edit20, " + + "tr#delete_table-edit21, " + + "tr#delete_table-edit22, " + + "tr#delete_table-edit15").hide (); + + jQuery.post ("ajax.php", + {"page" : "operation/agentes/ver_agente", + "get_agents_group_json" : 1, + "recursion" : recursion, + "id_group" : this.value, + status_agents: function () { + return $("#status_agents").val(); + }, + // Add a key prefix to avoid auto sorting in js object conversion + "keys_prefix" : "_" + }, + function (data, status) { + $("#id_agents").html(''); + + jQuery.each (data, function(id, value) { + // Remove keys_prefix from the index + id = id.substring(1); + + option = $("") + .attr("value", value["id_agente"]) + .html(value["alias"]); + $("#id_agents").append (option); + }); + }, + "json" + ); + } + ); + + $("#status_agents").change(function() { + $("#groups_select").trigger("change"); + }); + + if(""){ + if("" == 'agents'){ + $("#groups_select").trigger("change"); + } + } - $("#status_module").change(function() { - selector = $("#form_edit input[name=selection_mode]:checked").val(); - if(selector == 'agents') { - $("#id_agents").trigger("change"); - } - else if(selector == 'modules') { - $("#module_type").trigger("change"); - } - }); + $("#status_module").change(function() { + selector = $("#form_edit input[name=selection_mode]:checked").val(); + if(selector == 'agents') { + $("#id_agents").trigger("change"); + } + else if(selector == 'modules') { + $("#module_type").trigger("change"); + } + }); - $("#tags").change(function() { - selector = $("#form_edit input[name=selection_mode]:checked").val(); - $("#module_type").trigger("change"); - }); - $("#tags1").change(function() { - selector = $("#form_edit input[name=selection_mode]:checked").val(); - $("#id_agents").trigger("change"); - }); - - $('#agents').change(function(e){ - for(var i=0;i"+macro['desc']+""); - } - }); - //Plugin text can be larger - $(".macro_field").find(":input").attr("maxlength", 1023); - // Add again the hover event to the 'force_callback' elements - forced_title_callback(); - } - } - }); - } + if (flag_load_plugin_component) { + flag_load_plugin_component = false; + + return; + } + + load_plugin_description($("#id_plugin").val()); + + load_plugin_macros_fields_massive('simple-macro'); + + forced_title_callback(); + } + + function load_plugin_macros_fields_massive(row_model_id) { + // Get plugin macros when selected and load macros fields + var id_plugin = $('#id_plugin').val(); + + var params = []; + params.push("page=include/ajax/module"); + params.push("get_plugin_macros=1"); + params.push("id_plugin=" + id_plugin); + + jQuery.ajax ({ + data: params.join ("&"), + type: 'POST', + url: action = get_php_value('absolute_homeurl') + "ajax.php", + dataType: 'json', + success: function (data) { + // Delete all the macro fields + $('.macro_field').remove(); + + if (data['array'] != null) { + $('#hidden-macros').val(data['base64']); + + jQuery.each (data['array'], function (i, macro) { + console.log(macro); + if (macro['desc'] != '') { + $("#delete_table-edit21").after(""+macro['desc']+""); + } + }); + //Plugin text can be larger + $(".macro_field").find(":input").attr("maxlength", 1023); + // Add again the hover event to the 'force_callback' elements + forced_title_callback(); + } + } + }); + } function disabled_status () { - if($('#dynamic_interval_select').val() != 0){ - $('#text-min_warning').prop('readonly', true); - $('#text-min_warning').addClass('readonly'); - $('#text-max_warning').prop('readonly', true); - $('#text-max_warning').addClass('readonly'); - $('#text-min_critical').prop('readonly', true); - $('#text-min_critical').addClass('readonly'); - $('#text-max_critical').prop('readonly', true); - $('#text-max_critical').addClass('readonly'); - } else { - $('#text-min_warning').prop('readonly', false); - $('#text-min_warning').removeClass('readonly'); - $('#text-max_warning').prop('readonly', false); - $('#text-max_warning').removeClass('readonly'); - $('#text-min_critical').prop('readonly', false); - $('#text-min_critical').removeClass('readonly'); - $('#text-max_critical').prop('readonly', false); - $('#text-max_critical').removeClass('readonly'); - } + if($('#dynamic_interval_select').val() != 0){ + $('#text-min_warning').prop('readonly', true); + $('#text-min_warning').addClass('readonly'); + $('#text-max_warning').prop('readonly', true); + $('#text-max_warning').addClass('readonly'); + $('#text-min_critical').prop('readonly', true); + $('#text-min_critical').addClass('readonly'); + $('#text-max_critical').prop('readonly', true); + $('#text-max_critical').addClass('readonly'); + } else { + $('#text-min_warning').prop('readonly', false); + $('#text-min_warning').removeClass('readonly'); + $('#text-max_warning').prop('readonly', false); + $('#text-max_warning').removeClass('readonly'); + $('#text-min_critical').prop('readonly', false); + $('#text-min_critical').removeClass('readonly'); + $('#text-max_critical').prop('readonly', false); + $('#text-max_critical').removeClass('readonly'); + } } /* ]]> */ (int)$throw_unknown_events); - $values['disabled_types_event'] = json_encode($disabled_types_event); - } + return false; + } - if (strlen(get_parameter('history_data')) > 0) { - $values['history_data'] = get_parameter('history_data'); - } + if (!is_array($agents_select)) { + $agents_select = [$agents_select]; + } - if (get_parameter('quiet_select', -1) != -1) { - $values['quiet'] = get_parameter('quiet_select'); - } + // List of fields which can be updated + $fields = [ + 'dynamic_interval', + 'dynamic_max', + 'dynamic_min', + 'dynamic_two_tailed', + 'min_warning', + 'max_warning', + 'str_warning', + 'min_critical', + 'max_critical', + 'str_critical', + 'min_ff_event', + 'module_interval', + 'disabled', + 'post_process', + 'unit_select', + 'snmp_community', + 'snmp_oid', + 'tcp_send', + 'custom_string_1', + 'plugin_parameter', + 'custom_string_2', + 'custom_string_3', + 'min', + 'max', + 'id_module_group', + 'plugin_user', + 'plugin_pass', + 'id_export', + 'history_data', + 'critical_inverse', + 'warning_inverse', + 'critical_instructions', + 'warning_instructions', + 'unknown_instructions', + 'policy_linked', + 'id_category', + 'disabled_types_event', + 'ip_target', + 'custom_ip_target', + 'descripcion', + 'min_ff_event_normal', + 'min_ff_event_warning', + 'min_ff_event_critical', + 'each_ff', + 'module_ff_interval', + 'ff_timeout', + 'max_timeout', + 'tcp_port', + 'max_retries', + 'tcp_rcv', + 'id_plugin', + 'wmi_query', + 'key_string', + 'field_number', + 'tcp_send2', + 'plugin_parameter_text', + ]; + $values = []; - $filter_modules = false; + foreach ($fields as $field) { + $value = get_parameter($field, ''); - if (!is_numeric($module_name) or ($module_name != 0)) - $filter_modules['nombre'] = $module_name; + switch ($field) { + case 'id_plugin': + if ($value != 0) { + $value_field_1 = get_parameter('_field1_', ''); + $value_field_1_desc = get_parameter('desc_field1_', ''); - // Whether to update module tag info - $update_tags = get_parameter('id_tag', false); + $value_field_2 = get_parameter('_field2_', ''); + $value_field_2_desc = get_parameter('desc_field2_', ''); - if (array_search(0, $agents_select) !== false) { + $value_field_3 = get_parameter('_field3_', ''); + $value_field_3_desc = get_parameter('desc_field3_', ''); - //Apply at All agents. - $modules = db_get_all_rows_filter ('tagente_modulo', - $filter_modules, - array ('id_agente_modulo')); - } - else { + $value_field_4 = get_parameter('_field4_', ''); + $value_field_4_desc = get_parameter('desc_field4_', ''); - if ($module_name == "0") { - //Any module - $modules = db_get_all_rows_filter ('tagente_modulo', - array ('id_agente' => $agents_select), - array ('id_agente_modulo')); - } - else { - $modules = db_get_all_rows_filter ('tagente_modulo', - array ('id_agente' => $agents_select, - 'nombre' => $module_name), - array ('id_agente_modulo')); - } - } + $value_field_5 = get_parameter('_field5_', ''); + $value_field_5_desc = get_parameter('desc_field5_', ''); + $values['macros'] = '{"1":{"macro":"_field1_","desc":"'.io_safe_input($value_field_1_desc).'","help":"'.io_safe_input($value_field_1_desc).'","value":"'.$value_field_1.'"}'; - if ($modules === false) - return false; + if ($value_field_2_desc != '') { + $values['macros'] .= ',"2":{"macro":"_field2_","desc":"'.io_safe_input($value_field_2_desc).'","help":"'.io_safe_input($value_field_2_desc).'","value":"'.$value_field_2.'"}'; - if (($module_status == 'unknown') && ($module_name == "0")) { - $modules_to_delete = array(); - foreach ($modules as $mod_id) { - $mod_status = (int)db_get_value_filter ('estado', 'tagente_estado', array('id_agente_modulo' => $mod_id)); + if ($value_field_3_desc != '') { + $values['macros'] .= ',"3":{"macro":"_field3_","desc":"'.io_safe_input($value_field_3_desc).'","help":"'.io_safe_input($value_field_3_desc).'","value":"'.$value_field_3.'"}'; - // Unknown, not init and no data modules - if ($mod_status == 3 || $mod_status == 4 || $mod_status == 5) { - $modules_to_delete[$mod_id] = $mod_id; - } - } - $modules = $modules_to_delete; - } + if ($value_field_4_desc != '') { + $values['macros'] .= ',"4":{"macro":"_field4_","desc":"'.io_safe_input($value_field_4_desc).'","help":"'.io_safe_input($value_field_4_desc).'","value":"'.$value_field_4.'"}'; - foreach ($modules as $module) { - - $result = modules_update_agent_module( - $module['id_agente_modulo'], $values, true, $update_tags); + if ($value_field_5_desc != '') { + $values['macros'] .= ',"5":{"macro":"_field5_","desc":"'.io_safe_input($value_field_5_desc).'","help":"'.io_safe_input($value_field_5_desc).'","value":"'.$value_field_5.'"}'; + } else { + $values['macros'] .= '}'; + } + } else { + $values['macros'] .= '}'; + } + } else { + $values['macros'] .= '}'; + } + } else { + $values['macros'] .= '}'; + } + } + break; + case 'module_interval': + if ($value != 0) { + $values[$field] = $value; + } + break; - if (is_error($result)) - return false; + case 'plugin_pass': + if ($value != '') { + $values['plugin_pass'] = io_input_password($value); + } + break; - } - - return true; + case 'post_process': + if ($value !== '-1') { + $values['post_process'] = $value; + } + break; + + case 'unit_select': + if ($value != -1) { + if ($value == 'none') { + $values['unit'] = (string) get_parameter('unit_text'); + } else { + $values['unit'] = $value; + } + } + break; + + case 'wmi_query': + if ($value != '') { + $values['snmp_oid'] = $value; + } + break; + + case 'key_string': + if ($value != '') { + $values['snmp_community'] = $value; + } + break; + + case 'field_number': + if ($value != '') { + $values['tcp_port'] = $value; + } + break; + + case 'tcp_send2': + if ($value != '') { + $values['tcp_send'] = $value; + } + break; + + case 'plugin_parameter_text': + if ($value != '') { + $values['plugin_parameter'] = $value; + } + break; + + default: + if ($value != '') { + $values[$field] = $value; + } + break; + } + } + + // Specific snmp reused fields + if (get_parameter('tcp_send', '') == 3) { + $plugin_user_snmp = get_parameter('plugin_user_snmp', ''); + if ($plugin_user_snmp != '') { + $values['plugin_user'] = $plugin_user_snmp; + } + + $plugin_pass_snmp = get_parameter('plugin_pass_snmp', ''); + if ($plugin_pass_snmp != '') { + $values['plugin_pass'] = io_input_password($plugin_pass_snmp); + } + + $snmp3_privacy_pass = get_parameter('custom_string_2', ''); + if ($snmp3_privacy_pass != '') { + $values['custom_string_2'] = io_input_password($snmp3_privacy_pass); + } + } + + $throw_unknown_events = get_parameter('throw_unknown_events', ''); + if ($throw_unknown_events !== '') { + // Set the event type that can show. + $disabled_types_event = [ + EVENTS_GOING_UNKNOWN => (int) $throw_unknown_events, + ]; + $values['disabled_types_event'] = json_encode($disabled_types_event); + } + + if (strlen(get_parameter('history_data')) > 0) { + $values['history_data'] = get_parameter('history_data'); + } + + if (get_parameter('quiet_select', -1) != -1) { + $values['quiet'] = get_parameter('quiet_select'); + } + + $filter_modules = false; + + if (!is_numeric($module_name) or ($module_name != 0)) { + $filter_modules['nombre'] = $module_name; + } + + // Whether to update module tag info + $update_tags = get_parameter('id_tag', false); + + if (array_search(0, $agents_select) !== false) { + // Apply at All agents. + $modules = db_get_all_rows_filter( + 'tagente_modulo', + $filter_modules, + ['id_agente_modulo'] + ); + } else { + if ($module_name == '0') { + // Any module + $modules = db_get_all_rows_filter( + 'tagente_modulo', + ['id_agente' => $agents_select], + ['id_agente_modulo'] + ); + } else { + $modules = db_get_all_rows_filter( + 'tagente_modulo', + [ + 'id_agente' => $agents_select, + 'nombre' => $module_name, + ], + ['id_agente_modulo'] + ); + } + } + + if ($modules === false) { + return false; + } + + if (($module_status == 'unknown') && ($module_name == '0')) { + $modules_to_delete = []; + foreach ($modules as $mod_id) { + $mod_status = (int) db_get_value_filter('estado', 'tagente_estado', ['id_agente_modulo' => $mod_id]); + + // Unknown, not init and no data modules + if ($mod_status == 3 || $mod_status == 4 || $mod_status == 5) { + $modules_to_delete[$mod_id] = $mod_id; + } + } + + $modules = $modules_to_delete; + } + + foreach ($modules as $module) { + $result = modules_update_agent_module( + $module['id_agente_modulo'], + $values, + true, + $update_tags + ); + + if (is_error($result)) { + return false; + } + } + + return true; } -?> From c2a44e073fe0c63c17a2f2a79288fedffb8b4c74 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Thu, 7 Feb 2019 18:03:28 +0100 Subject: [PATCH 08/16] Update events.build_query.php Former-commit-id: 4622b27b1ce9e81ce81d89d7bc9d2eeb1b30fb93 --- .../operation/events/events.build_query.php | 82 ++++++++++--------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/pandora_console/operation/events/events.build_query.php b/pandora_console/operation/events/events.build_query.php index 4aa9e4a567..3af11f86b7 100755 --- a/pandora_console/operation/events/events.build_query.php +++ b/pandora_console/operation/events/events.build_query.php @@ -41,6 +41,39 @@ if ($id_group > 0) { $childrens_ids = array_keys($groups); } +if (($date_from == '') && ($date_to == '')) { + if ($event_view_hr > 0) { + $filter_resume['hours_max'] = $event_view_hr; + $unixtime = (get_system_time() - ($event_view_hr * SECONDS_1HOUR)); + $sql_post .= ' AND (utimestamp > '.$unixtime.')'; + } +} else { + // Some of this values will have the user's timezone, + // so we need to reverse it to the system's timezone + // before using it into the db. + $fixed_offset = get_fixed_offset(); + + if (!empty($date_from)) { + if (empty($time_from)) { + $time_from = '00:00:00'; + } + + $utimestamp_from = (strtotime($date_from.' '.$time_from) - $fixed_offset); + $filter_resume['time_from'] = date(DATE_FORMAT.' '.TIME_FORMAT, $utimestamp_from); + $sql_post .= ' AND (utimestamp >= '.$utimestamp_from.')'; + } + + if (!empty($date_to)) { + if (empty($time_to)) { + $time_to = '23:59:59'; + } + + $utimestamp_to = (strtotime($date_to.' '.$time_to) - $fixed_offset); + $filter_resume['time_to'] = date(DATE_FORMAT.' '.TIME_FORMAT, $utimestamp_to); + $sql_post .= ' AND (utimestamp <= '.$utimestamp_to.')'; + } +} + // Group selection if ($id_group > 0 && in_array($id_group, array_keys($groups))) { if ($propagate) { @@ -51,11 +84,15 @@ if ($id_group > 0 && in_array($id_group, array_keys($groups))) { $sql_post = " AND (id_grupo = $id_group OR id_group = $id_group)"; } } else { - $sql_post = sprintf( - ' AND (id_grupo IN (%s) OR id_group IN (%s)) ', - implode(',', array_keys($groups)), - implode(',', array_keys($groups)) - ); + hd(users_can_manage_group_all('ER')); + if (!users_is_admin() && !users_can_manage_group_all('ER')) { + hd(users_can_manage_group_all('ER')); + $sql_post = sprintf( + ' AND (id_grupo IN (%s) OR id_group IN (%s)) ', + implode(',', array_keys($groups)), + implode(',', array_keys($groups)) + ); + } } // Skip system messages if user is not PM @@ -218,39 +255,6 @@ if (!isset($date_to)) { $date_to = ''; } -if (($date_from == '') && ($date_to == '')) { - if ($event_view_hr > 0) { - $filter_resume['hours_max'] = $event_view_hr; - $unixtime = (get_system_time() - ($event_view_hr * SECONDS_1HOUR)); - $sql_post .= ' AND (utimestamp > '.$unixtime.')'; - } -} else { - // Some of this values will have the user's timezone, - // so we need to reverse it to the system's timezone - // before using it into the db - $fixed_offset = get_fixed_offset(); - - if (!empty($date_from)) { - if (empty($time_from)) { - $time_from = '00:00:00'; - } - - $utimestamp_from = (strtotime($date_from.' '.$time_from) - $fixed_offset); - $filter_resume['time_from'] = date(DATE_FORMAT.' '.TIME_FORMAT, $utimestamp_from); - $sql_post .= ' AND (utimestamp >= '.$utimestamp_from.')'; - } - - if (!empty($date_to)) { - if (empty($time_to)) { - $time_to = '23:59:59'; - } - - $utimestamp_to = (strtotime($date_to.' '.$time_to) - $fixed_offset); - $filter_resume['time_to'] = date(DATE_FORMAT.' '.TIME_FORMAT, $utimestamp_to); - $sql_post .= ' AND (utimestamp <= '.$utimestamp_to.')'; - } -} - // Search by tag if (!empty($tag_with)) { if (!users_is_admin()) { @@ -398,3 +402,5 @@ if ($meta) { } } } + +hd($sql_post); From ba7540c9ee79344b81dd820d95458f24b4003aac Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Fri, 8 Feb 2019 09:51:08 +0100 Subject: [PATCH 09/16] improvement of optimization for list event Former-commit-id: a7788b01160c661139e6a3a6aac70c69441265a1 --- .../operation/events/events.build_query.php | 57 ++++++++----------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/pandora_console/operation/events/events.build_query.php b/pandora_console/operation/events/events.build_query.php index 3af11f86b7..85d0de9a7d 100755 --- a/pandora_console/operation/events/events.build_query.php +++ b/pandora_console/operation/events/events.build_query.php @@ -19,7 +19,6 @@ if (check_acl($id_user, 0, 'ER')) { $groups = users_get_groups($id_user, 'EM'); } - $propagate = db_get_value('propagate', 'tgrupo', 'id_grupo', $id_group); if ($id_group > 0) { @@ -41,7 +40,15 @@ if ($id_group > 0) { $childrens_ids = array_keys($groups); } -if (($date_from == '') && ($date_to == '')) { +if (!isset($date_from)) { + $date_from = ''; +} + +if (!isset($date_to)) { + $date_to = ''; +} + +if (($date_from === '') && ($date_to === '')) { if ($event_view_hr > 0) { $filter_resume['hours_max'] = $event_view_hr; $unixtime = (get_system_time() - ($event_view_hr * SECONDS_1HOUR)); @@ -74,20 +81,18 @@ if (($date_from == '') && ($date_to == '')) { } } -// Group selection +// Group selection. if ($id_group > 0 && in_array($id_group, array_keys($groups))) { if ($propagate) { $childrens_str = implode(',', $childrens_ids); - $sql_post = " AND (id_grupo IN ($childrens_str) OR id_group IN ($childrens_str))"; + $sql_post .= " AND (id_grupo IN ($childrens_str) OR id_group IN ($childrens_str))"; } else { - // If a group is selected and it's in the groups allowed - $sql_post = " AND (id_grupo = $id_group OR id_group = $id_group)"; + // If a group is selected and it's in the groups allowed. + $sql_post .= " AND (id_grupo = $id_group OR id_group = $id_group)"; } } else { - hd(users_can_manage_group_all('ER')); if (!users_is_admin() && !users_can_manage_group_all('ER')) { - hd(users_can_manage_group_all('ER')); - $sql_post = sprintf( + $sql_post .= sprintf( ' AND (id_grupo IN (%s) OR id_group IN (%s)) ', implode(',', array_keys($groups)), implode(',', array_keys($groups)) @@ -95,7 +100,7 @@ if ($id_group > 0 && in_array($id_group, array_keys($groups))) { } } -// Skip system messages if user is not PM +// Skip system messages if user is not PM. if (!check_acl($id_user, 0, 'PM')) { $sql_post .= ' AND id_grupo != 0'; } @@ -201,7 +206,7 @@ if ($source != '') { $sql_post .= " AND source LIKE '%$source%'"; } -// In metaconsole mode the agent search is performed by name +// In metaconsole mode the agent search is performed by name. if ($meta) { $text_agent = get_parameter('text_agent', ''); $id_agent = get_parameter('id_agent', 0); @@ -216,7 +221,7 @@ if ($meta) { break; case -1: - // Agent doesnt exist. No results will returned + // Agent doesnt exist. No results will returned. $sql_post .= ' AND 1 = 0'; break; @@ -229,9 +234,7 @@ if ($meta) { -if ($meta) { - // There is another filter. -} else { +if (!$meta) { if (!empty($text_module)) { $filter_resume['module'] = $text_module; $sql_post .= " AND id_agentmodule IN ( @@ -247,15 +250,7 @@ if ($id_user_ack != '0') { $sql_post .= " AND id_usuario = '".$id_user_ack."'"; } -if (!isset($date_from)) { - $date_from = ''; -} - -if (!isset($date_to)) { - $date_to = ''; -} - -// Search by tag +// Search by tag. if (!empty($tag_with)) { if (!users_is_admin()) { $user_tags = array_flip(tags_get_tags_for_module_search()); @@ -309,7 +304,7 @@ if (!empty($tag_without)) { $sql_post .= ' ) '; } -// Filter/Only alerts +// Filter/Only alerts. if (isset($filter_only_alert)) { if ($filter_only_alert == 0) { $filter_resume['alerts'] = $filter_only_alert; @@ -320,7 +315,7 @@ if (isset($filter_only_alert)) { } } -// Tags ACLS +// Tags ACLS. if ($id_group > 0 && in_array($id_group, array_keys($groups))) { $group_array = (array) $id_group; } else { @@ -339,7 +334,7 @@ if (check_acl($id_user, 0, 'ER')) { [], true ); - // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)" + // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)". } else if (check_acl($id_user, 0, 'EW')) { $tags_acls_condition = tags_get_acl_tags( $id_user, @@ -352,7 +347,7 @@ if (check_acl($id_user, 0, 'ER')) { [], true ); - // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)" + // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)". } else if (check_acl($id_user, 0, 'EM')) { $tags_acls_condition = tags_get_acl_tags( $id_user, @@ -365,14 +360,14 @@ if (check_acl($id_user, 0, 'ER')) { [], true ); - // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)" + // FORCE CHECK SQL "(TAG = tag1 AND id_grupo = 1)". } if (($tags_acls_condition != ERR_WRONG_PARAMETERS) && ($tags_acls_condition != ERR_ACL) && ($tags_acls_condition != -110000)) { $sql_post .= $tags_acls_condition; } -// Metaconsole fitlers +// Metaconsole fitlers. if ($meta) { if ($server_id) { $filter_resume['server'] = $server_id; @@ -402,5 +397,3 @@ if ($meta) { } } } - -hd($sql_post); From 4c809ba8d2e68755b7ed11b2cf5557446324eb77 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Wed, 13 Feb 2019 15:41:34 +0100 Subject: [PATCH 10/16] event query optimization Former-commit-id: 322868d281ddeac4006480bac6dbf03434ffefa1 --- pandora_console/include/functions_events.php | 124 +++++-------------- 1 file changed, 28 insertions(+), 96 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index f3f3d2b0fa..4cc54c5857 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -166,92 +166,30 @@ function events_get_events_grouped( $groupby_extra = ''; } - switch ($config['dbtype']) { - case 'mysql': - db_process_sql('SET group_concat_max_len = 9999999'); - $event_lj = events_get_secondary_groups_left_join($table); - if ($total) { - $sql = "SELECT COUNT(*) FROM (SELECT * - FROM $table te $event_lj - WHERE 1=1 ".$sql_post.' - GROUP BY estado, evento, id_agente, id_agentmodule'.$groupby_extra.') AS t'; - } else { - $sql = "SELECT *, MAX(id_evento) AS id_evento, - GROUP_CONCAT(DISTINCT user_comment SEPARATOR '
') AS user_comment, - GROUP_CONCAT(DISTINCT id_evento SEPARATOR ',') AS similar_ids, - COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep, - MIN(utimestamp) AS timestamp_rep_min, - (SELECT owner_user FROM $table WHERE id_evento = MAX(te.id_evento)) owner_user, - (SELECT id_usuario FROM $table WHERE id_evento = MAX(te.id_evento)) id_usuario, - (SELECT id_agente FROM $table WHERE id_evento = MAX(te.id_evento)) id_agente, - (SELECT criticity FROM $table WHERE id_evento = MAX(te.id_evento)) AS criticity, - (SELECT ack_utimestamp FROM $table WHERE id_evento = MAX(te.id_evento)) AS ack_utimestamp, - (SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = te.id_agentmodule) AS module_name - FROM $table te $event_lj - WHERE 1=1 ".$sql_post.' - GROUP BY estado, evento, id_agente, id_agentmodule'.$groupby_extra; - $sql .= ' '.events_get_sql_order($sort_field, $order, 2); - $sql .= ' LIMIT '.$offset.','.$pagination; - } - break; - - case 'postgresql': - if ($total) { - $sql = "SELECT COUNT(*) - FROM $table te - WHERE 1=1 ".$sql_post.' - GROUP BY estado, evento, id_agentmodule, id_evento, id_agente, id_usuario, id_grupo, estado, timestamp, utimestamp, event_type, id_alert_am, criticity, user_comment, tags, source, id_extra'.$groupby_extra; - } else { - $sql = "SELECT *, MAX(id_evento) AS id_evento, array_to_string(array_agg(DISTINCT user_comment), '
') AS user_comment, - array_to_string(array_agg(DISTINCT id_evento), ',') AS similar_ids, - COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep, - MIN(utimestamp) AS timestamp_rep_min, - (SELECT owner_user FROM $table WHERE id_evento = MAX(te.id_evento)) owner_user, - (SELECT id_usuario FROM $table WHERE id_evento = MAX(te.id_evento)) id_usuario, - (SELECT id_agente FROM $table WHERE id_evento = MAX(te.id_evento)) id_agente, - (SELECT criticity FROM $table WHERE id_evento = MAX(te.id_evento)) AS criticity, - (SELECT ack_utimestamp FROM $table WHERE id_evento = MAX(te.id_evento)) AS ack_utimestamp - FROM $table te - WHERE 1=1 ".$sql_post.' - GROUP BY estado, evento, id_agentmodule, id_evento, - id_agente, id_usuario, id_grupo, estado, - timestamp, utimestamp, event_type, id_alert_am, - criticity, user_comment, tags, source, id_extra, - te.critical_instructions, - te.warning_instructions, - te.unknown_instructions, - te.owner_user, - te.ack_utimestamp, - te.custom_data '.$groupby_extra.' - ORDER BY timestamp_rep ASC LIMIT '.$pagination.' OFFSET '.$offset; - } - break; - - case 'oracle': - if ($total) { - $sql = "SELECT COUNT(*) - FROM $table te - WHERE 1=1 $sql_post - GROUP BY estado, to_char(evento), id_agentmodule".$groupby_extra.') b '; - } else { - $set = []; - $set['limit'] = $pagination; - $set['offset'] = $offset; - - $sql = "SELECT ta.*, tb.event_rep, tb.timestamp_rep, tb.timestamp_rep_min, tb.user_comments, tb.similar_ids - FROM $table ta - INNER JOIN (SELECT MAX(id_evento) AS id_evento, COUNT(id_evento) AS event_rep, - MAX(utimestamp) AS timestamp_rep, MIN(utimestamp) AS timestamp_rep_min, - TAB_TO_STRING(CAST(COLLECT(TO_CHAR(user_comment) ORDER BY id_evento ASC) AS t_varchar2_tab), '
') AS user_comments, - TAB_TO_STRING(CAST(COLLECT(CAST(id_evento AS VARCHAR2(4000)) ORDER BY id_evento ASC) AS t_varchar2_tab)) AS similar_ids - FROM $table te - WHERE 1=1 $sql_post - GROUP BY estado, to_char(evento), id_agentmodule$groupby_extra) tb - ON ta.id_evento = tb.id_evento - ORDER BY tb.timestamp_rep ASC"; - $sql = oracle_recode_query($sql, $set); - } - break; + db_process_sql('SET group_concat_max_len = 9999999'); + $event_lj = events_get_secondary_groups_left_join($table); + if ($total) { + $sql = "SELECT COUNT(*) FROM (SELECT id_evento + FROM $table te $event_lj + WHERE 1=1 ".$sql_post.' + GROUP BY estado, evento, id_agente, id_agentmodule'.$groupby_extra.') AS t'; + } else { + $sql = "SELECT *, MAX(id_evento) AS id_evento, + GROUP_CONCAT(DISTINCT user_comment SEPARATOR '
') AS user_comment, + GROUP_CONCAT(DISTINCT id_evento SEPARATOR ',') AS similar_ids, + COUNT(id_evento) AS event_rep, MAX(utimestamp) AS timestamp_rep, + MIN(utimestamp) AS timestamp_rep_min, + (SELECT owner_user FROM $table WHERE id_evento = MAX(te.id_evento)) owner_user, + (SELECT id_usuario FROM $table WHERE id_evento = MAX(te.id_evento)) id_usuario, + (SELECT id_agente FROM $table WHERE id_evento = MAX(te.id_evento)) id_agente, + (SELECT criticity FROM $table WHERE id_evento = MAX(te.id_evento)) AS criticity, + (SELECT ack_utimestamp FROM $table WHERE id_evento = MAX(te.id_evento)) AS ack_utimestamp, + (SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = te.id_agentmodule) AS module_name + FROM $table te $event_lj + WHERE 1=1 ".$sql_post.' + GROUP BY estado, evento, id_agente, id_agentmodule'.$groupby_extra; + $sql .= ' '.events_get_sql_order($sort_field, $order, 2); + $sql .= ' LIMIT '.$offset.','.$pagination; } // Extract the events by filter (or not) from db @@ -260,16 +198,6 @@ function events_get_events_grouped( if ($total) { return reset($events[0]); } else { - // Override the column 'user_comment' with the column 'user_comments' when oracle - if (!empty($events) && $config['dbtype'] == 'oracle') { - array_walk( - $events, - function (&$value, $key) { - set_if_defined($value['user_comment'], $value['user_comments']); - } - ); - } - return $events; } } @@ -4871,6 +4799,10 @@ function events_get_sql_order($sort_field='timestamp', $sort='DESC', $group_rep= */ function events_get_secondary_groups_left_join($table) { + if (users_is_admin()) { + return ''; + } + if ($table == 'tevento') { return 'LEFT JOIN tagent_secondary_group tasg ON te.id_agente = tasg.id_agent'; } From d9ba3af358495127cf9754cc205735cd8263e7b4 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Date: Thu, 14 Feb 2019 16:31:19 +0100 Subject: [PATCH 11/16] Fixed errors in setup performances Former-commit-id: 1eb48c00f527f43504a41aea8b352f30792e080b --- pandora_console/godmode/setup/performance.php | 198 ++++++++++-------- 1 file changed, 110 insertions(+), 88 deletions(-) diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index 66c99ea57c..946a39770d 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -63,76 +63,85 @@ if ($update_config == 1 && $config['history_db_enabled'] == 1) { $historical_event_purge = get_parameter('historical_event_purge', 0); $historical_string_purge = get_parameter('historical_string_purge', 0); - $config_history = mysql_db_process_sql( - 'SELECT * FROM tconfig', + $history_connect = @mysql_db_process_sql( + 'SELECT 1 FROM tconfig', 'affected_rows', $config['history_db_connection'], false ); - if (!$config_history) { - $sql = "INSERT INTO tconfig (token, `value`) VALUES - ('days_purge', ".$historical_days_purge."), - ('days_compact', ".$historical_days_compact."), - ('step_compact', ".$historical_step_compact."), - ('event_purge', ".$historical_event_purge."), - ('string_purge', ".$historical_string_purge."), - ('history_db_enabled', 0)"; + $config_history = false; + if ($history_connect !== false) { + $config_history = mysql_db_process_sql( + 'SELECT * FROM tconfig', + 'affected_rows', + $config['history_db_connection'], + false + ); - mysql_db_process_sql( - $sql, - 'insert_id', - $config['history_db_connection'], - false - ); - } else { - $sql = 'UPDATE tconfig SET `value` = '.$historical_days_purge." WHERE token = 'days_purge'"; - mysql_db_process_sql( - $sql, - 'update_id', - $config['history_db_connection'], - false - ); - $sql = 'UPDATE tconfig SET `value` = '.$historical_days_compact." WHERE token = 'days_compact'"; - mysql_db_process_sql( - $sql, - 'update_id', - $config['history_db_connection'], - false - ); - $sql = 'UPDATE tconfig SET `value` = '.$historical_step_compact." WHERE token = 'step_compact'"; - mysql_db_process_sql( - $sql, - 'update_id', - $config['history_db_connection'], - false - ); - $sql = 'UPDATE tconfig SET `value` = '.$historical_event_purge." WHERE token = 'event_purge'"; - mysql_db_process_sql( - $sql, - 'update_id', - $config['history_db_connection'], - false - ); - $sql = 'UPDATE tconfig SET `value` = '.$historical_string_purge." WHERE token = 'string_purge'"; - mysql_db_process_sql( - $sql, - 'update_id', - $config['history_db_connection'], - false - ); - $sql = "UPDATE tconfig SET `value` = 0 WHERE token = 'history_db_enabled'"; - mysql_db_process_sql( - $sql, - 'update_id', - $config['history_db_connection'], - false - ); + if (!$config_history) { + $sql = "INSERT INTO tconfig (token, `value`) VALUES + ('days_purge', ".$historical_days_purge."), + ('days_compact', ".$historical_days_compact."), + ('step_compact', ".$historical_step_compact."), + ('event_purge', ".$historical_event_purge."), + ('string_purge', ".$historical_string_purge."), + ('history_db_enabled', 0)"; + + mysql_db_process_sql( + $sql, + 'insert_id', + $config['history_db_connection'], + false + ); + } else { + $sql = 'UPDATE tconfig SET `value` = '.$historical_days_purge." WHERE token = 'days_purge'"; + mysql_db_process_sql( + $sql, + 'update_id', + $config['history_db_connection'], + false + ); + $sql = 'UPDATE tconfig SET `value` = '.$historical_days_compact." WHERE token = 'days_compact'"; + mysql_db_process_sql( + $sql, + 'update_id', + $config['history_db_connection'], + false + ); + $sql = 'UPDATE tconfig SET `value` = '.$historical_step_compact." WHERE token = 'step_compact'"; + mysql_db_process_sql( + $sql, + 'update_id', + $config['history_db_connection'], + false + ); + $sql = 'UPDATE tconfig SET `value` = '.$historical_event_purge." WHERE token = 'event_purge'"; + mysql_db_process_sql( + $sql, + 'update_id', + $config['history_db_connection'], + false + ); + $sql = 'UPDATE tconfig SET `value` = '.$historical_string_purge." WHERE token = 'string_purge'"; + mysql_db_process_sql( + $sql, + 'update_id', + $config['history_db_connection'], + false + ); + $sql = "UPDATE tconfig SET `value` = 0 WHERE token = 'history_db_enabled'"; + mysql_db_process_sql( + $sql, + 'update_id', + $config['history_db_connection'], + false + ); + } } } } - $table_status = new StdClass(); $table_status->width = '100%'; $table_status->class = 'databox filters'; @@ -147,6 +156,7 @@ $sql = "SELECT UNIX_TIMESTAMP(NOW()) - `value` AS updated_at $time_pandora_db_active = db_get_sql($sql); + if ($time_pandora_db_active < SECONDS_12HOURS) { $table_status->data[0][0] = html_print_image( 'images/dot_green.png', @@ -168,11 +178,6 @@ $table_status->data[0][0] .= human_time_description_raw( $table_status->data[0][0] .= ' '.__('ago').'.'; -$table_status->data[0][0] .= ui_print_help_tip( - __('WIP'), - true -); - if ($config['history_db_enabled'] == 1) { if (! isset($config['history_db_connection']) || $config['history_db_connection'] === false @@ -187,13 +192,23 @@ if ($config['history_db_enabled'] == 1) { ); } - if ($config['history_db_connection'] !== false) { - $time_pandora_db_history = mysql_db_process_sql( - $sql, - 'insert_id', - $config['history_db_connection'], - false - ); + $history_connect = @mysql_db_process_sql( + 'SELECT 1 FROM tconfig', + 'affected_rows', + $config['history_db_connection'], + false + ); + + $time_pandora_db_history = false; + if ($history_connect !== false) { + if ($config['history_db_connection'] !== false) { + $time_pandora_db_history = mysql_db_process_sql( + $sql, + 'insert_id', + $config['history_db_connection'], + false + ); + } } if ($time_pandora_db_history !== false @@ -220,11 +235,6 @@ if ($config['history_db_enabled'] == 1) { } else { $table_status->data[1][0] .= __('not executed'); } - - $table_status->data[1][0] .= ui_print_help_tip( - __('WIP'), - true - ); } @@ -395,21 +405,33 @@ if ($config['history_db_enabled'] == 1) { ); } - if ($config['history_db_connection'] != false) { - $config_history_array = mysql_db_process_sql( - 'SELECT * FROM tconfig', - 'affected_rows', - $config['history_db_connection'], - false - ); + $history_connect = @mysql_db_process_sql( + 'SELECT 1 FROM tconfig', + 'affected_rows', + $config['history_db_connection'], + false + ); - $config_history = false; + $config_history = false; + if ($history_connect !== false) { + if ($config['history_db_connection'] != false) { + $config_history_array = mysql_db_process_sql( + 'SELECT * FROM tconfig', + 'affected_rows', + $config['history_db_connection'], + false + ); - if (isset($config_history_array) && is_array($config_history_array)) { - foreach ($config_history_array as $key => $value) { - $config_history[$value['token']] = $value['value']; + if (isset($config_history_array) && is_array($config_history_array)) { + foreach ($config_history_array as $key => $value) { + $config_history[$value['token']] = $value['value']; + } } } + } else { + echo ui_print_error_message( + __('The tconfig table does not exist in the bbdd') + ); } if ($config_history === false) { From 624d8041683a594bbe1658e7237d6ef34e92fd63 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Date: Thu, 14 Feb 2019 16:53:01 +0100 Subject: [PATCH 12/16] Fixed minor error Former-commit-id: 05fc8b97c42ee9907954cb28d9e560c9076d50e9 --- pandora_console/godmode/setup/performance.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php index 946a39770d..9e663e63cc 100644 --- a/pandora_console/godmode/setup/performance.php +++ b/pandora_console/godmode/setup/performance.php @@ -430,7 +430,7 @@ if ($config['history_db_enabled'] == 1) { } } else { echo ui_print_error_message( - __('The tconfig table does not exist in the bbdd') + __('The tconfig table does not exist in the historical database') ); } From cd83f324a1385e813aac1e4d345a8cbc78fbf838 Mon Sep 17 00:00:00 2001 From: artica Date: Fri, 15 Feb 2019 00:01:26 +0100 Subject: [PATCH 13/16] Auto-updated build strings. Former-commit-id: 3efb9b48fb3cc1021d0b3e7752c3cd1607e863a5 --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 4 ++-- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 0ee00a8f17..c9e01190e9 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.731-190214 +Version: 7.0NG.731-190215 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 9ebfc5d3dc..f50b4ee8dc 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190214" +pandora_version="7.0NG.731-190215" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 664a9964e3..187f94b41d 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.731'; -use constant AGENT_BUILD => '190214'; +use constant AGENT_BUILD => '190215'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 5c097c9a07..16bf75ef2f 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190214 +%define release 190215 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 820f5d3ec1..1dd06bf43e 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190214 +%define release 190215 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 8adeac4f7a..340a0c2712 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190214" +PI_BUILD="190215" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 3b606d8ec0..b7dff2f2ec 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190214} +{190215} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 30fff5f13b..48aba959cb 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.731(Build 190214)") +#define PANDORA_VERSION ("7.0NG.731(Build 190215)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index a34c9905ea..2b58063706 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.731(Build 190214))" + VALUE "ProductVersion", "(7.0NG.731(Build 190215))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 285b64c80f..12ecde5daf 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.731-190214 +Version: 7.0NG.731-190215 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 02c1b2ed71..0171643ae5 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190214" +pandora_version="7.0NG.731-190215" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 380d9b5a0b..4de1f20d2f 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190214'; +$build_version = 'PC190215'; $pandora_version = 'v7.0NG.731'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 2a190ff74e..5608de3f79 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -128,8 +128,8 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 0c678b8e79..e0834c0d3a 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190214 +%define release 190215 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index c2eabe1dbe..29a5c3e307 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190214 +%define release 190215 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 3ed28d9c0c..1b9483c5fe 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190214" +PI_BUILD="190215" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 312570299d..97816668a5 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.731 PS190214"; +my $version = "7.0NG.731 PS190215"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index c7f32c51d7..08854530dd 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.731 PS190214"; +my $version = "7.0NG.731 PS190215"; # save program name for logging my $progname = basename($0); From 0d93ccc09437c429d1775ae7781b11f8aaaa6945 Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 16 Feb 2019 00:01:31 +0100 Subject: [PATCH 14/16] Auto-updated build strings. Former-commit-id: 8789c127ad23a066317bd86d0bfe456dd4a3ec38 --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index c9e01190e9..b9d79cac74 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.731-190215 +Version: 7.0NG.731-190216 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index f50b4ee8dc..ec6468c904 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190215" +pandora_version="7.0NG.731-190216" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 187f94b41d..f8ed0ee790 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.731'; -use constant AGENT_BUILD => '190215'; +use constant AGENT_BUILD => '190216'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 16bf75ef2f..5054296122 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190215 +%define release 190216 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 1dd06bf43e..42bd97df7c 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190215 +%define release 190216 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 340a0c2712..101a222475 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190215" +PI_BUILD="190216" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index b7dff2f2ec..bd1c2706f2 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190215} +{190216} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 48aba959cb..d9f92d20df 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.731(Build 190215)") +#define PANDORA_VERSION ("7.0NG.731(Build 190216)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 2b58063706..c5bc83348a 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.731(Build 190215))" + VALUE "ProductVersion", "(7.0NG.731(Build 190216))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 12ecde5daf..aad2a6c328 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.731-190215 +Version: 7.0NG.731-190216 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 0171643ae5..1651ec67f0 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190215" +pandora_version="7.0NG.731-190216" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 4de1f20d2f..872d436a69 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190215'; +$build_version = 'PC190216'; $pandora_version = 'v7.0NG.731'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 5608de3f79..bbfe4ca5b5 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index e0834c0d3a..0450a2345f 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190215 +%define release 190216 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 29a5c3e307..bd8c4ca077 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190215 +%define release 190216 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 1b9483c5fe..ad5c1295df 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190215" +PI_BUILD="190216" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 97816668a5..9ca2593077 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.731 PS190215"; +my $version = "7.0NG.731 PS190216"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 08854530dd..46bce81907 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.731 PS190215"; +my $version = "7.0NG.731 PS190216"; # save program name for logging my $progname = basename($0); From 1fafda850208701b3945f3029d011a849d180c99 Mon Sep 17 00:00:00 2001 From: artica Date: Sun, 17 Feb 2019 00:01:24 +0100 Subject: [PATCH 15/16] Auto-updated build strings. Former-commit-id: affb7e6fc134d1ae80be0450f759a30960b177fd --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index b9d79cac74..6dab91eb16 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.731-190216 +Version: 7.0NG.731-190217 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index ec6468c904..53f76fc068 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190216" +pandora_version="7.0NG.731-190217" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index f8ed0ee790..910d8eab00 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.731'; -use constant AGENT_BUILD => '190216'; +use constant AGENT_BUILD => '190217'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 5054296122..2992e00140 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190216 +%define release 190217 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 42bd97df7c..9f05dacb7c 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190216 +%define release 190217 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 101a222475..769adba62b 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190216" +PI_BUILD="190217" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index bd1c2706f2..c77bde62fc 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190216} +{190217} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index d9f92d20df..570420a6d4 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.731(Build 190216)") +#define PANDORA_VERSION ("7.0NG.731(Build 190217)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index c5bc83348a..44e384be4a 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.731(Build 190216))" + VALUE "ProductVersion", "(7.0NG.731(Build 190217))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index aad2a6c328..c602d5e124 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.731-190216 +Version: 7.0NG.731-190217 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 1651ec67f0..447bfbcef9 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190216" +pandora_version="7.0NG.731-190217" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 872d436a69..107551dc3a 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190216'; +$build_version = 'PC190217'; $pandora_version = 'v7.0NG.731'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index bbfe4ca5b5..ccb36a31ac 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 0450a2345f..d4f9f0ff4e 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190216 +%define release 190217 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index bd8c4ca077..829e2d127c 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190216 +%define release 190217 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index ad5c1295df..439d1615d5 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190216" +PI_BUILD="190217" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 9ca2593077..061e3404d7 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.731 PS190216"; +my $version = "7.0NG.731 PS190217"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 46bce81907..343f591067 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.731 PS190216"; +my $version = "7.0NG.731 PS190217"; # save program name for logging my $progname = basename($0); From 0ef118f401bab29783aefb09245eb649fc013210 Mon Sep 17 00:00:00 2001 From: artica Date: Mon, 18 Feb 2019 00:01:24 +0100 Subject: [PATCH 16/16] Auto-updated build strings. Former-commit-id: 2e217d82f2119ffdca6218a233fa8eeb743c3fb0 --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 6dab91eb16..9e5ab2a275 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.731-190217 +Version: 7.0NG.731-190218 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 53f76fc068..b292a5b27e 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190217" +pandora_version="7.0NG.731-190218" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 910d8eab00..e115ed1464 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.731'; -use constant AGENT_BUILD => '190217'; +use constant AGENT_BUILD => '190218'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 2992e00140..09dda6c12c 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190217 +%define release 190218 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 9f05dacb7c..cfbcd4d9e2 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.731 -%define release 190217 +%define release 190218 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 769adba62b..ea0776fa0b 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190217" +PI_BUILD="190218" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index c77bde62fc..6e9ed1ef35 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190217} +{190218} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 570420a6d4..e13c1aaaef 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.731(Build 190217)") +#define PANDORA_VERSION ("7.0NG.731(Build 190218)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 44e384be4a..ebc2597545 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.731(Build 190217))" + VALUE "ProductVersion", "(7.0NG.731(Build 190218))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index c602d5e124..3a35a79ccb 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.731-190217 +Version: 7.0NG.731-190218 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 447bfbcef9..4e85297bc6 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.731-190217" +pandora_version="7.0NG.731-190218" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 107551dc3a..040ea33307 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190217'; +$build_version = 'PC190218'; $pandora_version = 'v7.0NG.731'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index ccb36a31ac..92b6dd1217 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index d4f9f0ff4e..8e88f8c8e7 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190217 +%define release 190218 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 829e2d127c..4d51b35563 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.731 -%define release 190217 +%define release 190218 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 439d1615d5..adde2139a0 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.731" -PI_BUILD="190217" +PI_BUILD="190218" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 061e3404d7..100e38cea1 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.731 PS190217"; +my $version = "7.0NG.731 PS190218"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 343f591067..a19ae1e3ff 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.731 PS190217"; +my $version = "7.0NG.731 PS190218"; # save program name for logging my $progname = basename($0);