From b11e18e18ddaeade17971318cb4d8a64a018d262 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 24 Jul 2012 16:38:48 +0000 Subject: [PATCH] 2012-07-24 Miguel de Dios * godmode/setup/file_manager.php, godmode/setup/news.php, godmode/users/configure_user.php, godmode/users/user_list.php, godmode/massive/massive_copy_modules.php, godmode/massive/massive_enable_disable_alerts.php, godmode/massive/massive_delete_action_alerts.php, godmode/massive/massive_delete_alerts.php, godmode/modules/manage_network_templates_form.php, godmode/modules/manage_nc_groups.php, godmode/modules/manage_nc_groups_form.php, godmode/modules/manage_network_templates.php, godmode/netflow/nf_edit.php, godmode/netflow/nf_edit_form.php, godmode/netflow/nf_item_list.php, godmode/netflow/nf_report_item.php, godmode/netflow/nf.php, operation/incidents/incident.php, operation/incidents/incident_detail.php, operation/agentes/estado_agente.php, operation/agentes/sla_view.php, operation/agentes/tactical.php, operation/agentes/estado_generalagente.php, operation/snmpconsole/snmp_view.php, operation/users/user_edit.php, operation/integria_incidents/incident_detail.php, operation/gis_maps/index.php, operation/events/events_list.php, operation/events/events.php, operation/messages/message_edit.php, operation/messages/message_list.php, operation/reporting/graph_viewer.php, operation/search_reports.php, operation/netflow/nf_view.php: cleaned source code. * godmode/massive/massive_operations.php, godmode/massive/massive_edit_modules.php: fixed the massive edition of "any" module in agents. Fixes: #3543484 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6806 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 34 +++ .../godmode/massive/massive_copy_modules.php | 3 +- .../massive/massive_delete_action_alerts.php | 8 +- .../godmode/massive/massive_delete_alerts.php | 3 +- .../godmode/massive/massive_edit_modules.php | 205 +++++++++--------- .../massive/massive_enable_disable_alerts.php | 7 +- .../godmode/massive/massive_operations.php | 62 +++--- .../godmode/modules/manage_nc_groups.php | 9 +- .../godmode/modules/manage_nc_groups_form.php | 8 +- .../modules/manage_network_templates.php | 3 +- .../modules/manage_network_templates_form.php | 13 +- pandora_console/godmode/netflow/nf.php | 7 +- pandora_console/godmode/netflow/nf_edit.php | 7 +- .../godmode/netflow/nf_edit_form.php | 4 +- .../godmode/netflow/nf_item_list.php | 18 +- .../godmode/netflow/nf_report_item.php | 17 +- .../godmode/setup/file_manager.php | 48 +--- pandora_console/godmode/setup/news.php | 10 +- .../godmode/users/configure_user.php | 9 +- pandora_console/godmode/users/user_list.php | 9 +- .../operation/agentes/estado_agente.php | 14 +- .../agentes/estado_generalagente.php | 9 +- .../operation/agentes/sla_view.php | 7 +- .../operation/agentes/tactical.php | 26 ++- pandora_console/operation/events/events.php | 72 +++--- .../operation/events/events_list.php | 36 +-- pandora_console/operation/gis_maps/index.php | 7 +- .../operation/incidents/incident.php | 14 +- .../operation/incidents/incident_detail.php | 57 ++--- .../integria_incidents/incident_detail.php | 47 ++-- .../operation/messages/message_edit.php | 12 +- .../operation/messages/message_list.php | 27 ++- pandora_console/operation/netflow/nf_view.php | 29 ++- .../operation/reporting/graph_viewer.php | 15 +- pandora_console/operation/search_reports.php | 7 +- .../operation/snmpconsole/snmp_view.php | 3 +- pandora_console/operation/users/user_edit.php | 25 ++- 37 files changed, 483 insertions(+), 408 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 2efa935c09..bc5d4ec110 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,37 @@ +2012-07-24 Miguel de Dios + + * godmode/setup/file_manager.php, godmode/setup/news.php, + godmode/users/configure_user.php, godmode/users/user_list.php, + godmode/massive/massive_copy_modules.php, + godmode/massive/massive_enable_disable_alerts.php, + godmode/massive/massive_delete_action_alerts.php, + godmode/massive/massive_delete_alerts.php, + godmode/modules/manage_network_templates_form.php, + godmode/modules/manage_nc_groups.php, + godmode/modules/manage_nc_groups_form.php, + godmode/modules/manage_network_templates.php, + godmode/netflow/nf_edit.php, godmode/netflow/nf_edit_form.php, + godmode/netflow/nf_item_list.php, + godmode/netflow/nf_report_item.php, godmode/netflow/nf.php, + operation/incidents/incident.php, + operation/incidents/incident_detail.php, + operation/agentes/estado_agente.php, operation/agentes/sla_view.php, + operation/agentes/tactical.php, + operation/agentes/estado_generalagente.php, + operation/snmpconsole/snmp_view.php, operation/users/user_edit.php, + operation/integria_incidents/incident_detail.php, + operation/gis_maps/index.php, operation/events/events_list.php, + operation/events/events.php, operation/messages/message_edit.php, + operation/messages/message_list.php, + operation/reporting/graph_viewer.php, operation/search_reports.php, + operation/netflow/nf_view.php: cleaned source code. + + * godmode/massive/massive_operations.php, + godmode/massive/massive_edit_modules.php: fixed the massive edition + of "any" module in agents. + + Fixes: #3543484 + 2012-07-24 Juan Manuel Ramon * include/functions_agents.php diff --git a/pandora_console/godmode/massive/massive_copy_modules.php b/pandora_console/godmode/massive/massive_copy_modules.php index 97275b8ac1..0c17102546 100644 --- a/pandora_console/godmode/massive/massive_copy_modules.php +++ b/pandora_console/godmode/massive/massive_copy_modules.php @@ -243,7 +243,8 @@ $(document).ready (function () { function (data, status) { if (data.length == 0) { no_modules = true; - } else { + } + else { jQuery.each (data, function (i, val) { option = $("") .attr ("value", val["id_agente_modulo"]) diff --git a/pandora_console/godmode/massive/massive_delete_action_alerts.php b/pandora_console/godmode/massive/massive_delete_action_alerts.php index 9645e5f2ad..d0fe0282a1 100644 --- a/pandora_console/godmode/massive/massive_delete_action_alerts.php +++ b/pandora_console/godmode/massive/massive_delete_action_alerts.php @@ -65,10 +65,11 @@ if ($delete) { $alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module ($agent_alert['id_agent_module'], true, false, 'id')); } } - + if (empty($alerts_agent_modules)) { ui_print_result_message (false, '', __('Could not be deleted').". ".__('No alerts selected')); - } else { + } + else { $results = true; $agent_module_actions = array(); @@ -137,7 +138,8 @@ $table->data[1][1] = html_print_select (array(),'id_agents[]', 0, false, '', '', if (empty($id_agents)) { $alert_templates = ''; -} else { +} +else { $alert_templates = agents_get_alerts_simple ($id_agents); } $table->data[2][0] = __('Alert templates'); diff --git a/pandora_console/godmode/massive/massive_delete_alerts.php b/pandora_console/godmode/massive/massive_delete_alerts.php index 9d9236636e..33c8f7eb11 100644 --- a/pandora_console/godmode/massive/massive_delete_alerts.php +++ b/pandora_console/godmode/massive/massive_delete_alerts.php @@ -192,7 +192,8 @@ $(document).ready (function () { if (this.value != 0) { $("#id_agents").enable (); $("#id_group").enable ().change (); - } else { + } + else { $("#id_group, #id_agents").disable (); } }); diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 31a350dca4..daf5a7eabb 100644 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -28,78 +28,6 @@ require_once($config['homedir'] . "/include/functions_agents.php"); require_once($config['homedir'] . "/include/functions_groups.php"); require_once($config['homedir'] . '/include/functions_users.php'); -function process_manage_edit ($module_name, $agents_select = null) { - if (is_int ($module_name) && $module_name <= 0) { - echo '

'.__('No modules selected').'

'; - return false; - } - - /* List of fields which can be updated */ - $fields = array ('min_warning', 'max_warning', 'str_warning', 'min_critical', 'max_critical', 'str_critical', 'min_ff_event', 'module_interval', - 'disabled', 'post_process', 'unit', 'snmp_community', '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'); - $values = array (); - - // 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'] = $plugin_pass_snmp; - } - } - - foreach ($fields as $field) { - $value = get_parameter ($field, ''); - if ($value != '') { - $values[$field] = $value; - } - } - - if (strlen(get_parameter('history_data')) > 0) { - $values['history_data'] = get_parameter('history_data'); - } - - // Whether to update module tag info - $update_tags = get_parameter('id_tag', false); - - - -if (array_search(0, $agents_select) !== false) { - $modules = db_get_all_rows_filter ('tagente_modulo', - array ('nombre' => $module_name), - 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')); -} - - db_process_sql_begin (); - - if ($modules === false) - return false; - - foreach ($modules as $module) { - $result = modules_update_agent_module ($module['id_agente_modulo'], $values, true, $update_tags); - - if (is_error($result)) { - db_process_sql_rollback (); - - return false; - } - } - - db_process_sql_commit (); - - return true; -} - $module_type = (int) get_parameter ('module_type'); $idGroupMassive = (int) get_parameter('id_group_massive'); $idAgentMassive = (int) get_parameter('id_agent_massive'); @@ -116,22 +44,22 @@ $update = (bool) get_parameter_post ('update'); if ($update) { $agents_ = ''; - if($selection_mode == 'modules') { + if ($selection_mode == 'modules') { $force = get_parameter('force_type', false); - if($agents_select == false) { + if ($agents_select == false) { $agents_select = array(); $agents_ = array(); } - - foreach($agents_select as $agent_name) { + + foreach ($agents_select as $agent_name) { $agents_[] = agents_get_agent_id($agent_name); } $modules_ = $module_name; } - else if($selection_mode == 'agents') { + else if ($selection_mode == 'agents') { $force = get_parameter('force_group', false); - + $agents_ = $agents_id; $modules_ = $modules_select; } @@ -139,13 +67,13 @@ if ($update) { $success = 0; $count = 0; - if($agents_ == false) { + if ($agents_ == false) { $agents_ = array(); } // If the option to select all of one group or module type is checked - if($force) { - if($force == 'type') { + if ($force) { + if ($force == 'type') { $condition = ''; if($module_type != 0) $condition = ' AND t2.id_tipo_modulo = '.$module_type; @@ -153,24 +81,24 @@ if ($update) { $agents_ = db_get_all_rows_sql('SELECT DISTINCT(t1.id_agente) FROM tagente t1, tagente_modulo t2 WHERE t1.id_agente = t2.id_agente'); - foreach($agents_ as $id_agent) { + foreach ($agents_ as $id_agent) { $module_name = db_get_all_rows_filter('tagente_modulo', array('id_agente' => $id_agent, 'id_tipo_modulo' => $module_type),'nombre'); - - if($module_name == false) { + + if ($module_name == false) { $module_name = array(); } - foreach($module_name as $mod_name) { + foreach ($module_name as $mod_name) { $result = process_manage_edit ($mod_name['nombre'], $id_agent['id_agente']); $count ++; $success += (int)$result; } } } - else if($force == 'group') { + else if ($force == 'group') { $agents_ = array_keys (agents_get_group_agents ($group_select, false, "none")); - foreach($agents_ as $id_agent) { + foreach ($agents_ as $id_agent) { $module_name = db_get_all_rows_filter('tagente_modulo', array('id_agente' => $id_agent),'nombre'); - if($module_name == false) { + if ($module_name == false) { $module_name = array(); } foreach($module_name as $mod_name) { @@ -184,13 +112,13 @@ if ($update) { // We empty the agents array to skip the standard procedure $agents_ = array(); } - + foreach($agents_ as $agent_) { if($modules_ == false) { $modules_ = array(); } - + foreach($modules_ as $module_) { $result = process_manage_edit ($module_, $agents_); $count ++; @@ -423,7 +351,7 @@ $table->data['edit8'][3] = html_print_select_from_sql ('SELECT id_tag, name FROM echo '
'; html_print_table ($table); -echo '
'; +echo '
'; html_print_input_hidden ('update', 1); html_print_submit_button (__('Update'), 'go', false, 'class="sub upd"'); echo '
'; @@ -452,10 +380,10 @@ $(document).ready (function () { $("#module_name").change(module_changed_by_multiple_modules); clean_lists(); - + $(".select_modules_row").css('display', ''); $(".select_agents_row").css('display', ''); - + // Trigger change to refresh selection when change selection mode $("#agents_selection_mode").change (function() { $("#module_name").trigger('change'); @@ -486,7 +414,7 @@ $(document).ready (function () { else { filter = "id_tipo_modulo="+this.value; } - + $("#module_loading").show (); $("tr#delete_table-edit1, tr#delete_table-edit2").hide (); $("#module_name").attr ("disabled", "disabled") @@ -529,7 +457,7 @@ $(document).ready (function () { } $('input[type=checkbox]').change ( - function () { + function () { if(this.id == "checkbox-force_type"){ if(this.checked) { $(".select_modules_row_2").css('display', 'none'); @@ -571,7 +499,7 @@ $(document).ready (function () { $("#form_edit input[name=selection_mode]").change (function () { selector = this.value; clean_lists(); - + if(selector == 'agents') { $(".select_modules_row").css('display', 'none'); $(".select_agents_row").css('display', ''); @@ -593,7 +521,7 @@ $(document).ready (function () { $("#groups_select").change ( function () { - + if (this.value < 0) { clean_lists(); $(".select_agents_row_2").css('display', 'none'); @@ -616,7 +544,7 @@ $(document).ready (function () { }, function (data, status) { $("#id_agents").html(''); - + jQuery.each (data, function (id, value) { option = $("").attr ("value", value["id_agente"]).html (value["nombre"]); $("#id_agents").append (option); @@ -629,3 +557,84 @@ $(document).ready (function () { }); /* ]]> */ +'.__('No modules selected').''; + + return false; + } + + /* List of fields which can be updated */ + $fields = array ('min_warning', 'max_warning', 'str_warning', 'min_critical', 'max_critical', 'str_critical', 'min_ff_event', 'module_interval', + 'disabled', 'post_process', 'unit', 'snmp_community', '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'); + $values = array (); + + // 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'] = $plugin_pass_snmp; + } + } + + foreach ($fields as $field) { + $value = get_parameter ($field, ''); + if ($value != '') { + $values[$field] = $value; + } + } + + if (strlen(get_parameter('history_data')) > 0) { + $values['history_data'] = get_parameter('history_data'); + } + + // 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', + array ('nombre' => $module_name), + array ('id_agente_modulo')); + } + else { + 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')); + } + } + + db_process_sql_begin (); + + if ($modules === false) + return false; + + foreach ($modules as $module) { + $result = modules_update_agent_module ($module['id_agente_modulo'], $values, true, $update_tags); + + if (is_error($result)) { + db_process_sql_rollback (); + + return false; + } + } + + db_process_sql_commit (); + + return true; +} +?> \ No newline at end of file diff --git a/pandora_console/godmode/massive/massive_enable_disable_alerts.php b/pandora_console/godmode/massive/massive_enable_disable_alerts.php index d60c1d7bae..5dd0186591 100644 --- a/pandora_console/godmode/massive/massive_enable_disable_alerts.php +++ b/pandora_console/godmode/massive/massive_enable_disable_alerts.php @@ -43,15 +43,16 @@ if (is_ajax ()) { $alert_templates = agents_get_alerts_simple ($id_agents); echo json_encode (index_array ($alert_templates, 'id_alert_template', 'template_name')); return; - } else { + } + else { $id_alert_templates = (array) get_parameter ('id_alert_templates'); $disabled = (int) get_parameter ('disabled'); - + $agents_alerts = alerts_get_agents_with_alert_template ($id_alert_templates, false, array('order' => 'tagente.nombre, talert_template_modules.disabled', 'talert_template_modules.disabled' => $disabled), array ('LEFT(CONCAT(LEFT(tagente.nombre,40), " - ", tagente_modulo.nombre), 85) as agent_agentmodule_name', 'talert_template_modules.id as template_module_id'), $id_agents); - + echo json_encode (index_array ($agents_alerts, 'template_module_id', 'agent_agentmodule_name')); return; } diff --git a/pandora_console/godmode/massive/massive_operations.php b/pandora_console/godmode/massive/massive_operations.php index 3ea5b999a9..825632d6a0 100644 --- a/pandora_console/godmode/massive/massive_operations.php +++ b/pandora_console/godmode/massive/massive_operations.php @@ -39,7 +39,8 @@ $options_alerts = array('add_alerts' => __('Massive alerts addition'), 'delete_a $options_agents = array('edit_agents' => __('Massive agents edition'), 'delete_agents' => __('Massive agents deletion')); if (check_acl ($config['id_user'], 0, "PM")) { - $options_users = array('add_profiles' => __('Massive profiles addition'), 'delete_profiles' => __('Massive profiles deletion')); + $options_users = array('add_profiles' => __('Massive profiles addition'), + 'delete_profiles' => __('Massive profiles deletion')); } else { $options_users = array(); @@ -151,43 +152,38 @@ $submit_add = get_parameter('crtbutton'); echo '
'; echo html_print_image("images/wait.gif", true, array("border" => '0')) . '
'; -echo ''.__('Please wait').'...'; +echo '' . __('Please wait...') . ''; echo '
'; - - ?> $name, 'parent' => $parent)); if ($result) { db_pandora_audit( "Module management", "Create component group #$result"); - } else { + } + else { db_pandora_audit( "Module management", "Fail try to create component group"); } ui_print_result_message ($result, @@ -75,7 +77,8 @@ if ($update) { array ('id_sg' => $id)); if ($result) { db_pandora_audit( "Module management", "Update component group #$id"); - } else { + } + else { db_pandora_audit( "Module management", "Fail try to update component group #$id"); } diff --git a/pandora_console/godmode/modules/manage_nc_groups_form.php b/pandora_console/godmode/modules/manage_nc_groups_form.php index 7b47a338cf..90f0a09e07 100644 --- a/pandora_console/godmode/modules/manage_nc_groups_form.php +++ b/pandora_console/godmode/modules/manage_nc_groups_form.php @@ -33,7 +33,8 @@ if ($id) { $group = network_components_get_group ($id); $name = $group['name']; $parent = $group['parent']; -} else { +} +else { $name = ''; $parent = ''; } @@ -57,10 +58,11 @@ if ($id) { html_print_input_hidden ('update', 1); html_print_input_hidden ('id', $id); html_print_submit_button (__('Update'), 'crt', false, 'class="sub upd"'); -} else { +} +else { html_print_input_hidden ('create', 1); html_print_submit_button (__('Create'), 'crt', false, 'class="sub wand"'); } echo '
'; echo '
'; -?> +?> \ No newline at end of file diff --git a/pandora_console/godmode/modules/manage_network_templates.php b/pandora_console/godmode/modules/manage_network_templates.php index 9f58631d1c..9a02271c64 100644 --- a/pandora_console/godmode/modules/manage_network_templates.php +++ b/pandora_console/godmode/modules/manage_network_templates.php @@ -141,7 +141,8 @@ if ($export_profile) { foreach ($components[0] as $row_name => $detail) { if (is_numeric ($row_name)) { $inv_names[] = $row_name; - } else { + } + else { $row_names[] = $row_name; } } diff --git a/pandora_console/godmode/modules/manage_network_templates_form.php b/pandora_console/godmode/modules/manage_network_templates_form.php index b528f9b3cf..0c10a7cd4d 100644 --- a/pandora_console/godmode/modules/manage_network_templates_form.php +++ b/pandora_console/godmode/modules/manage_network_templates_form.php @@ -85,10 +85,11 @@ if (isset ($_GET["create"]) || isset ($_GET["update"])) { if ($result) { db_pandora_audit("Module management", "Update module template #$id_np"); - } else { + } + else { db_pandora_audit("Module management", "Fail try to update module template #$id_np"); } - + ui_print_result_message ($result !== false, __('Successfully updated network profile'), __('Error updating network profile')); @@ -100,7 +101,8 @@ if (isset ($_GET["create"]) || isset ($_GET["update"])) { if ($result) { db_pandora_audit("Module management", "Create module template #$result"); - } else { + } + else { db_pandora_audit("Module management", "Fail try to create module template"); } @@ -109,9 +111,10 @@ if (isset ($_GET["create"]) || isset ($_GET["update"])) { __('Error adding network profile')); $id_np = (int) $result; //Will return either 0 (in case of error) or an int } - } else { + } + else { ui_print_result_message(false, "", _("Cannot create a template without name")); - } + } } elseif ($id_np > 0) { diff --git a/pandora_console/godmode/netflow/nf.php b/pandora_console/godmode/netflow/nf.php index 4a46728499..a9539f4523 100644 --- a/pandora_console/godmode/netflow/nf.php +++ b/pandora_console/godmode/netflow/nf.php @@ -53,10 +53,11 @@ if ($update) { if (db_get_value('token', 'tconfig', 'token', 'netflow_path') === false) { config_create_value('netflow_path', $config['netflow_path']); - } else { + } + else { db_process_sql_update ('tconfig', - array ('value' => $config['netflow_path']), - array ('token' => 'netflow_path')); + array ('value' => $config['netflow_path']), + array ('token' => 'netflow_path')); } } diff --git a/pandora_console/godmode/netflow/nf_edit.php b/pandora_console/godmode/netflow/nf_edit.php index 2028c791c1..708f19120a 100644 --- a/pandora_console/godmode/netflow/nf_edit.php +++ b/pandora_console/godmode/netflow/nf_edit.php @@ -45,13 +45,14 @@ if ($delete) { $result2 = db_process_sql_delete ('tnetflow_report_content', array ('id_filter' => $id_filter)); - + if ($result !== false) { $result = true; - } else { + } + else { $result = false; } - + ui_print_result_message ($result, __('Successfully deleted'), __('Not deleted. Error deleting data')); diff --git a/pandora_console/godmode/netflow/nf_edit_form.php b/pandora_console/godmode/netflow/nf_edit_form.php index 1c7185b57e..a7985bc909 100644 --- a/pandora_console/godmode/netflow/nf_edit_form.php +++ b/pandora_console/godmode/netflow/nf_edit_form.php @@ -66,8 +66,8 @@ if ($id) { $aggregate = $filter['aggregate']; $output = $filter['output']; $advanced_filter = $filter['advanced_filter']; - -} else { +} +else { $name = ''; $assign_group = ''; $ip_dst = ''; diff --git a/pandora_console/godmode/netflow/nf_item_list.php b/pandora_console/godmode/netflow/nf_item_list.php index 2afce13e0a..9a3859cfa8 100644 --- a/pandora_console/godmode/netflow/nf_item_list.php +++ b/pandora_console/godmode/netflow/nf_item_list.php @@ -171,17 +171,20 @@ $sql = "SELECT id_rc FROM tnetflow_report_content where `order`= (select max(`or $item_max = db_get_row_sql($sql); $last_item = $item_max['id_rc']; - foreach ($reports_item as $item) { - +foreach ($reports_item as $item) { + $data = array (); if (($item['id_rc'] == $first_item) && ($item['id_rc'] == $last_item)){ $data[0] = ' '; - } else if (($item['id_rc'] == $first_item) && ($item['id_rc'] != $last_item)){ + } + else if (($item['id_rc'] == $first_item) && ($item['id_rc'] != $last_item)){ $data[0] = ' '; $data[0] .= '' . html_print_image("images/down.png", true, array("title" => __('Move to down'))) . ''; - } else if (($item['id_rc'] == $last_item) && ($item['id_rc'] != $first_item)){ + } + else if (($item['id_rc'] == $last_item) && ($item['id_rc'] != $first_item)){ $data[0] = '' . html_print_image("images/up.png", true, array("title" => __('Move to up'))) . ''; - } else { + } + else { $data[0] = '' . html_print_image("images/up.png", true, array("title" => __('Move to up'))) . ''; $data[0] .= '' . html_print_image("images/down.png", true, array("title" => __('Move to down'))) . ''; } @@ -214,7 +217,7 @@ $last_item = $item_max['id_rc']; array_push ($table->data, $data); } -if(isset($data)) { +if (isset($data)) { echo '
'; html_print_input_hidden('multiple_delete', 1); html_print_table ($table); @@ -222,7 +225,8 @@ if(isset($data)) { html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); echo ""; echo "
"; -}else { +} +else { echo "
".__('There are no defined items')."
"; } diff --git a/pandora_console/godmode/netflow/nf_report_item.php b/pandora_console/godmode/netflow/nf_report_item.php index 7ac5c6dea6..549044a1c1 100644 --- a/pandora_console/godmode/netflow/nf_report_item.php +++ b/pandora_console/godmode/netflow/nf_report_item.php @@ -61,7 +61,8 @@ if ($id_rc) { $max_val = $item['max']; $show_graph = $item['show_graph']; -} else { +} +else { $name_filter = ''; $max_val = ''; $show_graph = ''; @@ -99,7 +100,8 @@ if ($create){ $order = $result['max_order']; if ($order == '') { $order = 0; - } else { + } + else { $order++; } @@ -113,11 +115,12 @@ if ($create){ $id_rc = db_process_sql_insert('tnetflow_report_content', $values); if ($id_rc === false) { echo '

'.__ ('Error creating item').'

'; - } else { + } + else { echo '

'.__ ('Item created successfully').'

'; } } - + $table->width = '70%'; $table->border = 0; $table->cellspacing = 3; @@ -168,11 +171,11 @@ if ($id_rc) { html_print_input_hidden ('update', 1); html_print_input_hidden ('id_rc', $id_rc); html_print_submit_button (__('Update'), 'crt', false, 'class="sub upd"'); -} else { +} +else { html_print_input_hidden ('create', 1); html_print_submit_button (__('Create item'), 'crt', false, 'class="sub wand"'); } echo ''; echo ''; - -?> +?> \ No newline at end of file diff --git a/pandora_console/godmode/setup/file_manager.php b/pandora_console/godmode/setup/file_manager.php index e071852d37..92069f1590 100644 --- a/pandora_console/godmode/setup/file_manager.php +++ b/pandora_console/godmode/setup/file_manager.php @@ -26,10 +26,6 @@ if (! check_acl ($config['id_user'], 0, "PM")) { require_once ("include/functions_filemanager.php"); -//$delete_file = (bool) get_parameter ('delete_file'); -//$upload_file = (bool) get_parameter ('upload_file'); -//$create_dir = (bool) get_parameter ('create_dir'); - // Header ui_print_page_header (__('File manager'), "", false, "", true); @@ -38,47 +34,8 @@ if (isset($config['filemanager']['message'])) { $config['filemanager']['message'] = null; } -//// Upload file -//if ($upload_file) { -// if (isset ($_FILES['file']) && $_FILES['file']['name'] != "") { -// $filename = $_FILES['file']['name']; -// $filesize = $_FILES['file']['size']; -// $directory = (string) get_parameter ('directory'); -// -// // Copy file to directory and change name -// $nombre_archivo = $config['homedir'].'/'.$directory.'/'.$filename; -// if (! @copy ($_FILES['file']['tmp_name'], $nombre_archivo )) { -// echo "

".__('attach_error')."

"; -// } else { -// // Delete temporal file -// unlink ($_FILES['file']['tmp_name']); -// } -// -// } -//} - -//if ($delete_file) { -// $filename = (string) get_parameter ('filename'); -// echo "

".__('Deleting')." ".$filename."

"; -// if (is_dir ($filename)) { -// rmdir ($filename); -// } else { -// unlink ($filename); -// } -//} - - $directory = (string) get_parameter ('directory', "/"); -//// CREATE DIR -//if ($create_dir) { -// $dirname = (string) get_parameter ('dirname'); -// if ($dirname) { -// @mkdir ($directory.'/'.$dirname); -// echo '

'.__('Created directory %s', $dirname).'

'; -// } -//} - // A miminal security check to avoid directory traversal if (preg_match ("/\.\./", $directory)) $directory = "images"; @@ -105,10 +62,7 @@ $available_directories[$directory] = $directory; $real_directory = realpath ($config['homedir'].'/'.$directory); -//filemanager_box_upload_file_explorer($real_directory, $directory); - - -echo '

'.__('Index of %s', $directory).'

'; +echo '

' . __('Index of %s', $directory) . '

'; filemanager_file_explorer($real_directory, $directory, 'index.php?sec=gsetup&sec2=godmode/setup/file_manager'); ?> diff --git a/pandora_console/godmode/setup/news.php b/pandora_console/godmode/setup/news.php index d54deccceb..195989f364 100644 --- a/pandora_console/godmode/setup/news.php +++ b/pandora_console/godmode/setup/news.php @@ -85,18 +85,20 @@ if ((isset ($_GET["form_add"])) || (isset ($_GET["form_edit"]))) { $text = $result["text"]; $author = $result["author"]; $timestamp = $result["timestamp"]; - } else { + } + else { echo "

".__('Name error')."

"; } - } else { // form_add + } + else { // form_add $creation_mode = 1; $text = ""; $subject = ""; $author = $config['id_user']; } - + // Create news - + echo ''; echo ''; if ($creation_mode == 1) diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 4b80f0d43c..b14dd27d1a 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -71,7 +71,8 @@ ui_print_page_header (__('User detail editor'), "images/god3.png", false, "", tr if ($config['user_can_update_info']) { $view_mode = false; -} else { +} +else { $view_mode = true; } @@ -240,7 +241,8 @@ if ($update_user) { $pass_ok = login_validate_pass($password_new, $id, true); if ($pass_ok != 1) { ui_print_error_message($pass_ok); - } else { + } + else { $res2 = update_user_password ($id, $password_new); if ($res2) { $res3 = save_pass_history($id, $password_new); @@ -249,7 +251,8 @@ if ($update_user) { __('User info successfully updated'), __('Error updating user info (no change?)')); } - } else { + } + else { $res2 = update_user_password ($id, $password_new); if ($res2) { $res3 = save_pass_history($id, $password_new); diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index 19daa809ba..68fc1330ce 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -235,7 +235,8 @@ foreach ($info as $user_id => $user_info) { $data[3] = html_print_image ("images/user_suit.png", true, array ("alt" => __('Admin'), "title" => __('Administrator'))).' '; - } else { + } + else { $data[3] = html_print_image ("images/user_green.png", true, array ("alt" => __('User'), "title" => __('Standard User'))).' '; @@ -250,7 +251,8 @@ foreach ($info as $user_id => $user_info) { $data[3] .= groups_get_name ($row["id_grupo"]); $data[3] .= "
"; } - } else { + } + else { $data[3] .= __('The user doesn\'t have any assigned profile/group'); } $data[3] .= ""; @@ -266,7 +268,8 @@ foreach ($info as $user_id => $user_info) { $data[5] .= ''.html_print_image('images/config.png', true, array('title' => __('Edit'))).''; if ($config["admin_can_delete_user"] && $user_info['id_user'] != $config['id_user']) { $data[5] .= "  ".html_print_image('images/cross.png', true, array ('title' => __('Delete'), 'onclick' => "if (! confirm ('" .__('Deleting User'). " ". $user_info['id_user'] . ". " . __('Are you sure?') ."')) return false")).""; - } else { + } + else { $data[5] .= ''; //Delete button not in this mode } array_push ($table->data, $data); diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index aeaed33baf..6ac9cdf080 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -473,20 +473,13 @@ foreach ($agents as $agent) { $data[2] = ui_print_os_icon ($agent["id_os"], false, true); - //The interval we are thinking that it must be the agent interval in this - //cell and it'snt the interval of modules. -// if ($agent_info["interval"] > $agent["intervalo"]) { -// $data[2] = ''.$agent_info["interval"].''; -// } else { -// $data[2] = $agent["intervalo"]; -// } $data[3] = human_time_description_raw($agent["intervalo"]); $data[4] = ui_print_group_icon ($agent["id_grupo"], true); $data[5] = ''; $data[5] .= $agent_info["modules"]; - + if ($agent_info["monitor_alertsfired"] > 0) $data[5] .= ' : ' . $agent_info["monitor_alertsfired"] . ''; if ($agent_info["monitor_critical"] > 0) @@ -541,14 +534,15 @@ if (!empty ($table->data)) { html_print_table ($table); ui_pagination ($total_agents, ui_get_url_refresh (array ('group_id' => $group_id, 'search' => $search, 'sort_field' => $sortField, 'sort' => $sort, 'status' => $status))); unset ($table); -} else { +} +else { echo '
'.__('There are no defined agents').'
'; } ?> + \ No newline at end of file diff --git a/pandora_console/operation/integria_incidents/incident_detail.php b/pandora_console/operation/integria_incidents/incident_detail.php index c661972bcf..452bf21cce 100755 --- a/pandora_console/operation/integria_incidents/incident_detail.php +++ b/pandora_console/operation/integria_incidents/incident_detail.php @@ -178,7 +178,8 @@ elseif (isset ($_GET["insert_form"])) { } $prioridad = 0; $id_grupo = 0; -} else { +} +else { db_pandora_audit("HACK","Trying to get to incident details in an unusual way"); require ("general/noaccess.php"); exit; @@ -212,7 +213,8 @@ if (isset ($id_inc)) { //If $id_inc is set (when $_GET["id"] is set, not $_GET[" ui_print_page_header (__('Incident details'). ' #'.$id_inc, "images/book_edit.png", false, "", false, ""); echo ''; echo ''; -} else { +} +else { ui_print_page_header (__('Create incident'), "images/book_edit.png", false, "", false, ""); echo ''; } @@ -222,7 +224,8 @@ echo '
'.__('Incident').''.__('Owner').''; if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) { html_print_select (users_get_info (), "usuario_form", $usuario, '', 'SYSTEM', '', false, false, true, "w135"); -} else { +} +else { html_print_select (users_get_info (), "usuario_form", $usuario, '', 'SYSTEM', '', false, false, true, "w135", true); } echo ''.__('Status').''; @@ -271,7 +275,8 @@ echo ''.__('Group').''; // Group combo if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) { html_print_select_groups($config["id_user"], "IR", true, "grupo_form", $id_grupo, '', '', '', false, false, false, 'w135'); -} else { +} +else { html_print_select_groups($config["id_user"], "IR", true, "grupo_form", $id_grupo, '', '', '', false, false, true, 'w135', true); } @@ -279,14 +284,16 @@ echo '
'.__('Priority').''.__('Creator').''; if (empty ($id_creator)) { echo 'SYSTEM'; -} else { +} +else { echo $id_creator.' ('.get_user_fullname($id_creator).')'; } @@ -294,7 +301,8 @@ echo '
'; if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) { html_print_textarea ("descripcion", 15, 80, $texto, 'style="height:200px;"'); -} else { +} +else { html_print_textarea ("descripcion", 15, 80, $texto, 'style="height:200px;" disabled'); } @@ -303,9 +311,11 @@ echo '
'; // Only if user is the used who opened incident or (s)he is admin if (isset ($id_inc) AND ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"]))) { html_print_submit_button (__('Update incident'), "accion", false, 'class="sub upd"'); -} elseif (check_acl ($config["id_user"], $id_grupo, "IW")) { +} +elseif (check_acl ($config["id_user"], $id_grupo, "IW")) { html_print_submit_button (__('Create'), "accion", false, 'class="sub wand"'); -} else { +} +else { html_print_submit_button (__('Submit'), "accion", true, 'class="sub upd"'); } echo "
"; @@ -389,12 +399,13 @@ if (isset ($id_inc)) { $data[2] = format_for_graph ($row["size"])."B"; if ((check_acl ($config["id_user"], $id_grupo, "IM") == 1) OR ($usuario == $config["id_user"])) { $data[3] = html_print_input_image ("delete_file", "images/cross.png", $row["id_attachment"], 'border:0px;" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;', true); - } else { + } + else { $data[3] = ''; } array_push ($table->data, $data); } - + if (!empty ($table->data)) { echo "

".__('Attached files')."

"; echo '
'; @@ -402,22 +413,22 @@ if (isset ($id_inc)) { echo '
'; } unset ($table); - + // ************************************************************ // Upload control // ************************************************************ - - + + // Upload control if ((check_acl($config["id_user"], $id_grupo, "IW")==1)) { - + echo ''; - + echo '

'.__('Add attachment').'

'; echo ' @@ -426,4 +437,4 @@ if (isset ($id_inc)) {
'.__('Filename').'
'; } } -?> +?> \ No newline at end of file diff --git a/pandora_console/operation/messages/message_edit.php b/pandora_console/operation/messages/message_edit.php index 6f59abe9be..0a94cc63c4 100644 --- a/pandora_console/operation/messages/message_edit.php +++ b/pandora_console/operation/messages/message_edit.php @@ -50,7 +50,8 @@ if ($read_message) { $message_id = (int) get_parameter ("id_message"); if ($show_sent) { $message = messages_get_message_sent ($message_id); - } else { + } + else { $message = messages_get_message ($message_id); messages_process_read ($message_id); } @@ -88,11 +89,12 @@ if ($read_message) { $table->data[3][0] = __('Message'); $table->data[3][1] = html_print_textarea ("message", 15, 255, $message["mensaje"], 'readonly', true); - + //Prevent RE: RE: RE: if (strstr ($message["subject"], "RE:")) { $new_subj = $message["subject"]; - } else { + } + else { $new_subj = "RE: ".$message["subject"]; } @@ -100,11 +102,11 @@ if ($read_message) { $new_msg = "\n\n\nOn ".date ($config["date_format"], $message["timestamp"]).' '.$user_name.' '.__('wrote').":\n\n".$message["mensaje"]; echo '
'; - html_print_table($table); + html_print_table($table); echo "
"; html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); echo "
"; - echo "
"; + echo ""; echo '
'; html_print_input_hidden ("dst_user", $message["id_usuario_origen"]); diff --git a/pandora_console/operation/messages/message_list.php b/pandora_console/operation/messages/message_list.php index 48c9e9cc6f..e6d6c5af4f 100644 --- a/pandora_console/operation/messages/message_list.php +++ b/pandora_console/operation/messages/message_list.php @@ -87,7 +87,8 @@ if ($show_sent) { //sent view echo '

'.__('You have').' '.$num_messages.' '.' '.__('sent message(s)').'.

'; } $messages = messages_get_overview_sent ('', 'DESC'); -} else { //messages received +} +else { //messages received $num_messages = messages_get_count ($config["id_user"]); if ($num_messages > 0 && !is_ajax()) { echo '

'.__('You have').' '.$num_messages.' '.' '.__('unread message(s)').'.

'; @@ -97,7 +98,8 @@ if ($show_sent) { //sent view if (empty ($messages)) { echo '
'.__('There are no messages').'
'; -} else { +} +else { $table->width = "98%"; $table->class = "databox"; $table->cellpadding = 4; @@ -135,17 +137,20 @@ if (empty ($messages)) { $data[0] .= ''; $data[0] .= html_print_image ("images/email_open.png", true, array ("border" => 0, "title" => __('Click to read'))); $data[0] .= ''; - } else { + } + else { $data[0] .= ''; $data[0] .= html_print_image ("images/email_open.png", true, array ("border" => 0, "title" => __('Mark as unread'))); $data[0] .= ''; } - } else { + } + else { if ($show_sent) { $data[0] .= ''; $data[0] .= html_print_image ("images/email.png", true, array ("border" => 0, "title" => __('Message unread - click to read'))); $data[0] .= ''; - } else { + } + else { $data[0] .= ''; $data[0] .= html_print_image ("images/email.png", true, array ("border" => 0, "title" => __('Message unread - click to read'))); $data[0] .= ''; @@ -158,7 +163,8 @@ if (empty ($messages)) { $dest_user = $message["dest"]; } $data[1] = $dest_user; - } else { + } + else { $orig_user = get_user_fullname ($message["sender"]); if (!$orig_user) { $orig_user = $message["sender"]; @@ -168,12 +174,14 @@ if (empty ($messages)) { if ($show_sent) { $data[2] = ''; - } else { + } + else { $data[2] = ''; } if ($message["subject"] == "") { $data[2] .= __('No Subject'); - } else { + } + else { $data[2] .= $message["subject"]; } $data[2] .= ''; @@ -185,7 +193,8 @@ if (empty ($messages)) { onClick="javascript:if (!confirm(\''.__('Are you sure?').'\')) return false;">' . html_print_image ('images/cross.png', true, array("title" => __('Delete'))) . ''. html_print_checkbox_extended ('delete_multiple[]', $message_id, false, false, '', 'class="check_delete"', true); - } else { + } + else { $data[4] = '' . html_print_image ('images/cross.png', true, array("title" => __('Delete'))) . ''. diff --git a/pandora_console/operation/netflow/nf_view.php b/pandora_console/operation/netflow/nf_view.php index 7f43226622..ed3f4f3438 100644 --- a/pandora_console/operation/netflow/nf_view.php +++ b/pandora_console/operation/netflow/nf_view.php @@ -42,7 +42,7 @@ if ($id) { $period = get_parameter('period', '86400'); $update_date = get_parameter('update_date', 0); -if($update_date){ +if ($update_date) { $date = get_parameter_post ('date'); $time = get_parameter_post ('time'); $interval = get_parameter('period','86400'); @@ -72,19 +72,19 @@ echo 'style[0] = 'vertical-align: top;'; - + $table->data = array (); - + $table->data[0][0] = ''.__('Date').''; - + $table->data[0][1] = html_print_input_text ('date', $date, false, 10, 10, true); $table->data[0][1] .= html_print_image ("images/calendar_view_day.png", true, array ("alt" => "calendar", "onclick" => "scwShow(scwID('text-date'),this);")); $table->data[0][1] .= html_print_input_text ('time', $time, false, 10, 5, true); - + $table->data[1][0] = ''.__('Interval').''; $table->data[1][1] = html_print_select (netflow_get_valid_intervals (), 'period', $period, '', '', 0, true, false, false); html_print_table ($table); - + echo '
'; html_print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"'); html_print_input_hidden ('update_date', 1); @@ -107,7 +107,7 @@ if (empty ($all_rcs)) { // Process report items for ($x = 0; isset($all_rcs[$x]['id_rc']); $x++) { - + // Get report item $report_id = $all_rcs[$x]['id_rc']; $content_report = db_get_row_sql("SELECT * FROM tnetflow_report_content WHERE id_rc='$report_id'"); @@ -120,21 +120,18 @@ for ($x = 0; isset($all_rcs[$x]['id_rc']); $x++) { // Get the command to call nfdump $command = netflow_get_command ($filter); - + if ($filter['aggregate'] != 'none') { echo '

' . $filter['id_name'] . ' (' . __($filter['aggregate']) . '/' . __($filter['output']) . ')

'; - } else { + } + else { echo '

' . $filter['id_name'] . ' (' . __($filter['output']) . ')

'; } - + // Build a unique id for the cache $unique_id = $report_id . '_' . $content_id . '_' . ($end_date - $start_date); - + // Draw netflow_draw_item ($start_date, $end_date, $type, $filter, $command, $filter, $max_aggregates, $unique_id); - } - -?> - - +?> \ No newline at end of file diff --git a/pandora_console/operation/reporting/graph_viewer.php b/pandora_console/operation/reporting/graph_viewer.php index b5b0da3465..a94da052fd 100644 --- a/pandora_console/operation/reporting/graph_viewer.php +++ b/pandora_console/operation/reporting/graph_viewer.php @@ -102,9 +102,9 @@ if ($view_graph) { include ("general/noaccess.php"); exit; } - + $url = "index.php?sec=reporting&sec2=operation/reporting/graph_viewer&id=$id_graph&view_graph=1"; - + if (check_acl ($config['id_user'], 0, "IW")) { $options['setup'] = "" . html_print_image ("images/setup.png", true, array ("title" => __('Setup'))) @@ -115,15 +115,16 @@ if ($view_graph) { $options['screen'] = "" . html_print_image ("images/fullscreen.png", true, array ("title" => __('Full screen mode'))) . ""; - } else { + } + else { $options['screen'] = "" . html_print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode'))) . ""; } - + // Header ui_print_page_header (__('Reporting'). " » ". __('Custom graphs')." - ".$graph['name'], "images/reporting.png", false, "", false, $options); - + echo ""; echo ""; echo ""; echo "
"; custom_graphs_print ($id_graph, $height, $width, $period, $stacked, false, $unixdate); @@ -145,9 +146,9 @@ if ($view_graph) { echo "".__('Period').""; echo ""; - + echo html_print_extended_select_for_time ('period', $period, '', '', '0', 10, true); - + echo ""; $stackeds = array (); diff --git a/pandora_console/operation/search_reports.php b/pandora_console/operation/search_reports.php index 30ff28f9fb..c1a8c2dadf 100755 --- a/pandora_console/operation/search_reports.php +++ b/pandora_console/operation/search_reports.php @@ -83,7 +83,8 @@ else { foreach ($reports as $report) { if($linkReport) { $reportstring = "" . $report['name'] . ""; - } else { + } + else { $reportstring = $report['name']; } $data = array( @@ -96,9 +97,9 @@ else { array_push($table->data, $data); } - + echo "
";ui_pagination ($totalReports); html_print_table ($table); unset($table); ui_pagination ($totalReports); } -?> +?> \ No newline at end of file diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php index 20678a8f63..e27580cde0 100644 --- a/pandora_console/operation/snmpconsole/snmp_view.php +++ b/pandora_console/operation/snmpconsole/snmp_view.php @@ -644,7 +644,8 @@ function CheckAll() { function toggleDiv (divid){ if (document.getElementById(divid).style.display == 'none'){ document.getElementById(divid).style.display = 'block'; - } else { + } + else { document.getElementById(divid).style.display = 'none'; } } diff --git a/pandora_console/operation/users/user_edit.php b/pandora_console/operation/users/user_edit.php index 466def9728..dabadc8ff7 100644 --- a/pandora_console/operation/users/user_edit.php +++ b/pandora_console/operation/users/user_edit.php @@ -49,13 +49,13 @@ if (is_ajax ()){ $shortcut_update = get_parameter("shortcut_update", 0); // Update of user to show/don't show shortcut bar - if ($shortcut_update){ - + if ($shortcut_update) { + // First we get the actual state $shortcut_value = db_get_value_filter('shortcut', 'tusuario', array('id_user' => $id)); //Deactivate shorcut var - if ($shortcut_value == 1){ + if ($shortcut_value == 1) { db_process_sql_update('tusuario', array('shortcut' => 0), array('id_user' => $id)); } // Activate shortcut var @@ -64,7 +64,7 @@ if (is_ajax ()){ } } - + return; } @@ -198,7 +198,8 @@ if ($view_mode === false) { html_print_input_text_extended ("password_new", "", '', '', '15', '25', $view_mode, '', 'class="input"', false, true); echo '
'.__('Password confirmation').''; html_print_input_text_extended ("password_conf", "", '', '', '15', '25', $view_mode, '', 'class="input"', false, true); - } else { + } + else { echo ''.__('You can not change your password from Pandora FMS under the current authentication scheme').''; } } @@ -221,7 +222,7 @@ $own_info = get_user_info ($config['id_user']); if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) $display_all_group = true; else - $display_all_group = false; + $display_all_group = false; $usr_groups = (users_get_groups($config['id_user'], 'AR', $display_all_group)); $id_usr = $config['id_user']; @@ -265,7 +266,8 @@ $dashboards = get_user_dashboards ($config['id_user']); $dashboards_aux = array(); if ($dashboards === false) { $dashboards = array('None'=>'None'); -} else { +} +else { foreach ($dashboards as $key=>$dashboard) { $dashboards_aux[$dashboard['name']] = $dashboard['name']; } @@ -276,7 +278,8 @@ $layouts = visual_map_get_user_layouts ($config['id_user'], true); $layouts_aux = array(); if ($layouts === false) { $layouts_aux = array('None'=>'None'); -} else { +} +else { foreach ($layouts as $layout) { $layouts_aux[$layout] = $layout; } @@ -290,7 +293,8 @@ echo '
'; echo '
'; if (!$config["user_can_update_info"]) { echo ''.__('You can not change your user info from Pandora FMS under the current authentication scheme').''; -} else { +} +else { html_print_submit_button (__('Update'), 'uptbutton', $view_mode, 'class="sub upd"'); } echo '
'; @@ -324,7 +328,8 @@ foreach ($result as $profile) { if (!empty ($table->data)) { html_print_table ($table); -} else { +} +else { echo '
'.__('This user doesn\'t have any assigned profile/group').'
'; } ?>