Merge branch 'ent-3566_No_refresca_eventos_cuando_pasan_X_cosas' into 'develop'

fixed reload page twice

See merge request artica/pandorafms!2288

Former-commit-id: b4055e5d62da01bbb031de68317ce4ee3308a97d
This commit is contained in:
Daniel Rodriguez 2019-03-25 13:49:43 +01:00
commit 93d8cfc2f5
3 changed files with 573 additions and 233 deletions

View File

@ -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 .= ' (<span id="refrcounter">'.date('i:s', $config['refr']).'</span>)';
if ((isset($select[0]['time_autorefresh']) === true)
&& $select[0]['time_autorefresh'] !== 0 && !$config['refr']
) {
$config['refr'] = $select[0]['time_autorefresh'];
$autorefresh_txt .= ' (<span id="refrcounter">';
$autorefresh_txt .= date(
'i:s',
$config['refr']
);
$autorefresh_txt .= '</span>)';
} else if ($_GET['refr']) {
$autorefresh_txt .= ' (<span id="refrcounter">';
$autorefresh_txt .= date('i:s', $config['refr']);
$autorefresh_txt .= '</span>)';
}
$ignored_params['refr'] = '';
$values = get_refresh_time_array();
$autorefresh_additional = '<span id="combo_refr" style="display: none;">';
$autorefresh_additional .= html_print_select($values, 'ref', '', '', __('Select'), '0', true, false, false);
$autorefresh_additional .= html_print_select(
$values,
'ref',
'',
'',
__('Select'),
'0',
true,
false,
false
);
$autorefresh_additional .= '</span>';
unset($values);
$autorefresh_link_open_img = '<a class="white autorefresh" href="'.ui_get_url_refresh($ignored_params).'">';
if ($_GET['refr']) {
if ($_GET['refr']
|| ((isset($select[0]['time_autorefresh']) === true)
&& $select[0]['time_autorefresh'] !== 0)
) {
$autorefresh_link_open_txt = '<a class="autorefresh autorefresh_txt" href="'.ui_get_url_refresh($ignored_params).'">';
} else {
$autorefresh_link_open_txt = '<a>';
@ -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 = '<div id="header_autorefresh">'.$autorefresh_link_open_img.$autorefresh_img.$autorefresh_link_close.'</div>';
$header_autorefresh_counter = '<div id="header_autorefresh_counter" style="'.$display_counter.'">'.$autorefresh_link_open_txt.$autorefresh_txt.$autorefresh_link_close.$autorefresh_additional.'</div>';
$header_autorefresh = '<div id="header_autorefresh">';
$header_autorefresh .= $autorefresh_link_open_img;
$header_autorefresh .= $autorefresh_img;
$header_autorefresh .= $autorefresh_link_close;
$header_autorefresh .= '</div>';
$header_autorefresh_counter = '<div id="header_autorefresh_counter" style="'.$display_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 .= '</div>';
// Qr.
@ -238,16 +299,40 @@ require_once 'include/functions_notifications.php';
<?php
// User.
if (is_user_admin($config['id_user']) == 1) {
$header_user = html_print_image('images/header_user_admin_green.png', true, ['title' => __('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 = '<div id="header_user"><a href="index.php?sec=workspace&sec2=operation/users/user_edit">'.$header_user.'<span> ('.$config['id_user'].')</span></a></div>';
// Logout.
$header_logout = '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
$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 .= '</a></div>';
echo '<div class="header_left">'.$header_autorefresh, $header_autorefresh_counter, $header_qr, $header_chat.'</div>
@ -490,7 +575,12 @@ require_once 'include/functions_notifications.php';
);
<?php
if (($autorefresh_list !== null) && (array_search($_GET['sec2'], $autorefresh_list) !== false) && (!isset($_GET['refr']))) {
if (($autorefresh_list !== null)
&& (array_search(
$_GET['sec2'],
$autorefresh_list
) !== false) && (!isset($_GET['refr']))
) {
$do_refresh = true;
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
@ -503,23 +593,6 @@ require_once 'include/functions_notifications.php';
if ($_GET['sec2'] == 'enterprise/dashboard/main_dashboard' && $new_dashboard) {
$do_refresh = false;
}
if ($do_refresh) {
?>
$("a.autorefresh_txt").toggle ();
$("#combo_refr").toggle ();
href = $("a.autorefresh").attr ("href");
<?php
if ($select[0]['time_autorefresh']) {
?>
var refresh = '<?php echo $select[0]['time_autorefresh']; ?>';
$(document).attr ("location", href + refresh);
<?php
}
?>
<?php
}
}
?>
@ -547,14 +620,14 @@ require_once 'include/functions_notifications.php';
blinkpubli();
<?php
if ($_GET['refr']) {
if ($_GET['refr'] || $do_refresh === true) {
?>
$("#header_autorefresh").css('padding-right', '5px');
var refr_time = <?php echo (int) get_parameter('refr', 0); ?>;
var t = new Date();
t.setTime (t.getTime () +
parseInt(<?php echo ($config['refr'] * 1000); ?>));
$("#refrcounter").countdown ({until: t,
t.setTime (t.getTime () + parseInt(<?php echo ($config['refr'] * 1000); ?>));
$("#refrcounter").countdown ({
until: t,
layout: '%M%nn%M:%S%nn%S',
labels: ['', '', '', '', '', '', ''],
onExpiry: function () {

View File

@ -1,33 +1,52 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Events
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
// Load global vars.
global $config;
require_once $config['homedir'].'/include/functions_events.php';
// Event processing functions
// Event processing functions.
require_once $config['homedir'].'/include/functions_alerts.php';
// Alerts processing functions
// Alerts processing functions.
require_once $config['homedir'].'/include/functions_agents.php';
// Agents functions
// Agents functions.
require_once $config['homedir'].'/include/functions_users.php';
// Users functions
// Users functions.
require_once $config['homedir'].'/include/functions_graph.php';
require_once $config['homedir'].'/include/functions_ui.php';
check_login();
if (! check_acl($config['id_user'], 0, 'ER') && ! check_acl($config['id_user'], 0, 'EW') && ! check_acl($config['id_user'], 0, 'EM')) {
if (! check_acl($config['id_user'], 0, 'ER')
&& ! check_acl($config['id_user'], 0, 'EW')
&& ! check_acl($config['id_user'], 0, 'EM')
) {
db_pandora_audit(
'ACL Violation',
'Trying to access event viewer'
@ -36,13 +55,13 @@ if (! check_acl($config['id_user'], 0, 'ER') && ! check_acl($config['id_user'],
return;
}
// Set metaconsole mode
// Set metaconsole mode.
$meta = false;
if (enterprise_installed() && defined('METACONSOLE')) {
$meta = true;
}
// Get the history mode
// Get the history mode.
$history = (bool) get_parameter('history', 0);
$readonly = false;
@ -81,7 +100,7 @@ if (is_ajax()) {
if ($event['event_type'] == 'system') {
echo __('System');
} else if ($event['id_agente'] > 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&amp;sec2=operation/events/events&amp;'.$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'] = '<a href="'.$url.'&amp;pure=1">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen')]).'</a>';
// Event list
// Event list.
$list['active'] = false;
$list['text'] = '<a href="index.php?sec=eventos&sec2=operation/events/events&amp;pure='.$config['pure'].'">'.html_print_image('images/events_list.png', true, ['title' => __('Event list')]).'</a>';
// History event list
// History event list.
$history_list['active'] = false;
$history_list['text'] = '<a href="index.php?sec=eventos&sec2=operation/events/events&amp;pure='.$config['pure'].'&amp;section=history&amp;history=1">'.html_print_image('images/books.png', true, ['title' => __('History event list')]).'</a>';
// RSS
// RSS.
$rss['active'] = false;
$rss['text'] = '<a href="operation/events/events_rss.php?user='.$config['id_user'].'&hashup='.$hashup.'&'.$params.'">'.html_print_image('images/rss.png', true, ['title' => __('RSS Events')]).'</a>';
// Marquee
// Marquee.
$marquee['active'] = false;
$marquee['text'] = '<a href="operation/events/events_marquee.php">'.html_print_image('images/heart.png', true, ['title' => __('Marquee display')]).'</a>';
// CSV
// CSV.
$csv['active'] = false;
$csv['text'] = '<a href="operation/events/export_csv.php?'.$params.'">'.html_print_image('images/csv_mc.png', true, ['title' => __('Export to CSV file')]).'</a>';
// Sound events
// Sound events.
$sound_event['active'] = false;
$sound_event['text'] = '<a href="javascript: openSoundEventWindow();">'.html_print_image('images/sound.png', true, ['title' => __('Sound events')]).'</a>';
// 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'] = '<a href="index.php?sec=eventos&sec2=godmode/events/events&amp;section=filter&amp;pure='.$config['pure'].'">'.html_print_image('images/setup.png', true, ['title' => __('Manage events')]).'</a>';
@ -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) {
<script type="text/javascript">
function openSoundEventWindow() {
url = "<?php echo ui_get_full_url('operation/events/sound_events.php'); ?>";
window.open(url, '<?php __('Sound Alerts'); ?>','width=600, height=450, toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no');
window.open(
url,
'<?php __('Sound Alerts'); ?>',
'width=600, height=450, toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no'
);
}
</script>
<?php
} else {
// Fullscreen
// Floating menu - Start
// Fullscreen.
// Floating menu - Start.
echo '<div id="vc-controls" style="z-index: 999">';
echo '<div id="menu_tab">';
echo '<ul class="mn">';
// Quit fullscreen
// Quit fullscreen.
echo '<li class="nomn">';
echo '<a target="_top" href="'.$url.'&amp;pure=0">';
echo html_print_image('images/normal_screen.png', true, ['title' => __('Back to normal mode')]);
echo html_print_image(
'images/normal_screen.png',
true,
['title' => __('Back to normal mode')]
);
echo '</a>';
echo '</li>';
// Countdown
// Countdown.
echo '<li class="nomn">';
echo '<div class="vc-refr">';
echo '<div class="vc-countdown"></div>';
echo '<div id="vc-refr-form">';
echo __('Refresh').':';
echo html_print_select(get_refresh_time_array(), 'refresh', $refr, '', '', 0, true, false, false);
echo html_print_select(
get_refresh_time_array(),
'refresh',
$refr,
'',
'',
0,
true,
false,
false
);
echo '</div>';
echo '</div>';
echo '</li>';
// Console name
// Console name.
echo '<li class="nomn">';
echo '<div class="vc-title">'.__('Event viewer').'</div>';
echo '</li>';
@ -521,11 +567,11 @@ if ($config['pure'] == 0 || $meta) {
echo '</div>';
echo '</div>';
// Floating menu - End
// Floating menu - End.
ui_require_jquery_file('countdown');
}
// Error div for ajax messages
// Error div for ajax messages.
echo "<div id='show_message_error'>";
echo '</div>';
@ -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 = <?php echo (int) $refr; ?>;
var pure = <?php echo (int) $config['pure']; ?>;
var href = "<?php echo ui_get_url_refresh($ignored_params); ?>";
// 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" : <?php echo $group_rep ? 1 : 0; ?>,
"similars" : <?php echo ($group_rep) ? 1 : 0; ?>,
"meta" : meta,
"history" : history_var
},

View File

@ -1,28 +1,44 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Events
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
// Load global vars.
global $config;
require_once $config['homedir'].'/include/functions.php';
require_once $config['homedir'].'/include/functions_events.php';
// Event processing functions
// Event processing functions.
require_once $config['homedir'].'/include/functions_alerts.php';
// Alerts processing functions
// Alerts processing functions.
require_once $config['homedir'].'/include/functions_agents.php';
// Agents funtions
// Agents funtions.
require_once $config['homedir'].'/include/functions_users.php';
// Users functions
// Users functions.
require_once $config['homedir'].'/include/functions_groups.php';
require_once $config['homedir'].'/include/functions_graph.php';
require_once $config['homedir'].'/include/functions_tags.php';
@ -47,7 +63,12 @@ if (!$event_a && !$event_w && !$event_m) {
return;
}
$is_filter = db_get_value('id_filter', 'tusuario', 'id_user', $config['id_user']);
$is_filter = db_get_value(
'id_filter',
'tusuario',
'id_user',
$config['id_user']
);
$jump = '&nbsp;&nbsp;';
@ -57,7 +78,7 @@ if (is_ajax()) {
$update_event_filter = get_parameter('update_event_filter', 0);
$get_event_filters = get_parameter('get_event_filters', 0);
// Get db values of a single filter
// Get db values of a single filter.
if ($get_filter_values) {
$id_filter = get_parameter('id');
@ -65,13 +86,17 @@ if (is_ajax()) {
$event_filter['search'] = io_safe_output($event_filter['search']);
$event_filter['id_name'] = io_safe_output($event_filter['id_name']);
$event_filter['tag_with'] = base64_encode(io_safe_output($event_filter['tag_with']));
$event_filter['tag_without'] = base64_encode(io_safe_output($event_filter['tag_without']));
$event_filter['tag_with'] = base64_encode(
io_safe_output($event_filter['tag_with'])
);
$event_filter['tag_without'] = base64_encode(
io_safe_output($event_filter['tag_without'])
);
echo io_json_mb_encode($event_filter);
}
// Saves an event filter
// Saves an event filter.
if ($save_event_filter) {
$values = [];
$values['id_name'] = get_parameter('id_name');
@ -88,7 +113,10 @@ if (is_ajax()) {
$values['id_user_ack'] = get_parameter('id_user_ack');
$values['group_rep'] = get_parameter('group_rep');
$values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([]));
$values['tag_without'] = get_parameter('tag_without', io_json_mb_encode([]));
$values['tag_without'] = get_parameter(
'tag_without',
io_json_mb_encode([])
);
$values['filter_only_alert'] = get_parameter('filter_only_alert');
$values['id_group_filter'] = get_parameter('id_group_filter');
$values['date_from'] = get_parameter('date_from');
@ -132,7 +160,10 @@ if (is_ajax()) {
$values['id_user_ack'] = get_parameter('id_user_ack');
$values['group_rep'] = get_parameter('group_rep');
$values['tag_with'] = get_parameter('tag_with', io_json_mb_encode([]));
$values['tag_without'] = get_parameter('tag_without', io_json_mb_encode([]));
$values['tag_without'] = get_parameter(
'tag_without',
io_json_mb_encode([])
);
$values['filter_only_alert'] = get_parameter('filter_only_alert');
$values['id_group_filter'] = get_parameter('id_group_filter');
$values['date_from'] = get_parameter('date_from');
@ -171,9 +202,7 @@ if (is_ajax()) {
return;
}
$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
// Get the tags where the user have permissions in Events reading tasks
// Get the tags where the user have permissions in Events reading tasks.
$tags = tags_get_user_tags($config['id_user'], $access);
@ -183,18 +212,27 @@ if ($id_agent == 0 && !empty($text_agent)) {
$id_name = get_parameter('id_name', '');
/*
-------------------------------------------------------------------------- */
// --------------------------------------------------------------------------
// ------------------------ DEFAULT USER FILTER -----------------------------
$user = $config['id_user'];
$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);
$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 '<div id="save_filter_layer" style="display: none">';
$table = new StdClass;
$table->id = 'save_filter_form';
@ -333,8 +384,22 @@ if (check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, '
$data = [];
$table->rowid[0] = 'update_save_selector';
$data[0] = html_print_radio_button('filter_mode', 'new', '', true, true).__('New filter').'';
$data[1] = html_print_radio_button('filter_mode', 'update', '', false, true).__('Update filter').'';
$data[0] = html_print_radio_button(
'filter_mode',
'new',
'',
true,
true
).__('New filter').'';
$data[1] = html_print_radio_button(
'filter_mode',
'update',
'',
false,
true
).__('Update filter').'';
$table->data[] = $data;
$table->rowclass[] = '';
@ -373,11 +438,25 @@ if (check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, '
$data = [];
$table->rowid[3] = 'update_filter_row1';
$data[0] = __('Overwrite filter').$jump;
// Fix : Only admin user can see filters of group ALL for update
// Fix : Only admin user can see filters of group ALL for update.
$_filters_update = events_get_event_filter_select(false);
$data[0] .= html_print_select($_filters_update, 'overwrite_filter', '', '', '', 0, true);
$data[1] = html_print_submit_button(__('Update filter'), 'update_filter', false, 'class="sub upd"', true);
$data[0] .= html_print_select(
$_filters_update,
'overwrite_filter',
'',
'',
'',
0,
true
);
$data[1] = html_print_submit_button(
__('Update filter'),
'update_filter',
false,
'class="sub upd"',
true
);
$table->data[] = $data;
$table->rowclass[] = '';
@ -385,12 +464,18 @@ if (check_acl($config['id_user'], 0, 'EW') || check_acl($config['id_user'], 0, '
html_print_table($table);
unset($table);
echo '<div>';
echo html_print_submit_button(__('Save filter'), 'save_filter', false, 'class="sub upd" style="float:right;"', true);
echo html_print_submit_button(
__('Save filter'),
'save_filter',
false,
'class="sub upd" style="float:right;"',
true
);
echo '</div>';
echo '</div>';
}
// Load filter div for dialog
// Load filter div for dialog.
echo '<div id="load_filter_layer" style="display: none">';
$table = new StdClass;
$table->id = 'load_filter_form';
@ -412,8 +497,22 @@ if (!is_metaconsole()) {
$data = [];
$table->rowid[3] = 'update_filter_row1';
$data[0] = __('Load filter').$jump;
$data[0] .= html_print_select($filters, 'filter_id', '', '', __('None'), 0, true);
$data[1] = html_print_submit_button(__('Load filter'), 'load_filter', false, 'class="sub upd"', true);
$data[0] .= html_print_select(
$filters,
'filter_id',
'',
'',
__('None'),
0,
true
);
$data[1] = html_print_submit_button(
__('Load filter'),
'load_filter',
false,
'class="sub upd"',
true
);
$table->data[] = $data;
$table->rowclass[] = '';
@ -421,19 +520,23 @@ html_print_table($table);
unset($table);
echo '</div>';
// 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] .= '<br><br>'.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] .= '<br><br>'.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] .= '<br><br>'.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] .= '<br><br>'.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 = '<form id="form_filter" class="filters_form" method="post" action="index.php?sec=eventos&amp;sec2=operation/events/events&amp;refr='.(int) get_parameter('refr', 0).'&amp;pure='.$config['pure'].'&amp;section='.$section.'&amp;history='.(int) $history.'">';
$events_filter = '<form id="form_filter" class="filters_form" method="post" action="index.php?sec=eventos&amp;sec2=operation/events/events&amp;refresh='.(int) get_parameter('refresh', 0).'&amp;pure='.$config['pure'].'&amp;section='.$section.'&amp;history='.(int) $history.'">';
} else {
$events_filter = '<form id="form_filter" method="post" action="index.php?sec=eventos&amp;sec2=operation/events/events&amp;refr='.(int) get_parameter('refr', 0).'&amp;pure='.$config['pure'].'&amp;section='.$section.'&amp;history='.(int) $history.'">';
$events_filter = '<form id="form_filter" method="post" action="index.php?sec=eventos&amp;sec2=operation/events/events&amp;refresh='.(int) get_parameter('refresh', 0).'&amp;pure='.$config['pure'].'&amp;section='.$section.'&amp;history='.(int) $history.'">';
}
// 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] = '<fieldset class="" style="padding:0px; width: 510px;">'.'<legend style="padding:0px;">'.__('Events with following tags').'</legend>'.html_print_table($tabletags_with, true).'</fieldset>';
$data2[1] = '<fieldset class="" style="padding:0px; width: 310px;">'.'<legend style="padding:0px;">'.__('Events without following tags').'</legend>'.html_print_table($tabletags_without, true).'</fieldset>';
$data[0] = '<fieldset class="" style="padding:0px; width: 510px;"><legend style="padding:0px;">'.__('Events with following tags').'</legend>'.html_print_table($tabletags_with, true).'</fieldset>';
$data2[1] = '<fieldset class="" style="padding:0px; width: 310px;"><legend style="padding:0px;">'.__('Events without following tags').'</legend>'.html_print_table($tabletags_without, true).'</fieldset>';
} else {
$data[0] = '<fieldset class="databox" style="padding:0px; width: 30%; ">'.'<legend>'.__('Events with following tags').'</legend>'.html_print_table($tabletags_with, true).'</fieldset>';
$data[1] = '<fieldset class="databox" style="padding:0px; width: 30%;">'.'<legend>'.__('Events without following tags').'</legend>'.html_print_table($tabletags_without, true).'</fieldset>';
$data[0] = '<fieldset class="databox" style="padding:0px; width: 30%; "><legend>'.__('Events with following tags').'</legend>'.html_print_table($tabletags_with, true).'</fieldset>';
$data[1] = '<fieldset class="databox" style="padding:0px; width: 30%;"><legend>'.__('Events without following tags').'</legend>'.html_print_table($tabletags_without, true).'</fieldset>';
}
$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] = '<div style="width:100%; text-align:left">';
if ($event_w || $event_m) {
@ -826,13 +1026,19 @@ $events_filter .= html_print_table($table, true);
unset($table);
$botom_update = "<div style='width:100%;float:right;'>";
$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 .= '</div>';
$events_filter .= $botom_update;
$events_filter .= '</form>';
// 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 "<div id='show_filter_error' style='display: none;'>";
ui_print_error_message(__('Error creating filter.'), 'data-type_info_box="error_create_filter"');
ui_print_error_message(__('Error creating filter is duplicated.'), 'data-type_info_box="duplicate_create_filter"');
ui_print_success_message(__('Filter created.'), 'data-type_info_box="success_create_filter"');
ui_print_error_message(
__('Error creating filter.'),
'data-type_info_box="error_create_filter"'
);
ui_print_error_message(
__('Error creating filter is duplicated.'),
'data-type_info_box="duplicate_create_filter"'
);
ui_print_success_message(
__('Filter created.'),
'data-type_info_box="success_create_filter"'
);
ui_print_success_message(__('Filter updated.'), 'data-type_info_box="success_update_filter"');
ui_print_error_message(__('Error updating filter.'), 'data-type_info_box="error_create_filter"');
ui_print_success_message(
__('Filter updated.'),
'data-type_info_box="success_update_filter"'
);
ui_print_error_message(
__('Error updating filter.'),
'data-type_info_box="error_create_filter"'
);
echo '</div>';
?>
@ -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();
?>
<script language="javascript" type="text/javascript">
/*<![CDATA[ */
var select_with_tag_empty = <?php echo (int) $remove_with_tag_disabled; ?>;
var select_without_tag_empty = <?php echo (int) $remove_without_tag_disabled; ?>;
var origin_select_with_tag_empty = <?php echo (int) $add_with_tag_disabled; ?>;
@ -1031,14 +1251,15 @@ $(document).ready( function() {
$(id_hidden2).val(Base64.encode(jQuery.toJSON(value_store2)));
$("#text-date_from, #text-date_to").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$("#text-date_from, #text-date_to").datepicker(
{dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
// Don't collapse filter if update button has been pushed
if ($("#hidden-open_filter").val() == 'true') {
$("#event_control").toggle();
}
// If selected is not 'none' show filter name
// If selected is not 'none' show filter name.
if ( $("#filter_id").val() != 0 ) {
$("#row_name").css('visibility', '');
$("#submit-update_filter").css('visibility', '');