diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 9c1524aabf..e44761f481 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -45,8 +45,9 @@ config_check(); } $logo_title = 'Pandora FMS Enterprise'; } - - echo html_print_image($custom_logo, true, array("alt" => $logo_title, "border" => '0')); + + echo html_print_image($custom_logo, true, + array("alt" => $logo_title, "border" => '0')); ?> diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index a560a73bff..d748cf1d4a 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -268,7 +268,8 @@ $table->data[6][1] = html_print_select (servers_get_names (), // Description $table->data[7][0] = __('Description'); -$table->data[7][1] = html_print_input_text ('comentarios', $comentarios, '', 45, 255, true); +$table->data[7][1] = html_print_input_text ('comentarios', $comentarios, + '', 45, 255, true); html_print_table ($table); unset($table); @@ -376,10 +377,12 @@ if ($config['activate_gis']) { } $table->data[6][0] = __('Url address'); -$table->data[6][1] = html_print_input_text ('url_description', $url_description, '', 45, 255, true); +$table->data[6][1] = html_print_input_text ('url_description', + $url_description, '', 45, 255, true); $table->data[7][0] = __('Quiet'); -$table->data[7][0] .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true); +$table->data[7][0] .= ui_print_help_tip( + __('The agent still runs but the alerts and events will be stop'), true); $table->data[7][1] = html_print_checkbox('quiet', 1, $quiet, true); ui_toggle(html_print_table ($table, true), __('Advanced options')); @@ -401,13 +404,16 @@ foreach ($fields as $field) { $data[0] = ''.$field['name'].''; - $custom_value = db_get_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente)); + $custom_value = db_get_value_filter('description', + 'tagent_custom_data', + array('id_field' => $field['id_field'], 'id_agent' => $id_agente)); if ($custom_value === false) { $custom_value = ''; } - $data[1] = html_print_textarea ('customvalue_'.$field['id_field'], 2, 65, $custom_value, 'style="min-height: 30px;"', true); + $data[1] = html_print_textarea ('customvalue_'.$field['id_field'], + 2, 65, $custom_value, 'style="min-height: 30px;"', true); array_push ($table->data, $data); } @@ -433,12 +439,14 @@ echo ""; if ($id_agente) { - html_print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"'); + html_print_submit_button (__('Update'), 'updbutton', false, + 'class="sub upd"'); html_print_input_hidden ('update_agent', 1); html_print_input_hidden ('id_agente', $id_agente); } else { - html_print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"'); + html_print_submit_button (__('Create'), 'crtbutton', false, + 'class="sub wand"'); html_print_input_hidden ('create_agent', 1); } echo ''; @@ -448,54 +456,64 @@ ui_require_jquery_file ('ajaxqueue'); ui_require_jquery_file ('bgiframe'); ?> diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 308ba166e6..ba02c2f283 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -784,6 +784,7 @@ $edit_module = (bool) get_parameter ('edit_module'); if ($update_module || $create_module) { $id_grupo = agents_get_agent_group ($id_agente); + if (!check_acl ($config["id_user"], $id_grupo, "AW")) { db_pandora_audit("ACL Violation", "Trying to create a module without admin rights"); @@ -803,7 +804,7 @@ if ($update_module || $create_module) { $post_process = (string) get_parameter ('post_process', 0.0); //$prediction_module = 0; - + $max_timeout = (int) get_parameter ('max_timeout'); $max_retries = (int) get_parameter ('max_retries'); $min = (int) get_parameter_post ("min"); @@ -858,8 +859,8 @@ if ($update_module || $create_module) { $macros = io_json_mb_encode($macros); $conf_array = explode("\n",$configuration_data); - foreach($conf_array as $line) { - if(preg_match("/^module_name\s*(.*)/", $line, $match)) { + foreach ($conf_array as $line) { + if (preg_match("/^module_name\s*(.*)/", $line, $match)) { $new_configuration_data .= "module_name $name\n"; } // We delete from conf all the module macros starting with _field @@ -870,7 +871,7 @@ if ($update_module || $create_module) { $macros_for_data = enterprise_hook('config_agents_get_macros_data_conf', array($_POST)); - if($macros_for_data !== ENTERPRISE_NOT_HOOK && $macros_for_data != '') { + if ($macros_for_data !== ENTERPRISE_NOT_HOOK && $macros_for_data != '') { // Add macros to configuration file $new_configuration_data = str_replace('module_end', $macros_for_data."module_end", $new_configuration_data); } @@ -950,9 +951,10 @@ if ($update_module || $create_module) { $wday = get_parameter('wday'); $cron_interval = "$minute $hour $mday $month $wday"; - if ($prediction_module != 3) { + if ($prediction_module != MODULE_PREDICTION_SYNTHETIC) { unset($serialize_ops); - enterprise_hook('modules_delete_synthetic_operations', array($id_agent_module)); + enterprise_hook('modules_delete_synthetic_operations', + array($id_agent_module)); } $active_snmp_v3 = get_parameter('active_snmp_v3'); @@ -972,7 +974,8 @@ if ($update_module || $create_module) { // Make changes in the conf file if necessary enterprise_include_once('include/functions_config_agents.php'); enterprise_hook('config_agents_write_module_in_conf', - array($id_agente, io_safe_output($old_configuration_data), io_safe_output($configuration_data), $disabled)); + array($id_agente, io_safe_output($old_configuration_data), + io_safe_output($configuration_data), $disabled)); } // MODULE UPDATE @@ -1040,8 +1043,10 @@ if ($update_module) { if ($module_kind == MODULE_DATA) { unset($values['module_interval']); } - - if ($prediction_module == 3 && $serialize_ops == '') { + + if ($prediction_module == MODULE_PREDICTION_SYNTHETIC && + $serialize_ops == '') { + $result = false; } else { @@ -1072,7 +1077,7 @@ if ($update_module) { $edit_module = true; db_pandora_audit("Agent management", - "Fail to try update module '$name' for agent ".$agent["nombre"]); + "Fail to try update module '$name' for agent " . $agent["nombre"]); } else { if ($prediction_module == 3) { diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 8f832c4ce9..a9c0f5a73d 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -296,8 +296,9 @@ $table_advanced->width = '98%'; $table_advanced->class = 'databox_color'; $table_advanced->data = array (); $table_advanced->style = array (); -$table_advanced->style[0] = 'font-weight: bold; vertical-align: top'; -$table_advanced->style[3] = 'font-weight: bold; vertical-align: top'; +$table_advanced->style[0] = + $table_advanced->style[3] = + 'font-weight: bold; vertical-align: top'; $table_advanced->colspan = array (); $table_advanced->data[0][0] = __('Description'); @@ -356,8 +357,9 @@ else { $table_advanced->data[2][1] .= html_print_input_hidden ('moduletype', $moduletype, true); $table_advanced->data[2][3] = __('Post process').' ' . ui_print_help_icon ('postprocess', true); -$table_advanced->data[2][4] = html_print_input_text ('post_process', - $post_process, '', 15, 25, true, $disabledBecauseInPolicy); +$table_advanced->data[2][4] = + html_print_input_text('post_process', + $post_process, '', 15, 25, true, $disabledBecauseInPolicy); $table_advanced->data[3][0] = __('Min. Value'); $table_advanced->colspan[3][1] = 2; @@ -420,13 +422,18 @@ if ($__code_from == 'modules') { $__table_modules = 'ttag_module'; $__id_where = 'b.id_agente_modulo'; $__id = (int)$id_agent_module; + // Code comes from policy module editor + } else { + global $__id_pol_mod; $__table_modules= 'ttag_policy_module'; $__id_where = 'b.id_policy_module'; $__id = $__id_pol_mod; + + } if (!tags_has_user_acl_tags($config["id_user"])) { @@ -468,28 +475,33 @@ else { true, true, false, false, 'width: 200px', '5'); } } -$table_advanced->data[6][2] = html_print_image('images/darrowright.png', true, array('id' => 'right', 'title' => __('Add tags to module'))); //html_print_input_image ('add', 'images/darrowright.png', 1, '', true, array ('title' => __('Add tags to module'))); +$table_advanced->data[6][2] = html_print_image('images/darrowright.png', true, array('id' => 'right', 'title' => __('Add tags to module'))); //html_print_input_image ('add', 'images/darrowright.png', 1, '', true, array ('title' => __('Add tags to module'))); $table_advanced->data[6][2] .= '



' . html_print_image('images/darrowleft.png', true, array('id' => 'left', 'title' => __('Delete tags to module'))); //html_print_input_image ('add', 'images/darrowleft.png', 1, '', true, array ('title' => __('Delete tags to module'))); $table_advanced->data[6][3] = '' . __('Tags selected') . ''; -$table_advanced->data[6][4] = html_print_select_from_sql ( +$table_advanced->data[6][4] = html_print_select_from_sql ( "SELECT a.id_tag, name FROM ttag a, $__table_modules b WHERE a.id_tag = b.id_tag AND $__id_where = $__id ORDER BY name", 'id_tag_selected[]', '', '','','', true, true, false, false, 'width: 200px', '5'); + + $table_advanced->data[7][0] = __('Quiet'); -$table_advanced->data[7][0] .= ui_print_help_tip(__('The module still stores data but the alerts and events will be stop'), true); +$table_advanced->data[7][0] .= ui_print_help_tip( + __('The module still stores data but the alerts and events will be stop'), true); $table_advanced->colspan[7][1] = 4; $table_advanced->data[7][1] = html_print_checkbox('quiet_module', 1, $quiet_module, true); -$table_advanced->data[8][0] = __('Critical instructions'). ui_print_help_tip(__("Instructions when the status is critical"), true); +$table_advanced->data[8][0] = __('Critical instructions') . + ui_print_help_tip(__("Instructions when the status is critical"), true); $table_advanced->data[8][1] = html_print_textarea ('critical_instructions', 2, 65, $critical_instructions, '', true); $table_advanced->colspan[8][1] = 4; -$table_advanced->data[9][0] = __('Warning instructions'). ui_print_help_tip(__("Instructions when the status is warning"), true); +$table_advanced->data[9][0] = __('Warning instructions') . + ui_print_help_tip(__("Instructions when the status is warning"), true); $table_advanced->data[9][1] = html_print_textarea ('warning_instructions', 2, 65, $warning_instructions, '', true); $table_advanced->colspan[9][1] = 4; @@ -497,7 +509,8 @@ $table_advanced->data[10][0] = __('Unknown instructions'). ui_print_help_tip(__( $table_advanced->data[10][1] = html_print_textarea ('unknown_instructions', 2, 65, $unknown_instructions, '', true); $table_advanced->colspan[10][1] = 4; -$table_advanced->data[11][0] = __('Cron') . ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true); +$table_advanced->data[11][0] = __('Cron') . + ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true); $table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour, $minute, $mday, $month, $wday, true); $table_advanced->colspan[11][1] = 4; diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php index c92f5ef9e8..c0fa720daf 100644 --- a/pandora_console/godmode/alerts/alert_commands.php +++ b/pandora_console/godmode/alerts/alert_commands.php @@ -70,6 +70,7 @@ if (is_ajax ()) { $fields_rows = array(); for ($i = 1; $i <= 10; $i++) { + if (!empty($fields_descriptions[$i - 1])) { $fdesc = $fields_descriptions[$i - 1] . '
' . diff --git a/pandora_console/godmode/alerts/alert_templates.php b/pandora_console/godmode/alerts/alert_templates.php index 82e5d7854d..dad074fce5 100644 --- a/pandora_console/godmode/alerts/alert_templates.php +++ b/pandora_console/godmode/alerts/alert_templates.php @@ -156,7 +156,7 @@ if ($delete_template) { $id = get_parameter ('id'); $al_template = alerts_get_alert_template($id); - if ($al_template !== false){ + if ($al_template !== false) { // If user tries to delete a template with group=ALL then must have "PM" access privileges if ($al_template['id_group'] == 0) { if (! check_acl ($config['id_user'], 0, "PM")) { @@ -233,6 +233,7 @@ $table->width = '98%'; $table->data = array (); $table->head = array (); $table->style = array (); + $table->style[0] = 'font-weight: bold'; $table->style[2] = 'font-weight: bold'; diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index fd48c695df..c059bf898d 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -311,6 +311,7 @@ $(document).ready (function () { } } + render_command_preview(original_command); render_command_recovery_preview(original_command); diff --git a/pandora_console/godmode/category/category.php b/pandora_console/godmode/category/category.php index 6352ef1f3e..664def7b51 100755 --- a/pandora_console/godmode/category/category.php +++ b/pandora_console/godmode/category/category.php @@ -126,6 +126,7 @@ if (!empty($result)) { } html_print_table ($table); + } else { // No categories available or selected diff --git a/pandora_console/godmode/category/edit_category.php b/pandora_console/godmode/category/edit_category.php index d65a0fc88f..db5db19543 100755 --- a/pandora_console/godmode/category/edit_category.php +++ b/pandora_console/godmode/category/edit_category.php @@ -119,7 +119,7 @@ echo ""; echo ""; - echo ""; echo ""; diff --git a/pandora_console/godmode/db/db_audit.php b/pandora_console/godmode/db/db_audit.php index b496f9ca78..efebd4968a 100644 --- a/pandora_console/godmode/db/db_audit.php +++ b/pandora_console/godmode/db/db_audit.php @@ -31,22 +31,22 @@ if (! check_acl ($config['id_user'], 0, "DM")) { $time["all"] = get_system_time (); // 1 day ago -$time["1day"] = $time["all"]-86400; +$time["1day"] = $time["all"] - SECONDS_1DAY; // 3 days ago -$time["3day"] = $time["all"]-(86400*3); +$time["3day"] = $time["all"] - ( SECONDS_1DAY * 3); // 1 week ago -$time["1week"] = $time["all"]-(86400*7); +$time["1week"] = $time["all"] - SECONDS_1WEEK; // 2 weeks ago -$time["2week"] = $time["all"]-(86400*14); +$time["2week"] = $time["all"] - SECONDS_2WEEK; // 1 month ago -$time["1month"] = $time["all"]-(86400*30); +$time["1month"] = $time["all"] - SECONDS_1MONTH; // Three months ago -$time["3month"] = $time["all"]-(86400*90); +$time["3month"] = $time["all"] - SECONDS_3MONTHS; // Todo for a good DB maintenance /* diff --git a/pandora_console/godmode/events/custom_events.php b/pandora_console/godmode/events/custom_events.php index 2ce631dd61..1eb7ddde1a 100644 --- a/pandora_console/godmode/events/custom_events.php +++ b/pandora_console/godmode/events/custom_events.php @@ -52,9 +52,11 @@ else if ($update != '') { 'value' => $event_fields ); //update 'event_fields' in tconfig table to keep the value at update. - $result = db_process_sql_update('tconfig', $values, array ('token' => 'event_fields')); + $result = db_process_sql_update('tconfig', $values, + array ('token' => 'event_fields')); } + $result_selected = array(); //show list of fields selected. diff --git a/pandora_console/godmode/events/event_filter.php b/pandora_console/godmode/events/event_filter.php index 49659619b0..51933576b0 100644 --- a/pandora_console/godmode/events/event_filter.php +++ b/pandora_console/godmode/events/event_filter.php @@ -78,7 +78,10 @@ $own_info = get_user_info ($config['id_user']); // Get group list that user has access $groups_user = users_get_groups ($config['id_user'], "EW", users_can_manage_group_all(), true); -$sql = "SELECT * FROM tevent_filter WHERE id_group_filter IN (".implode(',', array_keys ($groups_user)).")"; +$sql = " + SELECT * + FROM tevent_filter + WHERE id_group_filter IN (".implode(',', array_keys ($groups_user)).")"; $filters = db_get_all_rows_sql($sql); if ($filters === false) diff --git a/pandora_console/godmode/massive/massive_add_action_alerts.php b/pandora_console/godmode/massive/massive_add_action_alerts.php index 4c3715a598..b92b677909 100644 --- a/pandora_console/godmode/massive/massive_add_action_alerts.php +++ b/pandora_console/godmode/massive/massive_add_action_alerts.php @@ -37,7 +37,7 @@ if (is_ajax ()) { return; } - if(is_array($id_agents) && count($id_agents) == 1 && $id_agents[0] == '') { + if (is_array($id_agents) && count($id_agents) == 1 && $id_agents[0] == '') { $id_agents = false; } @@ -56,7 +56,7 @@ $recursion = get_parameter ('recursion'); $add = (bool) get_parameter_post ('add'); if ($add) { - if(empty($id_agents) || $id_agents[0] == 0) + if (empty($id_agents) || $id_agents[0] == 0) ui_print_result_message (false, '', __('Could not be added').". ".__('No agents selected')); else { $actions = get_parameter ('action'); @@ -76,9 +76,9 @@ if ($add) { $options = array(); - if($fires_min > 0) + if ($fires_min > 0) $options['fires_min'] = $fires_min; - if($fires_max > 0) + if ($fires_max > 0) $options['fires_max'] = $fires_max; if (empty($agent_alerts_id)) { @@ -87,9 +87,9 @@ if ($add) { else { $results = true; foreach ($agent_alerts_id as $agent_alert_id) { - foreach($actions as $action) { + foreach ($actions as $action) { $result = alerts_add_alert_agent_module_action($agent_alert_id, $action, $options); - if($result === false) + if ($result === false) $results = false; } } @@ -169,14 +169,14 @@ html_print_table ($table); $sql = 'SELECT id_agente FROM tagente_modulo WHERE id_agente_modulo IN (SELECT id_agent_module FROM talert_template_modules)'; $agents_with_templates = db_get_all_rows_sql($sql); $agents_with_templates_json = array(); -foreach($agents_with_templates as $ag) { +foreach ($agents_with_templates as $ag) { $agents_with_templates_json[] = $ag['id_agente']; } $agents_with_templates_json = json_encode($agents_with_templates_json); echo ""; -echo '
'; +echo '
'; html_print_input_hidden ('add', 1); html_print_submit_button (__('Add'), 'go', false, 'class="sub add"'); echo '
'; @@ -189,7 +189,10 @@ ui_require_jquery_file ('pandora.controls'); ?> diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php index 847119be7c..3fb7e92e06 100644 --- a/pandora_console/godmode/massive/massive_edit_agents.php +++ b/pandora_console/godmode/massive/massive_edit_agents.php @@ -436,9 +436,13 @@ ui_require_jquery_file ('bgiframe'); ?>
"; html_print_label (__("Name"),'name'); echo ""; + echo ""; html_print_input_text ('name_category', $name_category); echo "