diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 7addef057f..a41c8326f0 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -145,10 +145,19 @@ require_once 'include/functions_notifications.php'; $_GET['refr'] = null; } - $select = db_process_sql("SELECT autorefresh_white_list,time_autorefresh FROM tusuario WHERE id_user = '".$config['id_user']."'"); - $autorefresh_list = json_decode($select[0]['autorefresh_white_list']); + $select = db_process_sql( + "SELECT autorefresh_white_list,time_autorefresh + FROM tusuario + WHERE id_user = '".$config['id_user']."'" + ); - if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) { + $autorefresh_list = json_decode( + $select[0]['autorefresh_white_list'] + ); + + if ($autorefresh_list !== null + && array_search($_GET['sec2'], $autorefresh_list) !== false + ) { $do_refresh = true; if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') { if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) { @@ -157,22 +166,56 @@ require_once 'include/functions_notifications.php'; } if ($do_refresh) { - $autorefresh_img = html_print_image('images/header_refresh_gray.png', true, ['class' => 'bot', 'alt' => 'lightning', 'title' => __('Configure autorefresh')]); + $autorefresh_img = html_print_image( + 'images/header_refresh_gray.png', + true, + [ + 'class' => 'bot', + 'alt' => 'lightning', + 'title' => __('Configure autorefresh'), + ] + ); - if ($_GET['refr']) { - $autorefresh_txt .= ' ('.date('i:s', $config['refr']).')'; + if ((isset($select[0]['time_autorefresh']) === true) + && $select[0]['time_autorefresh'] !== 0 && !$config['refr'] + ) { + $config['refr'] = $select[0]['time_autorefresh']; + $autorefresh_txt .= ' ('; + $autorefresh_txt .= date( + 'i:s', + $config['refr'] + ); + $autorefresh_txt .= ')'; + } else if ($_GET['refr']) { + $autorefresh_txt .= ' ('; + $autorefresh_txt .= date('i:s', $config['refr']); + $autorefresh_txt .= ')'; } $ignored_params['refr'] = ''; $values = get_refresh_time_array(); + $autorefresh_additional = ''; unset($values); $autorefresh_link_open_img = ''; - if ($_GET['refr']) { + if ($_GET['refr'] + || ((isset($select[0]['time_autorefresh']) === true) + && $select[0]['time_autorefresh'] !== 0) + ) { $autorefresh_link_open_txt = ''; } else { $autorefresh_link_open_txt = ''; @@ -192,7 +235,15 @@ require_once 'include/functions_notifications.php'; $display_counter = 'display:none'; } } else { - $autorefresh_img = html_print_image('images/header_refresh_disabled_gray.png', true, ['class' => 'bot autorefresh_disabled', 'alt' => 'lightning', 'title' => __('Disabled autorefresh')]); + $autorefresh_img = html_print_image( + 'images/header_refresh_disabled_gray.png', + true, + [ + 'class' => 'bot autorefresh_disabled', + 'alt' => 'lightning', + 'title' => __('Disabled autorefresh'), + ] + ); $ignored_params['refr'] = false; @@ -203,8 +254,18 @@ require_once 'include/functions_notifications.php'; $display_counter = 'display:none'; } - $header_autorefresh = '
'.$autorefresh_link_open_img.$autorefresh_img.$autorefresh_link_close.'
'; - $header_autorefresh_counter = '
'.$autorefresh_link_open_txt.$autorefresh_txt.$autorefresh_link_close.$autorefresh_additional.'
'; + $header_autorefresh = '
'; + $header_autorefresh .= $autorefresh_link_open_img; + $header_autorefresh .= $autorefresh_img; + $header_autorefresh .= $autorefresh_link_close; + $header_autorefresh .= '
'; + + $header_autorefresh_counter = '
'; + $header_autorefresh_counter .= $autorefresh_link_open_txt; + $header_autorefresh_counter .= $autorefresh_txt; + $header_autorefresh_counter .= $autorefresh_link_close; + $header_autorefresh_counter .= $autorefresh_additional; + $header_autorefresh_counter .= '
'; // Qr. @@ -238,16 +299,40 @@ require_once 'include/functions_notifications.php'; __('Edit my user'), 'class' => 'bot', 'alt' => 'user']); + $header_user = html_print_image( + 'images/header_user_admin_green.png', + true, + [ + 'title' => __('Edit my user'), + 'class' => 'bot', + 'alt' => 'user', + ] + ); } else { - $header_user = html_print_image('images/header_user_green.png', true, ['title' => __('Edit my user'), 'class' => 'bot', 'alt' => 'user']); + $header_user = html_print_image( + 'images/header_user_green.png', + true, + [ + 'title' => __('Edit my user'), + 'class' => 'bot', + 'alt' => 'user', + ] + ); } $header_user = '
'.$header_user.' ('.$config['id_user'].')
'; // Logout. $header_logout = '
'; - $header_logout .= html_print_image('images/header_logout_gray.png', true, ['alt' => __('Logout'), 'class' => 'bot', 'title' => __('Logout')]); + $header_logout .= html_print_image( + 'images/header_logout_gray.png', + true, + [ + 'alt' => __('Logout'), + 'class' => 'bot', + 'title' => __('Logout'), + ] + ); $header_logout .= '
'; echo '
'.$header_autorefresh, $header_autorefresh_counter, $header_qr, $header_chat.'
@@ -490,7 +575,12 @@ require_once 'include/functions_notifications.php'; ); - $("a.autorefresh_txt").toggle (); - $("#combo_refr").toggle (); - href = $("a.autorefresh").attr ("href"); - - var refresh = ''; - $(document).attr ("location", href + refresh); - - - @@ -547,14 +620,14 @@ require_once 'include/functions_notifications.php'; blinkpubli(); $("#header_autorefresh").css('padding-right', '5px'); var refr_time = ; var t = new Date(); - t.setTime (t.getTime () + - parseInt()); - $("#refrcounter").countdown ({until: t, + t.setTime (t.getTime () + parseInt()); + $("#refrcounter").countdown ({ + until: t, layout: '%M%nn%M:%S%nn%S', labels: ['', '', '', '', '', '', ''], onExpiry: function () { diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index de7a02074a..b259e35e66 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -1,33 +1,52 @@ 0) { - // Agent name + // Agent name. echo agents_get_alias($event['id_agente']); } else { echo ''; @@ -104,7 +123,7 @@ if (is_ajax()) { $comment = (string) get_parameter('comment'); $new_status = get_parameter('new_status'); - // Set off the standby mode when close an event + // Set off the standby mode when close an event. if ($new_status == 1) { $event = events_get_event($id); alerts_agent_module_standby($event['id_alert_am'], 0); @@ -251,7 +270,14 @@ if (!$meta) { 'ACL Violation', 'Trying to access event viewer. View disabled due event replication.' ); - ui_print_info_message(['message' => __('Event viewer is disabled due event replication. For more information, please contact with the administrator'), 'no_close' => true]); + ui_print_info_message( + [ + 'message' => __( + 'Event viewer is disabled due event replication. For more information, please contact with the administrator' + ), + 'no_close' => true, + ] + ); return; } else { $readonly = true; @@ -270,16 +296,20 @@ $id_group = (int) get_parameter('id_group', 0); // $recursion = (bool)get_parameter('recursion', false); //Flag show in child groups // ********************************************************************** $recursion = (bool) get_parameter('recursion', true); -// Flag show in child groups +// Flag show in child groups. $event_type = get_parameter('event_type', ''); -// 0 all +// 0 all. $severity = (int) get_parameter('severity', -1); -// -1 all +// -1 all. $status = (int) get_parameter('status', 3); -// -1 all, 0 only new, 1 only validated, 2 only in process, 3 only not validated, +// -1 all, 0 only new, 1 only validated, +// 2 only in process, 3 only not validated. $id_agent = (int) get_parameter('id_agent', 0); $pagination = (int) get_parameter('pagination', $config['block_size']); -$event_view_hr = (int) get_parameter('event_view_hr', $history ? 0 : $config['event_view_hr']); +$event_view_hr = (int) get_parameter( + 'event_view_hr', + ($history) ? 0 : $config['event_view_hr'] +); $id_user_ack = get_parameter('id_user_ack', 0); $group_rep = (int) get_parameter('group_rep', 1); $delete = (bool) get_parameter('delete'); @@ -313,9 +343,17 @@ if ($id_agent != 0) { } $text_module = (string) get_parameter('module_search', ''); -$id_agent_module = get_parameter('module_search_hidden', get_parameter('id_agent_module', 0)); +$id_agent_module = get_parameter( + 'module_search_hidden', + get_parameter('id_agent_module', 0) +); if ($id_agent_module != 0) { - $text_module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_agent_module); + $text_module = db_get_value( + 'nombre', + 'tagente_modulo', + 'id_agente_modulo', + $id_agent_module + ); if ($text_module == false) { $text_module = ''; } @@ -362,42 +400,42 @@ $url = 'index.php?sec=eventos&sec2=operation/events/events&'.$params; -// Header +// Header. if ($config['pure'] == 0 || $meta) { $pss = get_user_info($config['id_user']); $hashup = md5($config['id_user'].$pss['password']); - // Fullscreen + // Fullscreen. $fullscreen['active'] = false; $fullscreen['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen')]).''; - // Event list + // Event list. $list['active'] = false; $list['text'] = ''.html_print_image('images/events_list.png', true, ['title' => __('Event list')]).''; - // History event list + // History event list. $history_list['active'] = false; $history_list['text'] = ''.html_print_image('images/books.png', true, ['title' => __('History event list')]).''; - // RSS + // RSS. $rss['active'] = false; $rss['text'] = ''.html_print_image('images/rss.png', true, ['title' => __('RSS Events')]).''; - // Marquee + // Marquee. $marquee['active'] = false; $marquee['text'] = ''.html_print_image('images/heart.png', true, ['title' => __('Marquee display')]).''; - // CSV + // CSV. $csv['active'] = false; $csv['text'] = ''.html_print_image('images/csv_mc.png', true, ['title' => __('Export to CSV file')]).''; - // Sound events + // Sound events. $sound_event['active'] = false; $sound_event['text'] = ''.html_print_image('images/sound.png', true, ['title' => __('Sound events')]).''; - // If the user has administrator permission display manage tab + // If the user has administrator permission display manage tab. if (check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, 'EM')) { - // Manage events + // Manage events. $manage_events['active'] = false; $manage_events['text'] = ''.html_print_image('images/setup.png', true, ['title' => __('Manage events')]).''; @@ -425,7 +463,7 @@ if ($config['pure'] == 0 || $meta) { ]; } - // If the history event is not ebabled, dont show the history tab + // If the history event is not ebabled, dont show the history tab. if (!isset($config['metaconsole_events_history']) || $config['metaconsole_events_history'] != 1) { unset($onheader['history']); } @@ -447,16 +485,6 @@ if ($config['pure'] == 0 || $meta) { break; } - - /* - Hello there! :) - - We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :( - - You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years. - - */ - if (! defined('METACONSOLE')) { unset($onheader['history']); ui_print_page_header( @@ -482,37 +510,55 @@ if ($config['pure'] == 0 || $meta) { '; echo ''; echo ''; - // Floating menu - End + // Floating menu - End. ui_require_jquery_file('countdown'); } -// Error div for ajax messages +// Error div for ajax messages. echo "
"; echo '
'; @@ -535,7 +581,7 @@ if (($section == 'validate') && ($ids[0] == -1)) { ui_print_error_message(__('No events selected')); } -// Process validation (pass array or single value) +// Process validation (pass array or single value). if ($validate) { $ids = get_parameter('eventid', -1); $comment = get_parameter('comment', ''); @@ -543,7 +589,7 @@ if ($validate) { $ids = explode(',', $ids); $standby_alert = (bool) get_parameter('standby-alert'); - // Avoid to re-set inprocess events + // Avoid to re-set inprocess events. if ($new_status == 2) { foreach ($ids as $key => $id) { $event = events_get_event($id); @@ -572,11 +618,11 @@ if ($validate) { } } -// Process deletion (pass array or single value) +// Process deletion (pass array or single value). if ($delete) { $ids = (array) get_parameter('validate_ids', -1); - // Discard deleting in progress events + // Discard deleting in progress events. $in_process_status = db_get_all_rows_sql( ' SELECT id_evento @@ -629,7 +675,6 @@ $(document).ready( function() { var refr = ; var pure = ; var href = ""; - // alert($(location).attr('href')); if (pure) { var startCountDown = function (duration, cb) { $('div.vc-countdown').countdown('destroy'); @@ -663,9 +708,10 @@ $(document).ready( function() { }); } else { - $('#refresh').change(function () { - $('#hidden-vc_refr').val($('#refresh option:selected').val()); + $('#hidden-vc_refr').val( + $('#refresh option:selected').val() + ); }); } @@ -930,7 +976,7 @@ $(document).ready( function() { {"page" : "operation/events/events", "delete_event" : 1, "id" : id, - "similars" : , + "similars" : , "meta" : meta, "history" : history_var }, diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index 92ef7bff6d..2146447272 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -1,28 +1,44 @@ $user]); -$update_from_filter_table = (bool) get_parameter('update_from_filter_table', false); +$user_filter = db_get_value_filter( + 'default_event_filter', + 'tusuario', + ['id_user' => $user] +); +$update_from_filter_table = (bool) get_parameter( + 'update_from_filter_table', + false +); if ($user_filter != 0 && empty($id_name) && !$update_from_filter_table) { - $user_default_filter = db_get_all_rows_filter('tevent_filter', ['id_filter' => $user_filter]); + $user_default_filter = db_get_all_rows_filter( + 'tevent_filter', + ['id_filter' => $user_filter] + ); $user_default_filter = $user_default_filter[0]; - // FORM + // FORM. $id_name = $user_default_filter['id_name']; $id_group = $user_default_filter['id_group']; if ($user_default_filter['event_type'] != '') { @@ -242,22 +280,24 @@ if ($user_filter != 0 && empty($id_name) && !$update_from_filter_table) { $date_to = $user_default_filter['date_to']; } - if (io_safe_output($user_default_filter['tag_with']) != '[]' && io_safe_output($user_default_filter['tag_with']) != '["0"]') { + if (io_safe_output($user_default_filter['tag_with']) != '[]' + && io_safe_output($user_default_filter['tag_with']) != '["0"]' + ) { $tag_with = $user_default_filter['tag_with']; $tag_with_clean = io_safe_output($tag_with); $tag_with = json_decode($tag_with_clean, true); } - if (io_safe_output($user_default_filter['tag_without']) != '[]' && io_safe_output($user_default_filter['tag_without']) != '["0"]') { + if (io_safe_output($user_default_filter['tag_without']) != '[]' + && io_safe_output($user_default_filter['tag_without']) != '["0"]' + ) { $tag_without = $user_default_filter['tag_without']; $tag_without_clear = io_safe_output($tag_without); $tag_without = json_decode($tag_without_clear, true); } } -// -------------------------------------------------------------------------- -// -// Build the condition of the events query +// Build the condition of the events query. $sql_post = ''; $id_user = $config['id_user']; @@ -265,10 +305,10 @@ $id_user = $config['id_user']; $filter_resume = []; require 'events.build_query.php'; -// Now $sql_post have all the where condition -// +// Now $sql_post have all the where condition. // Trick to catch if any filter button has been pushed (don't collapse filter) -// or the filter was open before click or autorefresh is in use (collapse filter) +// or the filter was open before click +// or autorefresh is in use (collapse filter). $update_pressed = get_parameter_post('update', ''); $update_pressed = (int) !empty($update_pressed); @@ -279,9 +319,15 @@ if ($update_pressed || $open_filter) { unset($table); $filters = events_get_event_filter_select(); -$user_groups_array = users_get_groups_for_select($config['id_user'], $access, true, true, false); +$user_groups_array = users_get_groups_for_select( + $config['id_user'], + $access, + true, + true, + false +); -// Some translated words to be used from javascript +// Some translated words to be used from javascript. html_print_div( [ 'hidden' => true, @@ -289,6 +335,7 @@ html_print_div( 'content' => __('No filter loaded'), ] ); + html_print_div( [ 'hidden' => true, @@ -296,6 +343,7 @@ html_print_div( 'content' => __('Filter loaded'), ] ); + html_print_div( [ 'hidden' => true, @@ -303,6 +351,7 @@ html_print_div( 'content' => __('Save filter'), ] ); + html_print_div( [ 'hidden' => true, @@ -311,8 +360,10 @@ html_print_div( ] ); -if (check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, 'EM')) { - // Save filter div for dialog +if (check_acl($config['id_user'], 0, 'EW') + || check_acl($config['id_user'], 0, 'EM') +) { + // Save filter div for dialog. echo ''; } -// Load filter div for dialog +// Load filter div for dialog. echo ''; -// TAGS +// TAGS. $tags_select_with = []; $tags_select_without = []; $tag_with_temp = []; $tag_without_temp = []; foreach ($tags as $id_tag => $tag) { - if ((array_search($id_tag, $tag_with) === false) || (array_search($id_tag, $tag_with) === null)) { + if ((array_search($id_tag, $tag_with) === false) + || (array_search($id_tag, $tag_with) === null) + ) { $tags_select_with[$id_tag] = ui_print_truncate_text($tag, 50, true); } else { $tag_with_temp[$id_tag] = ui_print_truncate_text($tag, 50, true); } - if ((array_search($id_tag, $tag_without) === false) || (array_search($id_tag, $tag_without) === null)) { + if ((array_search($id_tag, $tag_without) === false) + || (array_search($id_tag, $tag_without) === null) + ) { $tags_select_without[$id_tag] = ui_print_truncate_text($tag, 50, true); } else { $tag_without_temp[$id_tag] = ui_print_truncate_text($tag, 50, true); @@ -476,9 +579,31 @@ $data[0] = html_print_select( 'width: 200px;' ); -$data[1] = html_print_image('images/darrowright.png', true, ['id' => 'button-add_with', 'style' => 'cursor: pointer;', 'title' => __('Add')]); -$data[1] .= html_print_input_hidden('tag_with', $tag_with_base64, true); -$data[1] .= '

'.html_print_image('images/darrowleft.png', true, ['id' => 'button-remove_with', 'style' => 'cursor: pointer;', 'title' => __('Remove')]); +$data[1] = html_print_image( + 'images/darrowright.png', + true, + [ + 'id' => 'button-add_with', + 'style' => 'cursor: pointer;', + 'title' => __('Add'), + ] +); + +$data[1] .= html_print_input_hidden( + 'tag_with', + $tag_with_base64, + true +); + +$data[1] .= '

'.html_print_image( + 'images/darrowleft.png', + true, + [ + 'id' => 'button-remove_with', + 'style' => 'cursor: pointer;', + 'title' => __('Remove'), + ] +); $data[2] = html_print_select( $tag_with_temp, @@ -528,9 +653,29 @@ $data[0] = html_print_select( false, 'width: 200px;' ); -$data[1] = html_print_image('images/darrowright.png', true, ['id' => 'button-add_without', 'style' => 'cursor: pointer;', 'title' => __('Add')]); -$data[1] .= html_print_input_hidden('tag_without', $tag_without_base64, true); -$data[1] .= '

'.html_print_image('images/darrowleft.png', true, ['id' => 'button-remove_without', 'style' => 'cursor: pointer;', 'title' => __('Remove')]); +$data[1] = html_print_image( + 'images/darrowright.png', + true, + [ + 'id' => 'button-add_without', + 'style' => 'cursor: pointer;', + 'title' => __('Add'), + ] +); +$data[1] .= html_print_input_hidden( + 'tag_without', + $tag_without_base64, + true +); +$data[1] .= '

'.html_print_image( + 'images/darrowleft.png', + true, + [ + 'id' => 'button-remove_without', + 'style' => 'cursor: pointer;', + 'title' => __('Remove'), + ] +); $data[2] = html_print_select( $tag_without_temp, 'tag_without_temp', @@ -549,24 +694,32 @@ $tabletags_without->data[] = $data; $tabletags_without->rowclass[] = ''; -// END OF TAGS -// EVENTS FILTER -// Table for filter controls +// END OF TAGS. +// EVENTS FILTER. +// Table for filter controls. if (is_metaconsole()) { - $events_filter = '
'; + $events_filter = ''; } else { - $events_filter = ''; + $events_filter = ''; } -// Hidden field with the loaded filter name +// Hidden field with the loaded filter name. $events_filter .= html_print_input_hidden('id_name', $id_name, true); // Hidden open filter flag -// If autoupdate is in use collapse filter +// If autoupdate is in use collapse filter. if ($open_filter) { - $events_filter .= html_print_input_hidden('open_filter', 'true', true); + $events_filter .= html_print_input_hidden( + 'open_filter', + 'true', + true + ); } else { - $events_filter .= html_print_input_hidden('open_filter', 'false', true); + $events_filter .= html_print_input_hidden( + 'open_filter', + 'false', + true + ); } // ---------------------------------------------------------------------- @@ -606,11 +759,11 @@ $table_advanced->rowclass[] = ''; $data = []; $data[0] = __('User ack.').$jump; -if ($strict_user) { - $user_users = [$config['id_user'] => $config['id_user']]; -} else { - $user_users = users_get_user_users($config['id_user'], $access, users_can_manage_group_all()); -} +$user_users = users_get_user_users( + $config['id_user'], + $access, + users_can_manage_group_all() +); $data[0] .= html_print_select( $user_users, @@ -621,6 +774,7 @@ $data[0] .= html_print_select( 0, true ); + if (!$meta) { $data[1] = __('Module search').$jump; $data[1] .= html_print_autocomplete_modules( @@ -635,27 +789,15 @@ if (!$meta) { ); } else { $data[1] = __('Server').$jump; - if ($strict_user) { - $data[1] .= html_print_select( - '', - 'server_id', - $server_id, - 'script', - __('All'), - '0', - true - ); - } else { - $data[1] .= html_print_select_from_sql( - 'SELECT id, server_name FROM tmetaconsole_setup', - 'server_id', - $server_id, - 'script', - __('All'), - '0', - true - ); - } + $data[1] .= html_print_select_from_sql( + 'SELECT id, server_name FROM tmetaconsole_setup', + 'server_id', + $server_id, + 'script', + __('All'), + '0', + true + ); } $table_advanced->data[] = $data; @@ -668,14 +810,30 @@ $alert_events_titles = [ '0' => __('Filter alert events'), '1' => __('Only alert events'), ]; -$data[0] .= html_print_select($alert_events_titles, 'filter_only_alert', $filter_only_alert, '', '', '', true); +$data[0] .= html_print_select( + $alert_events_titles, + 'filter_only_alert', + $filter_only_alert, + '', + '', + '', + true +); $data[1] = __('Block size for pagination').$jump; $lpagination[25] = 25; $lpagination[50] = 50; $lpagination[100] = 100; $lpagination[200] = 200; $lpagination[500] = 500; -$data[1] .= html_print_select($lpagination, 'pagination', $pagination, '', __('Default'), $config['block_size'], true); +$data[1] .= html_print_select( + $lpagination, + 'pagination', + $pagination, + '', + __('Default'), + $config['block_size'], + true +); $table_advanced->data[] = $data; $table_advanced->rowclass[] = ''; @@ -701,11 +859,11 @@ $table_advanced->rowclass[] = ''; $data = []; if (defined('METACONSOLE')) { - $data[0] = '
'.''.__('Events with following tags').''.html_print_table($tabletags_with, true).'
'; - $data2[1] = '
'.''.__('Events without following tags').''.html_print_table($tabletags_without, true).'
'; + $data[0] = '
'.__('Events with following tags').''.html_print_table($tabletags_with, true).'
'; + $data2[1] = '
'.__('Events without following tags').''.html_print_table($tabletags_without, true).'
'; } else { - $data[0] = '
'.''.__('Events with following tags').''.html_print_table($tabletags_with, true).'
'; - $data[1] = '
'.''.__('Events without following tags').''.html_print_table($tabletags_without, true).'
'; + $data[0] = '
'.__('Events with following tags').''.html_print_table($tabletags_with, true).'
'; + $data[1] = '
'.__('Events without following tags').''.html_print_table($tabletags_without, true).'
'; } $table_advanced->data[] = $data; @@ -714,7 +872,7 @@ if (defined('METACONSOLE')) { } $table_advanced->rowclass[] = ''; -// - END ADVANCE FILTER ------------------------------------------------- +// END ADVANCE FILTER -------------------------------------------------. $table = new stdClass(); $table->id = 'events_filter_form'; $table->width = '100%'; @@ -748,13 +906,33 @@ $data[0] .= html_print_select( // ********************************************************************** $data[1] = __('Event type').$jump; $types = get_event_types(); -// Expand standard array to add not_normal (not exist in the array, used only for searches) + +// Expand standard array to add not_normal +// (not exist in the array, used only for searches). $types['not_normal'] = __('Not normal'); -$data[1] .= html_print_select($types, 'event_type', $event_type, '', __('All'), '', true); +$data[1] .= html_print_select( + $types, + 'event_type', + $event_type, + '', + __('All'), + '', + true +); $data[2] = __('Severity').$jump; $severities = get_priorities(); -$data[2] .= html_print_select($severities, 'severity', $severity, '', __('All'), '-1', true, false, false); +$data[2] .= html_print_select( + $severities, + 'severity', + $severity, + '', + __('All'), + '-1', + true, + false, + false +); $table->data[] = $data; $table->rowclass[] = ''; @@ -763,12 +941,27 @@ $data[0] = __('Event status').$jump; $fields = events_get_all_status(); $data[0] .= html_print_select($fields, 'status', $status, '', '', '', true); $data[1] = __('Max. hours old').$jump; -$data[1] .= html_print_input_text('event_view_hr', $event_view_hr, '', 5, 255, true); +$data[1] .= html_print_input_text( + 'event_view_hr', + $event_view_hr, + '', + 5, + 255, + true +); $data[2] = __('Repeated').$jump; $repeated_sel[0] = __('All events'); $repeated_sel[1] = __('Group events'); $repeated_sel[2] = __('Group agents'); -$data[2] .= html_print_select($repeated_sel, 'group_rep', $group_rep, '', '', 0, true); +$data[2] .= html_print_select( + $repeated_sel, + 'group_rep', + $group_rep, + '', + '', + 0, + true +); $table->data[] = $data; $table->rowclass[] = ''; @@ -778,7 +971,14 @@ $data[0] .= html_print_input_text('source', $source, '', 35, 255, true); $data[1] = __('Extra ID').$jump; $data[1] .= html_print_input_text('id_extra', $id_extra, '', 11, 255, true); $data[2] = __('Comment').$jump; -$data[2] .= html_print_input_text('user_comment', $user_comment, '', 35, 255, true); +$data[2] .= html_print_input_text( + 'user_comment', + $user_comment, + '', + 35, + 255, + true +); $table->data[] = $data; $table->rowclass[] = ''; @@ -800,7 +1000,7 @@ $data = []; $table->data[] = $data; $table->rowclass[] = ''; -// The buttons +// The buttons. $data = []; $data[0] = '
'; if ($event_w || $event_m) { @@ -826,13 +1026,19 @@ $events_filter .= html_print_table($table, true); unset($table); $botom_update = "
"; -$botom_update .= html_print_submit_button(__('Update'), 'update', false, 'class="sub upd" style="float:right;"', true); +$botom_update .= html_print_submit_button( + __('Update'), + 'update', + false, + 'class="sub upd" style="float:right;"', + true +); $botom_update .= '
'; $events_filter .= $botom_update; $events_filter .= ''; -// This is the filter div +// This is the filter div. $filter_resume['title'] = empty($id_name) ? __('No filter loaded') : __('Filter loaded').': '.$id_name; if (is_metaconsole()) { @@ -846,14 +1052,29 @@ if (is_metaconsole()) { } -// Error div for ajax messages +// Error div for ajax messages. echo "'; ?> @@ -877,7 +1098,7 @@ if ($group_rep == 0) { WHERE 1=1 ".$sql_post." $order_sql LIMIT ".$offset.','.$pagination; - // Extract the events by filter (or not) from db + // Extract the events by filter (or not) from db. $result = db_get_all_rows_sql($sql); } else if ($group_rep == 1) { $filter_resume['duplicate'] = $group_rep; @@ -905,7 +1126,7 @@ if ($group_rep == 0) { // Active filter tag view call (only enterprise version) // It is required to pass some references to enterprise function -// to translate the active filters +// to translate the active filters. enterprise_hook( 'print_event_tags_active_filters', [ @@ -922,8 +1143,9 @@ enterprise_hook( ); if (!empty($result)) { - // ~ Checking the event tags exactly. The event query filters approximated tags to keep events - // ~ with several tags + // Checking the event tags exactly. + // The event query filters approximated tags to keep events + // with several tags. $acltags = tags_get_user_groups_and_tags($config['id_user'], $access, true); foreach ($result as $key => $event_data) { @@ -936,7 +1158,7 @@ if (!empty($result)) { -// Delete rnum field generated by oracle_recode_query() function +// Delete rnum field generated by oracle_recode_query() function. if (($config['dbtype'] == 'oracle') && ($result !== false)) { for ($i = 0; $i < count($result); $i++) { unset($result[$i]['rnum']); @@ -980,7 +1202,7 @@ enterprise_hook('close_meta_frame'); unset($table); -// Values to be used from javascript library +// Values to be used from javascript library. html_print_input_hidden( 'ajax_file', ui_get_full_url('ajax.php', false, false, false) @@ -993,8 +1215,6 @@ ui_require_jquery_file('json'); ui_include_time_picker(); ?>