From 6612fe96bde53c401d7fe5da70d174f59150e7f8 Mon Sep 17 00:00:00 2001 From: Calvo Date: Wed, 11 Oct 2023 17:43:28 +0200 Subject: [PATCH] MADE only on compatible module types --- .../godmode/agentes/configurar_agente.php | 2 +- .../agentes/module_manager_editor_common.php | 1087 +++++++++-------- .../godmode/massive/massive_edit_modules.php | 2 +- pandora_console/include/functions_modules.php | 27 + 4 files changed, 578 insertions(+), 540 deletions(-) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 856a5d30cd..0f5741e6c7 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -1337,7 +1337,7 @@ if ($update_module === true || $create_module === true) { */ $post_process = (string) get_parameter('post_process', 0.0); - if (modules_is_string_type($id_module_type) === false) { + if (modules_made_compatible($id_module_type) === false) { $made_enabled = (bool) get_parameter_checkbox('made_enabled', 0); } else { $made_enabled = false; diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index f7da1b7451..453997541f 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -1,4 +1,5 @@ data['switch_warning_threshold'][0] .= html_print_switch_ html_print_radio_button_extended('warning_thresholds_checks', 'warning_inverse', __('Inverse interval'), ($warning_inverse) ? 'warning_inverse' : false, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-warning_inverse'), html_print_radio_button_extended('warning_thresholds_checks', 'percentage_warning', __('Percentage'), ($percentage_warning) ? 'percentage_warning' : false, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-percentage_warning'), ], - [ 'class' => 'margin-top-10' ], + ['class' => 'margin-top-10'], true ); @@ -565,7 +566,7 @@ $tableBasicThresholds->data['switch_critical_threshold'][0] .= html_print_switch html_print_radio_button_extended('critical_thresholds_checks', 'critical_inverse', __('Inverse interval'), ($critical_inverse) ? 'critical_inverse' : false, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-critical_inverse'), html_print_radio_button_extended('critical_thresholds_checks', 'percentage_critical', __('Percentage'), ($percentage_critical) ? 'percentage_critical' : false, $disabledBecauseInPolicy, '', '', true, false, '', 'radius-percentage_critical'), ], - [ 'class' => 'margin-top-10' ], + ['class' => 'margin-top-10'], true ); @@ -722,14 +723,14 @@ if ($cps_module > 0) { ob_start(); ?> data['ff_main_thresholds'][0] = html_print_switch_radio_butto html_print_radio_button_extended('each_ff', 0, __('All state changing'), $each_ff, false, 'ffStateChange(0)', '', true, false, '', 'ff_all_state'), html_print_radio_button_extended('each_ff', 1, __('Each state changing'), $each_ff, false, 'ffStateChange(1)', '', true, false, '', 'ff_each_state'), ], - [ 'add_content' => $ffThresholdsScript ], + ['add_content' => $ffThresholdsScript], true ); @@ -1684,41 +1685,42 @@ ui_require_jquery_file('json'); ?> + /* ]]> */ + \ No newline at end of file diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index a8b2d248d4..156ca507d8 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -2654,7 +2654,7 @@ function process_manage_edit($module_name, $agents_select=null, $module_status=' $values['macros'] = json_encode($module_macros); } - if (modules_is_string_type($module['id_tipo_modulo']) === true) { + if (modules_made_compatible($module['id_tipo_modulo']) === false) { $values['made_enabled'] = 0; } diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index e82fca400b..31c89025f7 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -4762,3 +4762,30 @@ function export_agents_module_csv($filters) return $result; } + + +/** + * Check if modules are compatible with MADE server. + * + * @param integer $id_tipo_modulo + * @retur boolean True if compatible, false otherwise. + */ +function modules_made_compatible($id_tipo_modulo) +{ + $compatible_types = [ + 1, + 4, + 5, + 15, + 16, + 22, + 30, + 34, + ]; + + if (array_search($id_tipo_modulo, $compatible_types) === false) { + return false; + } else { + return true; + } +}