From 737e085a81215566319484897f3b501c53fd7c43 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 23 Jun 2015 12:15:09 +0200 Subject: [PATCH] Fixed the masive operations for modules when the name has white spaces. TICKET: #2328 --- .../godmode/massive/massive_edit_modules.php | 94 +++++++++++++------ .../godmode/massive/massive_operations.php | 54 +++++++---- 2 files changed, 97 insertions(+), 51 deletions(-) diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 62977e3fa6..b92d5c41b2 100644 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -112,7 +112,8 @@ if ($update) { $module_name = array(); } foreach($module_name as $mod_name) { - $result = process_manage_edit($mod_name['nombre'], $id_agent); + $result = process_manage_edit($mod_name['nombre'], + $id_agent); $count ++; $success += (int)$result; } @@ -123,6 +124,8 @@ if ($update) { $agents_ = array(); } + + foreach ($agents_ as $agent_) { if ($modules_ == false) { @@ -141,12 +144,15 @@ if ($update) { "(" . $success . "/" . $count . ")", __('Could not be updated')); - $info = 'Modules: ' . json_encode($modules_) . ' Agents: ' . json_encode($agents_); + $info = 'Modules: ' . json_encode($modules_) . + ' Agents: ' . json_encode($agents_); if ($success > 0) { - db_pandora_audit("Massive management", "Edit module", false, false, $info); + db_pandora_audit("Massive management", "Edit module", false, + false, $info); } else { - db_pandora_audit("Massive management", "Fail try to edit module", false, false, $info); + db_pandora_audit("Massive management", + "Fail try to edit module", false, false, $info); } } @@ -173,7 +179,8 @@ if (! $module_type) { $table->rowstyle['edit6'] = 'display: none'; $table->rowstyle['edit7'] = 'display: none'; } -$agents = agents_get_group_agents (array_keys (users_get_groups ()), false, "none"); +$agents = agents_get_group_agents (array_keys (users_get_groups ()), + false, "none"); switch ($config["dbtype"]) { case "mysql": case "oracle": @@ -216,10 +223,12 @@ $table->data = array (); $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); + html_print_radio_button_extended ("selection_mode", 'modules', '', + $selection_mode, false, '', 'style="margin-right: 40px;"', true); $table->data['selection_mode'][2] = ''; $table->data['selection_mode'][3] = __('Select agents first') . ' ' . - html_print_radio_button_extended ("selection_mode", 'agents', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true); + html_print_radio_button_extended ("selection_mode", 'agents', '', + $selection_mode, false, '', 'style="margin-right: 40px;"', true); @@ -235,7 +244,8 @@ $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); + html_print_checkbox_extended ("force_type", 'type', '', '', false, + '', 'style="margin-right: 40px;"', true); $modules = array (); if ($module_type != '') { @@ -263,7 +273,8 @@ $table->data['form_agents_1'][1] = html_print_select ($groups, 'groups_select', ' ' . __('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;"', true); + html_print_checkbox_extended ("force_group", 'group', '', '', false, + '', 'style="margin-right: 40px;"', true); @@ -327,8 +338,8 @@ $table->data['edit1'][1] = ''; $table->data['edit1'][1] .= '' . __('Min.') . ''; $table->data['edit1'][1] .= ''; $table->data['edit1'][1] .= ''; $table->data['edit1'][1] .= ''; $table->data['edit1'][1] .= ''; @@ -336,25 +347,29 @@ $table->data['edit1'][1] = '
'; - $table->data['edit1'][1] .= html_print_input_text('min_warning', - '', '', 5, 15, true); + $table->data['edit1'][1] .= html_print_input_text( + 'min_warning', '', '', 5, 15, true); $table->data['edit1'][1] .= '
'; $table->data['edit1'][1] .= '' . __('Max.') . ''; $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] .= html_print_input_text ('max_warning', '', '', 5, 15, true); + $table->data['edit1'][1] .= html_print_input_text ( + 'max_warning', '', '', 5, 15, true); $table->data['edit1'][1] .= '
'; - $table->data['edit1'][1] .= ''.__('Str.').''; + $table->data['edit1'][1] .= '' . __('Str.') . ''; $table->data['edit1'][1] .= ''; - $table->data['edit1'][1] .= html_print_input_text ('str_warning', '', '', 5, 15, true); + $table->data['edit1'][1] .= html_print_input_text ( + 'str_warning', '', '', 5, 15, true); $table->data['edit1'][1] .= '
'; - $table->data['edit1'][1] .= ''.__('Inverse interval').''; + $table->data['edit1'][1] .= '' . + __('Inverse interval') . ''; $table->data['edit1'][1] .= ''; $table->data['edit1'][1] .= html_print_select( - array('' => __('No change'), + array( + '' => __('No change'), '1' => __('Yes'), '0' => __('No')), 'warning_inverse','','','', '', true); @@ -369,8 +384,8 @@ $table->data['edit1'][3] = ''; $table->data['edit1'][3] .= '' . __('Min.') . ''; $table->data['edit1'][3] .= ''; $table->data['edit1'][3] .= ''; $table->data['edit1'][3] .= ''; $table->data['edit1'][3] .= ''; @@ -378,7 +393,8 @@ $table->data['edit1'][3] = '
'; - $table->data['edit1'][3] .= html_print_input_text('min_critical', - '', '', 5, 15, true); + $table->data['edit1'][3] .= html_print_input_text( + 'min_critical', '', '', 5, 15, true); $table->data['edit1'][3] .= '
'; $table->data['edit1'][3] .= '' . __('Max.') . ''; $table->data['edit1'][3] .= ''; $table->data['edit1'][3] .= ''; $table->data['edit1'][3] .= ''; $table->data['edit1'][3] .= ''; @@ -386,12 +402,14 @@ $table->data['edit1'][3] = '
'; - $table->data['edit1'][3] .= html_print_input_text ('max_critical', '', '', 5, 15, true); + $table->data['edit1'][3] .= html_print_input_text( + 'max_critical', '', '', 5, 15, true); $table->data['edit1'][3] .= '
'; $table->data['edit1'][3] .= ''.__('Str.').''; $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] .= html_print_input_text ('str_critical', '', '', 5, 15, true); + $table->data['edit1'][3] .= html_print_input_text( + 'str_critical', '', '', 5, 15, true); $table->data['edit1'][3] .= '
'; - $table->data['edit1'][3] .= ''.__('Inverse interval').''; + $table->data['edit1'][3] .= '' . + __('Inverse interval') . ''; $table->data['edit1'][3] .= ''; $table->data['edit1'][3] .= @@ -405,27 +423,40 @@ $table->data['edit1'][3] = ''; $table->data['edit1'][3] .= '
'; $table->data['edit1_1'][0] = ''.__('Description'). ''; -$table->data['edit1_1'][1] = html_print_textarea ('descripcion', 2, 50, '', '', true); +$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'][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'][3] = html_print_select( + array( + '' => __('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_input_text ('post_process', '', '', 10, 15, true); +$table->data['edit3'][1] = html_print_input_text ('post_process', '', + '', 10, 15, true); $table->data['edit3'][2] = __('SMNP community'); -$table->data['edit3'][3] = html_print_input_text ('snmp_community', '', '', 10, 15, true); +$table->data['edit3'][3] = html_print_input_text ('snmp_community', '', + '', 10, 15, true); $table->data['edit35'][0] = __('Target IP'); -$table->data['edit35'][1] = html_print_input_text ('ip_target', '', '', 15, 60, true); +$table->data['edit35'][1] = html_print_input_text ('ip_target', '', '', + 15, 60, true); $table->data['edit35'][2] = __('SNMP version'); -$table->data['edit35'][3] = html_print_select ($snmp_versions, 'tcp_send', '', '', __('No change'), '', true, false, false, ''); +$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'][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); @@ -906,6 +937,7 @@ $(document).ready (function () { $agents_select, - 'nombre' => io_safe_input($module_name)), + 'nombre' => $module_name), array ('id_agente_modulo')); } } diff --git a/pandora_console/godmode/massive/massive_operations.php b/pandora_console/godmode/massive/massive_operations.php index e0196e4cbc..42212f5db6 100644 --- a/pandora_console/godmode/massive/massive_operations.php +++ b/pandora_console/godmode/massive/massive_operations.php @@ -140,25 +140,33 @@ if ($option == '') { $option = array_shift(array_keys($options)); } -$alertstab = array('text' => '' - . html_print_image ('images/op_alerts.png', true, - array ('title' => __('Alerts operations'))) - . '', 'active' => $tab == 'massive_alerts'); +$alertstab = array( + 'text' => '' + . html_print_image ('images/op_alerts.png', true, + array ('title' => __('Alerts operations'))) + . '', + 'active' => $tab == 'massive_alerts'); -$userstab = array('text' => '' - . html_print_image ('images/op_workspace.png', true, - array ('title' => __('Users operations'))) - . '', 'active' => $tab == 'massive_users'); +$userstab = array( + 'text' => '' + . html_print_image ('images/op_workspace.png', true, + array ('title' => __('Users operations'))) + . '', + 'active' => $tab == 'massive_users'); -$agentstab = array('text' => '' - . html_print_image ('images/bricks.png', true, - array ('title' => __('Agents operations'))) - . '', 'active' => $tab == 'massive_agents'); +$agentstab = array( + 'text' => '' + . html_print_image ('images/bricks.png', true, + array ('title' => __('Agents operations'))) + . '', + 'active' => $tab == 'massive_agents'); -$modulestab = array('text' => '' - . html_print_image ('images/brick.png', true, - array ('title' => __('Modules operations'))) - . '', 'active' => $tab == 'massive_modules'); +$modulestab = array( + 'text' => '' + . html_print_image ('images/brick.png', true, + array ('title' => __('Modules operations'))) + . '', + 'active' => $tab == 'massive_modules'); @@ -213,7 +221,8 @@ $submit_template_standby = get_parameter('id_alert_template_standby'); $submit_add = get_parameter('crtbutton'); echo '
'; -echo html_print_image("images/wait.gif", true, array("border" => '0')) . '
'; +echo html_print_image("images/wait.gif", true, array("border" => '0')) . + '
'; echo '' . __('Please wait...') . ''; echo '
'; ?> @@ -245,14 +254,19 @@ echo ''; "; echo '
'; -echo ''; +echo ''; +echo '
'; +echo ''; +echo ''; +echo ''; +echo '
'; echo __("Action"); -echo ''; +echo ''; html_print_select($options, 'option', $option, 'this.form.submit()', '', 0, false, false, false); if ($option == 'edit_agents' || $option == 'edit_modules') ui_print_help_tip(__("The blank fields will not be updated")); -echo '
'; +echo '
'; echo '
'; echo "
";