refactor events meta pandora_enterprise#9086

This commit is contained in:
Daniel Barbero Martin 2022-06-01 17:27:44 +02:00
parent d278fb3acb
commit 0cda3d3613
9 changed files with 202 additions and 259 deletions

View File

@ -132,7 +132,7 @@ if ($get_comments === true) {
// Consider if the event is grouped.
if (isset($event['event_rep']) === true && $event['event_rep'] > 0) {
// Evaluate if we are in metaconsole or not.
$eventTable = (is_metaconsole() === true) ? 'tmetaconsole_event' : 'tevento';
$eventTable = 'tevento';
// Default grouped message filtering (evento and estado).
$whereGrouped = sprintf(
'`evento` = "%s" AND `estado` = "%s"',

View File

@ -2741,7 +2741,7 @@ class ConsoleSupervisor
$this->cleanNotifications('NOTIF.SYNCQUEUE.LENGTH.%');
}
$items_min = $config['sync_queue_items_max'];
$items_min = (isset($config['sync_queue_items_max']) === true) ? $config['sync_queue_items_max'] : 0;
if (is_numeric($items_min) !== true && $items_min <= 0) {
$items_min = self::MIN_SYNC_QUEUE_LENGTH;
}

View File

@ -4260,7 +4260,9 @@ function get_product_name()
$stored_name = enterprise_hook('enterprise_get_product_name');
if (empty($stored_name) || $stored_name == ENTERPRISE_NOT_HOOK) {
if ($config['rb_product_name_alt']) {
if (isset($config['rb_product_name_alt']) === true
&& empty($config['rb_product_name_alt']) === false
) {
return $config['rb_product_name_alt'];
}

View File

@ -29,6 +29,13 @@
// Begin.
global $config;
require_once $config['homedir'].'/vendor/autoload.php';
use Amp\Promise;
use PandoraFMS\Enterprise\Metaconsole\Node;
use function Amp\ParallelFunctions\parallelMap;
require_once $config['homedir'].'/include/functions_ui.php';
require_once $config['homedir'].'/include/functions_tags.php';
require_once $config['homedir'].'/include/functions.php';
@ -338,10 +345,10 @@ function events_get_column_names($fields, $table_alias=false)
if (is_array($f)) {
$name = [];
$name['text'] = events_get_column_name($f['text'], $table_alias);
$name['class'] = $f['class'];
$name['style'] = $f['style'];
$name['extra'] = $f['extra'];
$name['id'] = $f['id'];
$name['class'] = ($f['class'] ?? '');
$name['style'] = ($f['style'] ?? '');
$name['extra'] = ($f['extra'] ?? '');
$name['id'] = ($f['id'] ?? '');
$names[] = $name;
} else {
$names[] = events_get_column_name($f, $table_alias);
@ -373,10 +380,7 @@ function events_delete($id_evento, $filter=null, $history=false, $force_node=fal
$filter = ['group_rep' => 0];
}
$table = events_get_events_table(
($force_node === false) ? is_metaconsole() : false,
$history
);
$table = 'tevento';
switch ($filter['group_rep']) {
case '0':
@ -473,7 +477,7 @@ function events_get_related_events(
$filter = ['group_rep' => 0];
}
$table = events_get_events_table(is_metaconsole(), $history);
$table = 'tevento';
$select = '*';
if ($count === true) {
$select = 'count(*) as n';
@ -565,7 +569,7 @@ function events_update_status($id_evento, $status, $filter=null, $history=false)
$filter = ['group_rep' => 0];
}
$table = events_get_events_table(is_metaconsole(), $history);
$table = 'tevento';
switch ($filter['group_rep']) {
case '0':
@ -748,7 +752,7 @@ function events_get_all(
$user_is_admin = users_is_admin();
if (!is_array($filter)) {
if (is_array($filter) === false) {
error_log('[events_get_all] Filter must be an array.');
throw new Exception('[events_get_all] Filter must be an array.');
}
@ -759,24 +763,26 @@ function events_get_all(
) {
$fields = ['te.*'];
$count = true;
} else if (!is_array($fields)) {
} else if (is_array($fields) === false) {
error_log('[events_get_all] Fields must be an array or "count".');
throw new Exception('[events_get_all] Fields must be an array or "count".');
throw new Exception(
'[events_get_all] Fields must be an array or "count".'
);
}
if (isset($filter['date_from'])
&& !empty($filter['date_from'])
&& $filter['date_from'] != '0000-00-00'
if (isset($filter['date_from']) === true
&& empty($filter['date_from']) === false
&& $filter['date_from'] !== '0000-00-00'
) {
$date_from = $filter['date_from'];
}
if (isset($filter['time_from'])) {
if (isset($filter['time_from']) === true) {
$time_from = (empty($filter['time_from']) === true) ? '00:00:00' : $filter['time_from'];
}
if (isset($date_from)) {
if (!isset($time_from)) {
if (isset($date_from) === true) {
if (isset($time_from) === false) {
$time_from = '00:00:00';
}
@ -981,7 +987,7 @@ function events_get_all(
$sql_filters[] = ' AND te.id_grupo != 0 ';
}
if (isset($filter['status'])) {
if (isset($filter['status']) === true) {
switch ($filter['status']) {
case EVENT_ALL:
default:
@ -1017,13 +1023,11 @@ function events_get_all(
}
}
if (!$user_is_admin) {
if (!$user_is_admin && users_can_manage_group_all('ER') === false) {
$ER_groups = users_get_groups($config['id_user'], 'ER', true);
$EM_groups = users_get_groups($config['id_user'], 'EM', true, true);
$EW_groups = users_get_groups($config['id_user'], 'EW', true, true);
}
if (!$user_is_admin && users_can_manage_group_all('ER') === false) {
// Get groups where user have ER grants.
$sql_filters[] = sprintf(
' AND (te.id_grupo IN ( %s ) OR tasg.id_group IN (%s))',
@ -1032,25 +1036,13 @@ function events_get_all(
);
}
$table = events_get_events_table(
(is_metaconsole() && $nodeConnected === false),
$history
);
$tevento = sprintf(
' %s te',
$table
);
// Prepare agent join sql filters.
$table = 'tevento';
$tevento = 'tevento te';
$agent_join_filters = [];
$tagente_table = 'tagente';
$tagente_field = 'id_agente';
$conditionMetaconsole = '';
if ((is_metaconsole() === true) && ($nodeConnected === false)) {
$tagente_table = 'tmetaconsole_agent';
$tagente_field = 'id_tagente';
$conditionMetaconsole = ' AND ta.id_tmetaconsole_setup = te.server_id ';
}
// Agent alias.
if (empty($filter['agent_alias']) === false) {
@ -1093,16 +1085,6 @@ function events_get_all(
);
}
if ((is_metaconsole() === true) && ($nodeConnected === false)) {
// Id source event.
if (empty($filter['id_source_event']) === false) {
$sql_filters[] = sprintf(
' AND lower(te.id_source_event) like lower("%%%s%%") ',
$filter['id_source_event']
);
}
}
// User comment.
if (empty($filter['user_comment']) === false) {
// For filter field.
@ -1280,7 +1262,7 @@ function events_get_all(
// Id_user.
$config['id_user'],
// Id_group.
$ER_groups,
($ER_groups ?? ''),
// Access.
'ER',
// Return_mode.
@ -1363,9 +1345,7 @@ function events_get_all(
// Module search.
$agentmodule_join = 'LEFT JOIN tagente_modulo am ON te.id_agentmodule = am.id_agente_modulo';
if (is_metaconsole() && $nodeConnected === false) {
$agentmodule_join = '';
} else if (!empty($filter['module_search'])) {
if (empty($filter['module_search']) === false) {
$agentmodule_join = 'INNER JOIN tagente_modulo am ON te.id_agentmodule = am.id_agente_modulo';
$sql_filters[] = sprintf(
' AND am.nombre = "%s" ',
@ -1375,8 +1355,8 @@ function events_get_all(
// Order.
$order_by = '';
if (isset($order, $sort_field)) {
if (isset($filter['group_rep']) && $filter['group_rep'] == 1) {
if (isset($order, $sort_field) === true) {
if (isset($filter['group_rep']) === true && $filter['group_rep'] == 1) {
$order_by = events_get_sql_order('MAX('.$sort_field.')', $order);
} else {
$order_by = events_get_sql_order($sort_field, $order);
@ -1385,15 +1365,11 @@ function events_get_all(
// Pagination.
$pagination = '';
if (isset($limit, $offset) && $limit > 0) {
if (isset($limit, $offset) === true && $limit > 0) {
$pagination = sprintf(' LIMIT %d OFFSET %d', $limit, $offset);
}
$extra = '';
if (is_metaconsole() && $nodeConnected === false) {
$extra = ', server_id';
}
// Group by.
$group_by = 'GROUP BY ';
$tagente_join = 'LEFT';
@ -1454,17 +1430,6 @@ function events_get_all(
}
$server_join = '';
if (is_metaconsole() && $nodeConnected === false) {
$server_join = ' LEFT JOIN tmetaconsole_setup ts
ON ts.id = te.server_id';
if (!empty($filter['server_id'])) {
$server_join = sprintf(
' INNER JOIN tmetaconsole_setup ts
ON ts.id = te.server_id AND ts.id= %d',
$filter['server_id']
);
}
}
// Secondary groups.
$event_lj = '';
@ -1534,6 +1499,55 @@ function events_get_all(
$having
);
if ($count !== true) {
if (is_metaconsole() === true) {
$result_meta = [];
$metaconsole_connections = metaconsole_get_names();
if (isset($metaconsole_connections) === true
&& is_array($metaconsole_connections) === true
) {
try {
$metaconsole_connections = array_flip($metaconsole_connections);
$metaconsole_connections['meta'] = 0;
$result_meta = Promise\wait(
parallelMap(
$metaconsole_connections,
function ($node) use ($sql) {
if ($node !== 0) {
$node = new Node((int) $node);
$node->connect();
}
$res = db_get_all_rows_sql($sql);
if ($res === false) {
$res = [];
}
if ($node !== 0) {
$node->disconnect();
}
return $res;
}
)
);
} catch (\Exception $e) {
$e->getReasons();
}
}
$data = [];
if (empty($result_meta) === false) {
foreach ($result_meta as $key => $value) {
$data = array_merge($data, $value);
}
}
return $data;
}
}
if (!$user_is_admin) {
// XXX: Confirm there's no extra grants unhandled!.
$can_manage = '0 as user_can_manage';
@ -1660,7 +1674,7 @@ function events_get_event($id, $fields=false, $meta=false, $history=false)
}
}
$table = events_get_events_table($meta, $history);
$table = 'tevento';
$event = db_get_row($table, 'id_evento', $id, $fields);
if ((bool) check_acl($config['id_user'], $event['id_grupo'], 'ER') === false) {
@ -1689,7 +1703,7 @@ function events_get_events_no_grouped(
) {
global $config;
$table = events_get_events_table($meta, $history);
$table = 'tevento';
$sql = 'SELECT * FROM '.$table.' te ';
$sql .= events_get_secondary_groups_left_join($table);
@ -1733,7 +1747,7 @@ function events_get_events_grouped(
) {
global $config;
$table = events_get_events_table($meta, $history);
$table = 'tevento';
if ($meta) {
$groupby_extra = ', server_id';
@ -1844,7 +1858,7 @@ function events_get_total_events_grouped($sql_post, $meta=false, $history=false)
*/
function events_get_similar_ids($id, $meta=false, $history=false)
{
$events_table = events_get_events_table($meta, $history);
$events_table = 'tevento';
$ids = [];
if ($meta) {
@ -1902,7 +1916,7 @@ function events_delete_event(
) {
global $config;
$table_event = events_get_events_table($meta, $history);
$table_event = 'tevento';
// Cleans up the selection for all unwanted values also casts any single values as an array.
$id_event = (array) safe_int($id_event, 1);
@ -1979,7 +1993,7 @@ function events_change_status(
) {
global $config;
$event_table = events_get_events_table($meta, $history);
$event_table = 'tevento';
// Cleans up the selection for all unwanted values also casts any single values as an array.
$id_event = (array) safe_int($id_event, 1);
@ -2128,7 +2142,7 @@ function events_change_owner(
) {
global $config;
$event_table = events_get_events_table($meta, $history);
$event_table = 'tevento';
// Cleans up the selection for all unwanted values also casts any single
// values as an array.
@ -2197,30 +2211,6 @@ function events_change_owner(
}
/**
* Returns proper event table based on environment.
*
* @param boolean $meta Metaconsole environment or not.
* @param boolean $history Historical data or not.
*
* @return string Table name.
*/
function events_get_events_table($meta, $history)
{
if ($meta) {
if ($history) {
$event_table = 'tmetaconsole_event_history';
} else {
$event_table = 'tmetaconsole_event';
}
} else {
$event_table = 'tevento';
}
return $event_table;
}
/**
* Comment events in a transresponse
*
@ -2246,7 +2236,7 @@ function events_comment(
) {
global $config;
$event_table = events_get_events_table($meta, $history);
$event_table = 'tevento';
// Cleans up the selection for all unwanted values also casts any single
// values as an array.
@ -2446,77 +2436,37 @@ function events_create_event(
$server_id=0,
$id_extra=''
) {
global $config;
if ($source === false) {
$source = get_product_name();
}
$table_events = 'tevento';
if (is_metaconsole()) {
$table_events = 'tmetaconsole_event';
$values = [
'id_agente' => $id_agent,
'id_usuario' => $id_user,
'id_grupo' => $id_group,
'estado' => $status,
'timestamp' => 'NOW()',
'evento' => $event,
'utimestamp' => 'UNIX_TIMESTAMP(NOW())',
'event_type' => $event_type,
'id_agentmodule' => $id_agent_module,
'id_alert_am' => $id_aam,
'criticity' => $priority,
'user_comment' => '',
'tags' => $tags,
'source' => $source,
'id_extra' => $id_extra,
'critical_instructions' => $critical_instructions,
'warning_instructions' => $warning_instructions,
'unknown_instructions' => $unknown_instructions,
'owner_user' => '',
'ack_utimestamp' => 0,
'custom_data' => $custom_data,
'data' => '',
'module_status' => 0,
];
$sql = sprintf(
'INSERT INTO '.$table_events.' (id_agente, id_grupo, evento,
timestamp, estado, utimestamp, id_usuario,
event_type, criticity, id_agentmodule, id_alert_am,
critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data,
server_id, id_extra, data, module_status)
VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()),
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s",
"%s", "%s", %d, "%s", %d, %d)',
$id_agent,
$id_group,
$event,
$status,
$id_user,
$event_type,
$priority,
$id_agent_module,
$id_aam,
$critical_instructions,
$warning_instructions,
$unknown_instructions,
$source,
$tags,
$custom_data,
$server_id,
$id_extra,
$data,
$module_status
);
} else {
$sql = sprintf(
'INSERT INTO '.$table_events.' (id_agente, id_grupo, evento,
timestamp, estado, utimestamp, id_usuario,
event_type, criticity, id_agentmodule, id_alert_am,
critical_instructions, warning_instructions,
unknown_instructions, source, tags, custom_data, id_extra, data, module_status)
VALUES (%d, %d, "%s", NOW(), %d, UNIX_TIMESTAMP(NOW()),
"%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s", "%s", "%s", %d, %d)',
$id_agent,
$id_group,
$event,
$status,
$id_user,
$event_type,
$priority,
$id_agent_module,
$id_aam,
$critical_instructions,
$warning_instructions,
$unknown_instructions,
$source,
$tags,
$custom_data,
$id_extra,
$data,
$module_status
);
}
return (int) db_process_sql($sql, 'insert_id');
return (int) db_process_sql_insert('tevento', $values);
}
@ -3902,7 +3852,7 @@ function events_get_response_target(
// If server_id > 0, it's a metaconsole query.
$meta = $server_id > 0 || is_metaconsole();
$event_table = events_get_events_table($meta, $history);
$event_table = 'tevento';
$event = db_get_row($event_table, 'id_evento', $event_id);
$event_response = db_get_row('tevent_response', 'id', $response_id);
@ -6264,7 +6214,7 @@ function events_get_events_grouped_by_agent(
) {
global $config;
$table = events_get_events_table($meta, $history);
$table = 'tevento';
if ($meta) {
$fields_extra = ', agent_name, server_id';
@ -6611,7 +6561,7 @@ function events_list_events_grouped_agents($sql)
{
global $config;
$table = events_get_events_table(is_metaconsole(), $history);
$table = 'tevento';
$sql = sprintf(
'SELECT * FROM %s

View File

@ -3377,7 +3377,7 @@ function ui_print_datatable(array $parameters)
foreach ($parameters['form']['extra_buttons'] as $button) {
$filter .= '<button id="'.$button['id'].'" ';
$filter .= ' class="'.$button['class'].'" ';
$filter .= ' style="'.$button['style'].'" ';
$filter .= ' style="'.($button['style'] ?? '').'" ';
$filter .= ' onclick="'.$button['onclick'].'" >';
$filter .= $button['text'];
$filter .= '</button>';

View File

@ -0,0 +1,5 @@
<?php
global $config;
require_once __DIR__.'/config.php';

View File

@ -614,18 +614,10 @@ class EventsListWidget extends Widget
$home_url = $config['homeurl'];
if ((bool) \is_metaconsole() === false
|| $this->nodeId > 0
) {
$fields[] = 'am.nombre as module_name';
$fields[] = 'am.id_agente_modulo as id_agentmodule';
$fields[] = 'am.custom_id as module_custom_id';
$fields[] = 'ta.server_name as server_name';
} else {
$fields[] = 'ts.server_name as server_name';
$fields[] = 'te.id_agentmodule';
$fields[] = 'te.server_id';
}
$events = \events_get_all(
// Fields.

View File

@ -113,106 +113,106 @@ if (isset($fb64)) {
$id_group = get_parameter(
'filter[id_group]',
$filter['id_group']
($filter['id_group'] ?? '')
);
$event_type = get_parameter(
'filter[event_type]',
$filter['event_type']
($filter['event_type'] ?? '')
);
$severity = get_parameter(
'filter[severity]',
$filter['severity']
($filter['severity'] ?? '')
);
$status = get_parameter(
'filter[status]',
$filter['status']
($filter['status'] ?? '')
);
$search = get_parameter(
'filter[search]',
$filter['search']
($filter['search'] ?? '')
);
$text_agent = get_parameter(
'filter[text_agent]',
$filter['text_agent']
($filter['text_agent'] ?? '')
);
$id_agent = get_parameter(
'filter[id_agent]',
$filter['id_agent']
($filter['id_agent'] ?? '')
);
$text_module = get_parameter(
'filter[module_search]',
$filter['module_search']
($filter['module_search'] ?? '')
);
$id_agent_module = get_parameter(
'id_agent_module',
get_parameter(
'filter[id_agent_module]',
$filter['id_agent_module']
($filter['id_agent_module'] ?? '')
)
);
$pagination = get_parameter(
'filter[pagination]',
$filter['pagination']
($filter['pagination'] ?? '')
);
$event_view_hr = get_parameter(
'filter[event_view_hr]',
$filter['event_view_hr']
($filter['event_view_hr'] ?? '')
);
$id_user_ack = get_parameter(
'filter[id_user_ack]',
$filter['id_user_ack']
($filter['id_user_ack'] ?? '')
);
$group_rep = get_parameter(
'filter[group_rep]',
$filter['group_rep']
($filter['group_rep'] ?? '')
);
$tag_with = get_parameter(
'filter[tag_with]',
$filter['tag_with']
($filter['tag_with'] ?? '')
);
$tag_without = get_parameter(
'filter[tag_without]',
$filter['tag_without']
($filter['tag_without'] ?? '')
);
$filter_only_alert = get_parameter(
'filter[filter_only_alert]',
$filter['filter_only_alert']
($filter['filter_only_alert'] ?? '')
);
$id_group_filter = get_parameter(
'filter[id_group_filter]',
$filter['id_group_filter']
($filter['id_group_filter'] ?? '')
);
$date_from = get_parameter(
'filter[date_from]',
$filter['date_from']
($filter['date_from'] ?? '')
);
$date_to = get_parameter(
'filter[date_to]',
$filter['date_to']
($filter['date_to'] ?? '')
);
$time_from = get_parameter(
'filter[time_from]',
$filter['time_from']
($filter['time_from'] ?? '')
);
$time_to = get_parameter(
'filter[time_to]',
$filter['time_to']
($filter['time_to'] ?? '')
);
$source = get_parameter(
'filter[source]',
$filter['source']
($filter['source'] ?? '')
);
$id_extra = get_parameter(
'filter[id_extra]',
$filter['id_extra']
($filter['id_extra'] ?? '')
);
$user_comment = get_parameter(
'filter[user_comment]',
$filter['user_comment']
($filter['user_comment'] ?? '')
);
$history = get_parameter(
'history',
$filter['history']
($filter['history'] ?? '')
);
$section = get_parameter('section', false);
@ -223,17 +223,17 @@ $id_source_event = get_parameter(
$server_id = get_parameter(
'filter[server_id]',
$filter['id_server_meta']
($filter['id_server_meta'] ?? 0)
);
$custom_data_filter_type = get_parameter(
'filter[custom_data_filter_type]',
$filter['custom_data_filter_type']
($filter['custom_data_filter_type'] ?? '')
);
$custom_data = get_parameter(
'filter[custom_data]',
$filter['custom_data']
($filter['custom_data'] ?? '')
);
if (is_metaconsole() === true) {
@ -246,7 +246,6 @@ if (is_metaconsole() === true) {
}
}
if (empty($text_agent) && empty($id_agent) === false) {
$text_agent = agents_get_alias($id_agent);
}
@ -317,16 +316,10 @@ if (is_ajax() === true) {
}
}
if (is_metaconsole() === false) {
$fields[] = 'am.nombre as module_name';
$fields[] = 'am.id_agente_modulo as id_agentmodule';
$fields[] = 'am.custom_id as module_custom_id';
$fields[] = 'ta.server_name as server_name';
} else {
$fields[] = 'ts.server_name as server_name';
$fields[] = 'te.id_agentmodule';
$fields[] = 'te.server_id';
}
$events = events_get_all(
// Fields.
@ -344,19 +337,20 @@ if (is_ajax() === true) {
// History.
$history
);
$count = events_get_all(
'count',
$filter,
null,
null,
null,
null,
$history
);
if ($count !== false) {
$count = $count['0']['nitems'];
}
// $count = events_get_all(
// 'count',
// $filter,
// null,
// null,
// null,
// null,
// $history
// );
//
// if ($count !== false) {
// $count = $count['0']['nitems'];
// }
$count = count($events);
if ($events) {
$data = array_reduce(
@ -365,15 +359,14 @@ if (is_ajax() === true) {
global $config;
$tmp = (object) $item;
$tmp->meta = is_metaconsole();
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
if ($tmp->meta === true) {
if ($tmp->server_name !== null) {
$tmp->data_server = metaconsole_get_servers($tmp->server_id);
$tmp->server_url_hash = metaconsole_get_servers_url_hash($tmp->data_server);
}
}
// $tmp->meta = is_metaconsole();
//// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
// if ($tmp->meta === true) {
// if ($tmp->server_name !== null) {
// $tmp->data_server = metaconsole_get_servers($tmp->server_id);
// $tmp->server_url_hash = metaconsole_get_servers_url_hash($tmp->data_server);
// }
// }
$tmp->evento = str_replace('"', '', io_safe_output($tmp->evento));
if (strlen($tmp->evento) >= 255) {
$tmp->evento = ui_print_truncate_text($tmp->evento, 255, $tmp->evento, true, false);
@ -437,7 +430,7 @@ if (is_ajax() === true) {
// RecordsTotal && recordsfiltered resultados totales.
echo json_encode(
[
'data' => $data,
'data' => ($data ?? []),
'recordsTotal' => $count,
'recordsFiltered' => $count,
]
@ -500,7 +493,7 @@ if ($load_filter_id === 0) {
}
// Do not load the user filter if we come from the 24h event graph.
$from_event_graph = get_parameter('filter[from_event_graph]', $filter['from_event_graph']);
$from_event_graph = get_parameter('filter[from_event_graph]', ($filter['from_event_graph'] ?? ''));
if ($loaded_filter !== false && $from_event_graph != 1 && !isset($fb64)) {
$filter = events_get_event_filter($loaded_filter['id_filter']);
if ($filter !== false) {
@ -629,7 +622,7 @@ $data[1] = html_print_image(
$data[1] .= html_print_input_hidden(
'tag_with',
$tag_with_base64,
($tag_with_base64 ?? ''),
true
);
@ -704,7 +697,7 @@ $data[1] = html_print_image(
);
$data[1] .= html_print_input_hidden(
'tag_without',
$tag_without_base64,
($tag_without_base64 ?? ''),
true
);
$data[1] .= '<br><br>'.html_print_image(
@ -863,7 +856,7 @@ if ($pure) {
// CSV.
$csv['active'] = false;
$csv['text'] = '<a class="events_link" href="'.ui_get_full_url(false, false, false, false).'operation/events/export_csv.php?'.$filter_b64.'">'.html_print_image(
$csv['text'] = '<a class="events_link" href="'.ui_get_full_url(false, false, false, false).'operation/events/export_csv.php?'.($filter_b64 ?? '').'">'.html_print_image(
'images/csv.png',
true,
[
@ -1216,7 +1209,7 @@ $params['input_name'] = 'text_agent';
$params['value'] = $text_agent;
$params['return'] = true;
if ($meta) {
if (is_metaconsole() === true) {
$params['javascript_page'] = 'enterprise/meta/include/ajax/events.ajax';
}
@ -1226,7 +1219,7 @@ $params['hidden_input_idagent_value'] = $id_agent;
$params['size'] = '';
if ($id_agent !== null) {
if (is_metaconsole()) {
if (is_metaconsole() === true) {
$metaconsole_agent = db_get_row_sql(
sprintf(
'SELECT alias, server_name
@ -1236,7 +1229,9 @@ if ($id_agent !== null) {
)
);
if ($metaconsole_agent !== false) {
$params['value'] = $metaconsole_agent['alias'].' ('.$metaconsole_agent['server_name'].')';
}
} else {
$params['value'] = agents_get_alias($id_agent);
}
@ -1881,7 +1876,6 @@ ui_require_jquery_file(
// End. Load required JS.
html_print_input_hidden('meta', (int) is_metaconsole());
html_print_input_hidden('history', (int) $history);
html_print_input_hidden('filterid', $is_filter);
html_print_input_hidden(
'ajax_file',
ui_get_full_url('ajax.php', false, false, false)
@ -1896,7 +1890,8 @@ echo "<div id='event_response_command_window' title='".__('Parameters')."'></div
echo '<div id="load-modal-filter" style="display:none"></div>';
echo '<div id="save-modal-filter" style="display:none"></div>';
if ($_GET['refr'] || $do_refresh === true) {
$autorefresh_draw = false;
if ($_GET['refr'] || (bool) ($do_refresh ?? false) === true) {
$autorefresh_draw = true;
}

View File

@ -1144,7 +1144,7 @@ echo '</div>';
);
</script>
<?php
$event_table = events_get_events_table($meta, $history);
$event_table = 'tevento';
$event_lj = events_get_secondary_groups_left_join($event_table);
if ($group_rep == 0) {
@ -1268,7 +1268,6 @@ html_print_input_hidden(
);
html_print_input_hidden('meta', (int) $meta);
html_print_input_hidden('history', (int) $history);
html_print_input_hidden('filterid', $is_filter);
ui_require_jquery_file('json');
ui_include_time_picker();