'noaccess'];
}
include 'general/noaccess.php';
return;
}
$access = ($event_a === true) ? 'ER' : (($event_w === true) ? 'EW' : (($event_m === true) ? 'EM' : 'ER'));
$readonly = false;
// Load specific stylesheet.
ui_require_css_file('events');
ui_require_css_file('tables');
if (is_metaconsole() === true) {
ui_require_css_file('tables_meta', ENTERPRISE_DIR.'/include/styles/');
}
// Load extra javascript.
ui_require_javascript_file('pandora_events');
// Get requests.
$default_filter = [
'status' => EVENT_NO_VALIDATED,
'event_view_hr' => $config['event_view_hr'],
'group_rep' => EVENT_GROUP_REP_EVENTS,
'tag_with' => [],
'tag_without' => [],
'history' => false,
];
$fb64 = get_parameter('fb64', null);
if (isset($fb64) === true) {
$filter = json_decode(base64_decode($fb64), true);
$filter['tag_with'] = [];
$filter['tag_without'] = [];
} else {
$filter = get_parameter(
'filter',
$default_filter
);
}
$id_group_filter = get_parameter(
'filter[id_group_filter]',
($filter['id_group_filter'] ?? '')
);
$id_group = get_parameter(
'filter[id_group]',
($filter['id_group'] ?? $id_group_filter)
);
$event_type = get_parameter(
'filter[event_type]',
($filter['event_type'] ?? '')
);
$severity = get_parameter(
'filter[severity]',
($filter['severity'] ?? '')
);
$status = get_parameter(
'filter[status]',
($filter['status'] ?? '')
);
$search = get_parameter(
'filter[search]',
($filter['search'] ?? '')
);
$not_search = get_parameter(
'filter[not_search]',
0
);
$text_agent = get_parameter(
'filter[text_agent]',
($filter['text_agent'] ?? '')
);
$id_agent = get_parameter(
'filter[id_agent]',
($filter['id_agent'] ?? '')
);
$text_module = get_parameter(
'filter[module_search]',
($filter['module_search'] ?? '')
);
$id_agent_module = get_parameter(
'id_agent_module',
get_parameter(
'filter[id_agent_module]',
($filter['id_agent_module'] ?? '')
)
);
$pagination = get_parameter(
'filter[pagination]',
($filter['pagination'] ?? '')
);
$event_view_hr = get_parameter(
'filter[event_view_hr]',
($filter['event_view_hr'] ?? '')
);
$id_user_ack = get_parameter(
'filter[id_user_ack]',
($filter['id_user_ack'] ?? '')
);
$owner_user = get_parameter(
'filter[owner_user]',
($filter['owner_user'] ?? '')
);
$group_rep = get_parameter(
'filter[group_rep]',
($filter['group_rep'] ?? '')
);
$tag_with = get_parameter(
'filter[tag_with]',
($filter['tag_with'] ?? '')
);
$tag_without = get_parameter(
'filter[tag_without]',
($filter['tag_without'] ?? '')
);
$filter_only_alert = get_parameter(
'filter[filter_only_alert]',
($filter['filter_only_alert'] ?? '')
);
$search_secondary_groups = get_parameter(
'filter[search_secondary_groups]',
0
);
$search_recursive_groups = get_parameter(
'filter[search_recursive_groups]',
($filter['search_recursive_groups'] ?? '')
);
$id_group_filter = get_parameter(
'filter[id_group_filter]',
($filter['id_group'] ?? '')
);
$date_from = get_parameter(
'filter[date_from]',
($filter['date_from'] ?? '')
);
$date_to = get_parameter(
'filter[date_to]',
($filter['date_to'] ?? '')
);
$time_from = get_parameter(
'filter[time_from]',
($filter['time_from'] ?? '')
);
$time_to = get_parameter(
'filter[time_to]',
($filter['time_to'] ?? '')
);
$source = get_parameter(
'filter[source]',
($filter['source'] ?? '')
);
$id_extra = get_parameter(
'filter[id_extra]',
($filter['id_extra'] ?? '')
);
$user_comment = get_parameter(
'filter[user_comment]',
($filter['user_comment'] ?? '')
);
$history = get_parameter(
'history',
($filter['history'] ?? '')
);
$section = get_parameter('section', false);
$id_source_event = get_parameter(
'filter[id_source_event]',
($filter['id_source_event'] ?? '')
);
$server_id = get_parameter(
'filter[server_id]',
($filter['server_id'] ?? '')
);
if (is_metaconsole() === true) {
$servers = metaconsole_get_servers();
if (is_array($servers) === true) {
$servers = array_reduce(
$servers,
function ($carry, $item) {
$carry[$item['id']] = $item['server_name'];
return $carry;
}
);
} else {
$servers = [];
}
$servers[0] = __('Metaconsola');
if (empty($server_id) === true) {
$server_id = array_keys($servers);
} else {
if (is_array($server_id) === false) {
if (is_numeric($server_id) === true) {
if ($server_id !== 0) {
$server_id = [$filter['server_id']];
} else {
$server_id = array_keys($servers);
}
} else {
$server_id = explode(',', $filter['server_id']);
}
}
}
}
$custom_data_filter_type = get_parameter(
'filter[custom_data_filter_type]',
($filter['custom_data_filter_type'] ?? '')
);
$custom_data = get_parameter(
'filter[custom_data]',
($filter['custom_data'] ?? '')
);
if (is_metaconsole() === true
&& is_array($server_id) === false
) {
// Connect to node database.
$id_node = (int) $server_id;
if ($id_node !== 0) {
if (metaconsole_connect(null, $id_node) !== NOERR) {
return false;
}
}
}
if (empty($text_agent) === true
&& empty($id_agent) === false
) {
$text_agent = agents_get_alias($id_agent);
}
if (empty($text_module) === true && empty($id_agent_module) === false) {
$text_module = modules_get_agentmodule_name($id_agent_module);
$text_agent = agents_get_alias(modules_get_agentmodule_agent($id_agent_module));
}
if (is_metaconsole() === true
&& is_array($server_id) === false
) {
// Return to metaconsole database.
if ($id_node != 0) {
metaconsole_restore_db();
}
}
// Ajax responses.
if (is_ajax() === true) {
$get_events = (int) get_parameter('get_events', 0);
$table_id = get_parameter('table_id', '');
$groupRecursion = (bool) get_parameter('groupRecursion', false);
// Datatables offset, limit.
$start = get_parameter('start', 0);
$length = get_parameter(
'length',
$config['block_size']
);
if ($get_events !== 0) {
try {
ob_start();
$fields = [
'te.id_evento',
'te.id_agente',
'te.id_usuario',
'te.id_grupo',
'te.estado',
'te.timestamp',
'te.evento',
'te.utimestamp',
'te.event_type',
'te.id_alert_am',
'te.criticity',
'te.tags',
'te.source',
'te.id_extra',
'te.critical_instructions',
'te.warning_instructions',
'te.unknown_instructions',
'te.owner_user',
'if(te.ack_utimestamp > 0, from_unixtime(te.ack_utimestamp),"") as ack_utimestamp',
'te.custom_data',
'te.data',
'te.module_status',
'ta.alias as agent_name',
'tg.nombre as group_name',
'ta.direccion',
];
if (strpos($config['event_fields'], 'user_comment') !== false
|| empty($user_comment) === false
|| empty($search) === false
) {
$fields[] = 'te.user_comment';
}
$order = get_datatable_order(true);
if (is_array($order) === true && $order['field'] === 'mini_severity') {
$order['field'] = 'te.criticity';
}
// Find the order field and set the table and field name.
foreach ($fields as $field) {
if (str_contains($field, $order['field']) === true) {
switch ($field) {
case 'ta.alias as agent_name':
$order['field'] = 'agent_name';
break;
case 'if(te.ack_utimestamp > 0, from_unixtime(te.ack_utimestamp),"") as ack_utimestamp':
$order['field'] = 'ack_utimestamp';
break;
default:
$order['field'] = $field;
break;
}
continue;
}
}
$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';
$events = events_get_all(
// Fields.
$fields,
// Filter.
$filter,
// Offset.
$start,
// Limit.
$length,
// Order.
$order['direction'],
// Sort field.
$order['field'],
// History.
$history,
false,
'',
false,
$groupRecursion
);
$buffers = [];
if (is_metaconsole() === false
|| (is_metaconsole() === true
&& empty($filter['server_id']) === false
&& is_array($filter['server_id']) === false)
) {
$count = events_get_all(
'count',
$filter,
null,
null,
null,
null,
$history,
false,
'',
false,
$groupRecursion
);
if ($count !== false) {
$count = $count['0']['nitems'];
}
} else {
$buffers = $events['buffers'];
$count = $events['total'];
$events = $events['data'];
}
if (empty($events) === false) {
$data = array_reduce(
$events,
function ($carry, $item) use ($table_id) {
global $config;
$tmp = (object) $item;
$tmp->meta = is_metaconsole();
// phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
$server_url = '';
$hashdata = '';
if ($tmp->meta === true) {
if ($tmp->server_name !== null) {
$data_server = metaconsole_get_servers(
$tmp->server_id
);
// Url to go to node from meta.
if (isset($data_server) === true
&& $data_server !== false
) {
$server_url = $data_server['server_url'];
$hashdata = metaconsole_get_servers_url_hash(
$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
);
}
if (empty($tmp->module_name) === false) {
$tmp->module_name = io_safe_output($tmp->module_name);
}
if (empty($tmp->comments) === false) {
$tmp->comments = ui_print_comments($tmp->comments);
}
// Show last event.
if (isset($tmp->max_id_evento) === true
&& $tmp->max_id_evento !== $tmp->id_evento
) {
$max_event = db_get_row_sql(
sprintf(
'SELECT criticity,
`timestamp`
FROM tevento
WHERE id_evento = %s',
$tmp->max_id_evento
)
);
if ($max_event !== false
&& empty($max_event) === false
) {
$tmp->timestamp = $max_event['timestamp'];
$tmp->criticity = $max_event['criticity'];
}
}
$tmp->agent_name = io_safe_output($tmp->agent_name);
$tmp->ack_utimestamp_raw = strtotime($tmp->ack_utimestamp);
$tmp->ack_utimestamp = ui_print_timestamp(
(empty($tmp->ack_utimestamp) === true) ? 0 : $tmp->ack_utimestamp,
true
);
$tmp->timestamp = ui_print_timestamp(
$tmp->timestamp,
true
);
if (is_numeric($tmp->data) === true) {
$tmp->data = format_numeric(
$tmp->data,
$config['graph_precision']
);
} else {
$tmp->data = ui_print_truncate_text($tmp->data, 10);
}
$tmp->instructions = events_get_instructions($item);
$tmp->b64 = base64_encode(json_encode($tmp));
// Show comments events.
if (empty($tmp->comments) === false) {
$tmp->user_comment = $tmp->comments;
if ($tmp->comments !== 'undefined' && strlen($tmp->comments) > 80) {
$tmp->user_comment .= ' ';
$tmp->user_comment .= '';
// Grouped events.
if (isset($tmp->event_rep) === true && $tmp->event_rep > 1) {
$evn .= '('.$tmp->event_rep.') ';
}
$evn .= $tmp->evento.' ';
// Add event severity format to itself.
$tmp->evento = $evn;
// Grouped events.
if (isset($item->max_timestamp) === true
&& ($item->max_timestamp) === false
) {
$item->timestamp = $item->max_timestamp;
}
// Event type prepared.
switch ($tmp->event_type) {
case EVENTS_ALERT_FIRED;
case EVENTS_ALERT_RECOVERED;
case EVENTS_ALERT_CEASED;
case EVENTS_ALERT_MANUAL_VALIDATION;
$text = __('ALERT');
$color = COL_ALERTFIRED;
break;
case EVENTS_RECON_HOST_DETECTED;
case EVENTS_SYSTEM;
case EVENTS_ERROR;
case EVENTS_NEW_AGENT;
case EVENTS_CONFIGURATION_CHANGE;
$text = __('SYSTEM');
$color = COL_MAINTENANCE;
break;
case EVENTS_GOING_UP_WARNING;
case EVENTS_GOING_DOWN_WARNING;
$text = __('WARNING');
$color = COL_WARNING;
break;
case EVENTS_GOING_DOWN_NORMAL;
case EVENTS_GOING_UP_NORMAL;
$text = __('NORMAL');
$color = COL_NORMAL;
break;
case EVENTS_GOING_DOWN_CRITICAL;
case EVENTS_GOING_UP_CRITICAL;
$text = __('CRITICAL');
$color = COL_CRITICAL;
break;
case EVENTS_UNKNOWN;
case EVENTS_GOING_UNKNOWN;
default:
$text = __('UNKNOWN');
$color = COL_UNKNOWN;
break;
}
$event_type = '
'.$text.'
';
$tmp->event_type = $event_type;
// Module status.
// Event severity prepared.
switch ($tmp->module_status) {
case AGENT_MODULE_STATUS_NORMAL;
$text = __('NORMAL');
$color = COL_NORMAL;
break;
case AGENT_MODULE_STATUS_CRITICAL_BAD;
$text = __('CRITICAL');
$color = COL_CRITICAL;
break;
case AGENT_MODULE_STATUS_NO_DATA;
$text = __('NOT INIT');
$color = COL_NOTINIT;
break;
case AGENT_MODULE_STATUS_CRITICAL_ALERT;
case AGENT_MODULE_STATUS_NORMAL_ALERT;
case AGENT_MODULE_STATUS_WARNING_ALERT;
$text = __('ALERT');
$color = COL_ALERTFIRED;
break;
case AGENT_MODULE_STATUS_WARNING;
$text = __('WARNING');
$color = COL_WARNING;
break;
default:
$text = __('UNKNOWN');
$color = COL_UNKNOWN;
break;
}
$module_status = ''.$text.'
';
$tmp->module_status = $module_status;
// Status.
switch ($tmp->estado) {
case EVENT_STATUS_NEW:
$img = html_print_image(
'images/star.png',
true,
[
'title' => __('New event'),
'class' => 'forced-title',
]
);
$state = 0;
break;
case EVENT_STATUS_VALIDATED:
$state = 1;
$img = html_print_image(
'images/tick.png',
true,
[
'title' => __('Event validated'),
'class' => 'forced-title invert_filter',
]
);
break;
case EVENT_STATUS_INPROCESS:
$state = 2;
$img = html_print_image(
'images/hourglass.png',
true,
[
'title' => __('Event in process'),
'class' => 'forced-title invert_filter',
]
);
break;
default:
$img = html_print_image(
'images/star.png',
true,
[
'title' => __('Unknown'),
'class' => 'forced-title',
]
);
$state = 0;
break;
}
$draw_state = '';
$draw_state .= '';
$draw_state .= $state;
$draw_state .= ' ';
$draw_state .= $img;
$draw_state .= '
';
$tmp->estado = $draw_state;
// Owner.
if (empty($tmp->owner_user) === true) {
$tmp->owner_user = __('System');
} else {
$tmp->owner_user = get_user_fullname($tmp->owner_user).' ('.$tmp->owner_user.')';
}
// Group name.
if (empty($tmp->id_grupo) === true) {
$tmp->id_grupo = __('All');
} else {
$tmp->id_grupo = $tmp->group_name;
}
// Module name.
$tmp->id_agentmodule = $tmp->module_name;
// Options.
// Show more.
$tmp->options = '';
$tmp->options .= html_print_image(
'images/operation.png',
true,
[
'title' => __('Show more'),
'class' => 'invert_filter',
]
);
$tmp->options .= ' ';
if (isset($tmp->server_id) === false) {
$tmp->server_id = 0;
}
if ((int) $tmp->user_can_write === 1) {
if ((int) $tmp->estado !== 1) {
// Validate.
$tmp->options .= 'options .= ' id="val-'.$id_val.'">';
$tmp->options .= html_print_image(
'images/tick.png',
true,
[
'title' => __('Validate events'),
'class' => 'invert_filter',
]
);
$tmp->options .= ' ';
} else {
$id_val = $tmp->id_evento;
if (is_metaconsole() === true) {
$id_val .= '-'.$tmp->server_id;
}
$tmp->options .= $tmp->id_evento.', 0, this, ';
$tmp->options .= $tmp->server_id.')" id="val-'.$id_val.'">';
$tmp->options .= html_print_image(
'images/tick.png',
true,
[
'title' => __('Validate event'),
'class' => 'invert_filter',
]
);
$tmp->options .= '';
}
}
if ((int) $tmp->estado !== 2) {
// In process.
$tmp->options .= '';
} else {
$id_proc = $tmp->id_evento;
if (is_metaconsole() === true) {
$id_proc .= '-'.$tmp->server_id;
}
$tmp->options .= $tmp->id_evento.', 0, this, ';
$tmp->options .= $tmp->server_id.')" id="proc-'.$id_proc.'">';
}
$tmp->options .= html_print_image(
'images/hourglass.png',
true,
[
'title' => __('Change to in progress status'),
'class' => 'invert_filter',
]
);
$tmp->options .= ' ';
}
}
if ((int) $tmp->user_can_manage === 1) {
// Delete.
$tmp->options .= '';
$tmp->options .= html_print_image(
'images/cross.png',
true,
[
'title' => __('Delete events'),
'class' => 'invert_filter',
]
);
$tmp->options .= ' ';
} else {
$id_del = $tmp->id_evento;
if (is_metaconsole() === true) {
$id_del .= '-'.$tmp->server_id;
}
$tmp->options .= $tmp->id_evento.', 0, this, ';
$tmp->options .= $tmp->server_id.')" id="del-'.$id_del.'">';
$tmp->options .= html_print_image(
'images/cross.png',
true,
[
'title' => __('Delete event'),
'class' => 'invert_filter',
]
);
$tmp->options .= '';
}
}
// Multi select.
$value_checkbox = $tmp->id_evento;
if (is_metaconsole() === true) {
$value_checkbox .= '|'.$tmp->server_id;
}
$tmp->m = ' max_id_evento) === true
&& empty($tmp->max_id_evento) === false
) {
$tmp->m .= ' event_rep="'.$tmp->event_rep.'" ';
} else {
$tmp->m .= ' event_rep="0" ';
}
$tmp->m .= 'class="candeleted chk_val">';
// Url to agent view.
$url_link = ui_get_full_url(
'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='
);
$url_link_hash = '';
if ($tmp->meta === true) {
$url_link = $server_url;
$url_link .= '/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=';
$url_link_hash = $hashdata;
}
// Agent name link.
if ($tmp->id_agente > 0) {
$draw_agent_name = '';
$draw_agent_name .= $tmp->agent_name;
$draw_agent_name .= ' ';
$tmp->agent_name = $draw_agent_name;
} else {
$tmp->agent_name = '';
}
// Agent ID link.
if ($tmp->id_agente > 0) {
$draw_agent_id = '';
$draw_agent_id .= $tmp->id_agente;
$draw_agent_id .= ' ';
$tmp->id_agente = $draw_agent_id;
} else {
$tmp->id_agente = '';
}
if (empty($tmp->custom_data) === false) {
$custom_data = json_decode(io_safe_output($tmp->custom_data), true);
$custom_data_str = '';
if (isset($custom_data) === true && empty($custom_data) === false) {
foreach ($custom_data as $key => $value) {
$custom_data_str .= $key.' = '.$value.' ';
}
}
$tmp->custom_data = $custom_data_str;
}
$carry[] = $tmp;
return $carry;
}
);
}
// RecordsTotal && recordsfiltered resultados totales.
echo json_encode(
[
'data' => ($data ?? []),
'buffers' => $buffers,
'recordsTotal' => $count,
'recordsFiltered' => $count,
]
);
$response = ob_get_clean();
// Clean output buffer.
while (ob_get_level() !== 0) {
ob_end_clean();
}
} catch (Exception $e) {
echo json_encode(
['error' => $e->getMessage()]
);
}
// If not valid it will throw an exception.
json_decode($response);
if (json_last_error() == JSON_ERROR_NONE) {
// If valid dump.
echo $response;
} else {
echo json_encode(
['error' => $response]
);
}
}
// AJAX section ends.
exit;
}
/*
* Load user default form.
*/
$load_filter_id = (int) get_parameter('filter_id', 0);
if ($load_filter_id === 0) {
// Load user filter.
$loaded_filter = db_get_row_sql(
sprintf(
'SELECT f.id_filter, f.id_name
FROM tevent_filter f
INNER JOIN tusuario u
ON u.default_event_filter=f.id_filter
WHERE u.id_user = "%s" ',
$config['id_user']
)
);
} else {
// Load filter selected by user.
$loaded_filter['id_filter'] = $load_filter_id;
$loaded_filter['id_name'] = db_get_value(
'id_name',
'tevent_filter',
'id_filter',
$load_filter_id
);
}
// 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'] ?? ''));
if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false) {
$filter = events_get_event_filter($loaded_filter['id_filter']);
if ($filter !== false) {
$id_group = $filter['id_group'];
$event_type = $filter['event_type'];
$severity = $filter['severity'];
$status = $filter['status'];
$search = $filter['search'];
$not_search = $filter['not_search'];
$text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent'];
$id_agent_module = $filter['id_agent_module'];
$text_module = io_safe_output(
db_get_value_filter(
'nombre',
'tagente_modulo',
['id_agente_modulo' => $filter['id_agent_module']]
)
);
$pagination = $filter['pagination'];
$event_view_hr = $filter['event_view_hr'];
$id_user_ack = $filter['id_user_ack'];
$owner_user = $filter['owner_user'];
$group_rep = $filter['group_rep'];
$tag_with = json_decode(io_safe_output($filter['tag_with']));
$tag_without = json_decode(io_safe_output($filter['tag_without']));
$tag_with_base64 = base64_encode(json_encode($tag_with));
$tag_without_base64 = base64_encode(json_encode($tag_without));
$filter_only_alert = $filter['filter_only_alert'];
$search_secondary_groups = ($filter['search_secondary_groups'] ?? 0);
$search_recursive_groups = ($filter['search_recursive_groups'] ?? 0);
$id_group_filter = $filter['id_group_filter'];
$date_from = $filter['date_from'];
$time_from = $filter['time_from'];
$date_to = $filter['date_to'];
$time_to = $filter['time_to'];
$source = $filter['source'];
$id_extra = $filter['id_extra'];
$user_comment = $filter['user_comment'];
$id_source_event = ($filter['id_source_event'] ?? '');
$server_id = '';
if (empty($filter['server_id']) === false) {
if (is_array($server_id) === false) {
if (is_numeric($server_id) === true) {
if ($server_id !== 0) {
$server_id = [$filter['server_id']];
} else {
$server_id = array_keys($servers);
}
} else {
$server_id = explode(',', $filter['server_id']);
}
}
}
$custom_data = $filter['custom_data'];
$custom_data_filter_type = $filter['custom_data_filter_type'];
}
}
// TAGS.
// Get the tags where the user have permissions in Events reading tasks.
$tags = tags_get_user_tags($config['id_user'], $access);
$tags_select_with = [];
$tags_select_without = [];
$tag_with_temp = [];
$tag_without_temp = [];
if (is_array($tag_with) === false) {
$tag_with = json_decode(base64_decode($tag_with), true);
}
if (is_array($tag_without) === false) {
$tag_without = json_decode(base64_decode($tag_without), true);
}
foreach ((array) $tags as $id_tag => $tag) {
if (is_array($tag_with) === true
&& ((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 (is_array($tag_without) === true
&& ((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);
}
}
$add_with_tag_disabled = empty($tags_select_with);
$remove_with_tag_disabled = empty($tag_with_temp);
$add_without_tag_disabled = empty($tags_select_without);
$remove_without_tag_disabled = empty($tag_without_temp);
$tabletags_with = html_get_predefined_table('transparent', 2);
$tabletags_with->id = 'filter_events_tags_with';
$tabletags_with->width = '100%';
$tabletags_with->cellspacing = 4;
$tabletags_with->cellpadding = 4;
$tabletags_with->class = 'noshadow';
$tabletags_with->styleTable = 'border: 0px;';
if (is_metaconsole() === true) {
$tabletags_with->class = 'nobady';
$tabletags_with->cellspacing = 0;
$tabletags_with->cellpadding = 0;
}
$data = [];
$data[0] = html_print_select(
$tags_select_with,
'select_with',
'',
'',
'',
0,
true,
true,
true,
'select_tags',
false
);
$data[1] = html_print_image(
'images/darrowright.png',
true,
[
'id' => 'button-add_with',
'style' => 'cursor: pointer;',
'title' => __('Add'),
'class' => 'invert_filter',
]
);
$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'),
'class' => 'invert_filter',
]
);
$data[2] = html_print_select(
$tag_with_temp,
'tag_with_temp',
[],
'',
'',
0,
true,
true,
true,
'select_tags',
false
);
$tabletags_with->data[] = $data;
$tabletags_with->rowclass[] = '';
$tabletags_without = html_get_predefined_table('transparent', 2);
$tabletags_without->id = 'filter_events_tags_without';
$tabletags_without->width = '100%';
$tabletags_without->cellspacing = 4;
$tabletags_without->cellpadding = 4;
$tabletags_without->class = 'noshadow';
if (is_metaconsole() === true) {
$tabletags_without->class = 'nobady';
$tabletags_without->cellspacing = 0;
$tabletags_without->cellpadding = 0;
}
$tabletags_without->styleTable = 'border: 0px;';
$data = [];
$data[0] = html_print_select(
$tags_select_without,
'select_without',
'',
'',
'',
0,
true,
true,
true,
'select_tags',
false
);
$data[1] = html_print_image(
'images/darrowright.png',
true,
[
'id' => 'button-add_without',
'style' => 'cursor: pointer;',
'title' => __('Add'),
'class' => 'invert_filter',
]
);
$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'),
'class' => 'invert_filter',
]
);
$data[2] = html_print_select(
$tag_without_temp,
'tag_without_temp',
[],
'',
'',
0,
true,
true,
true,
'select_tags',
false
);
$tabletags_without->data[] = $data;
$tabletags_without->rowclass[] = '';
if (io_safe_output($tag_with) == '["0"]') {
$tag_with = '[]';
}
if (io_safe_output($tag_without) == '["0"]') {
$tag_without = '[]';
}
/*
* END OF TAGS.
*/
// View.
$pure = get_parameter('pure', 0);
$url = ui_get_full_url('index.php?sec=eventos&sec2=operation/events/events');
// Concatenate parameters.
$url .= '';
if ($pure) {
// Fullscreen.
// Floating menu - Start.
echo '';
echo '';
echo '
';
// Floating menu - End.
ui_require_jquery_file('countdown');
} else {
if (is_metaconsole() === true) {
// Load metaconsole frame.
enterprise_hook('open_meta_frame');
}
// Header.
$pss = get_user_info($config['id_user']);
$hashup = md5($config['id_user'].$pss['password']);
// Fullscreen.
$fullscreen['active'] = false;
$fullscreen['text'] = ''.html_print_image(
'images/full_screen.png',
true,
[
'title' => __('Full screen'),
'class' => 'invert_filter',
]
).' ';
// Event list.
$list['active'] = false;
$list['text'] = ''.html_print_image(
'images/events_list.png',
true,
[
'title' => __('Event list'),
'class' => 'invert_filter',
]
).' ';
// History event list.
$history_list['active'] = false;
$history_list['text'] = ''.html_print_image(
'images/books.png',
true,
[
'title' => __('History event list'),
'class' => 'invert_filter',
]
).' ';
// RSS.
$rss['active'] = false;
$rss['text'] = ''.html_print_image(
'images/rss.png',
true,
[
'title' => __('RSS Events'),
'class' => 'invert_filter',
]
).' ';
// CSV.
$csv['active'] = false;
$csv['text'] = ''.html_print_image(
'images/csv.png',
true,
[
'title' => __('Export to CSV file'),
'class' => 'invert_filter',
]
).' ';
// Sound events.
$sound_event['active'] = false;
// Sound Events.
$data_sound = base64_encode(
json_encode(
[
'title' => __('Sound Console'),
'start' => __('Start'),
'stop' => __('Stop'),
'noAlert' => __('No alert'),
'silenceAlarm' => __('Silence alarm'),
'url' => ui_get_full_url('ajax.php'),
'page' => 'include/ajax/events',
'urlSound' => 'include/sounds/',
]
)
);
$sound_event['text'] = ''.html_print_image(
'images/sound.png',
true,
[
'title' => __('Sound events'),
'class' => 'invert_filter',
]
).' ';
// If the user has administrator permission display manage tab.
if ($event_w === true || $event_m === true) {
// Manage events.
$manage_events['active'] = false;
$manage_events['text'] = ''.html_print_image(
'images/setup.png',
true,
[
'title' => __('Manage events'),
'class' => 'invert_filter',
]
).' ';
$manage_events['godmode'] = true;
$onheader = [
'manage_events' => $manage_events,
'fullscreen' => $fullscreen,
'list' => $list,
'history' => $history_list,
'rss' => $rss,
'csv' => $csv,
'sound_event' => $sound_event,
];
} else {
$onheader = [
'fullscreen' => $fullscreen,
'list' => $list,
'history' => $history_list,
'rss' => $rss,
'csv' => $csv,
'sound_event' => $sound_event,
];
}
// If the history event is not enabled, dont show the history tab.
if (isset($config['history_db_enabled']) === false
|| (bool) $config['history_db_enabled'] === false
) {
unset($onheader['history']);
}
switch ($section) {
case 'sound_event':
$onheader['sound_event']['active'] = true;
$section_string = __('Sound events');
break;
case 'history':
$onheader['history']['active'] = true;
$section_string = __('History');
break;
default:
$onheader['list']['active'] = true;
$section_string = __('List');
break;
}
if (is_metaconsole() === false) {
unset($onheader['history']);
ui_print_standard_header(
__('Events list'),
'images/lightning_go.png',
false,
'eventview',
false,
(array) $onheader,
[
[
'link' => '',
'label' => __('Events'),
],
]
);
} else {
unset($onheader['rss']);
unset($onheader['sound_event']);
unset($onheader['fullscreen']);
ui_meta_print_header(__('Events'), $section_string, $onheader);
}
}
if (enterprise_installed() === true) {
if (isset($config['merge_process_events']) === true
&& empty($config['merge_process_events']) === false
) {
ui_require_css_file('command_center', ENTERPRISE_DIR.'/include/styles/');
ui_require_javascript_file(
'pandora_command_center',
ENTERPRISE_DIR.'/include/javascript/'
);
$commandCenter = 'CommandCenterController';
if (class_exists($commandCenter) === true) {
$events_merge_state = $commandCenter::displayEventsProgress();
if (empty($events_merge_state) === false) {
echo '';
echo $events_merge_state;
echo '
';
}
}
$tittle_error = __('Errors');
echo '
';
}
}
// Error div for ajax messages.
html_print_div(
[
'id' => 'show_message_error',
'content' => '',
]
);
if (enterprise_hook(
'enterprise_acl',
[
$config['id_user'],
'eventos',
'execute_event_responses',
]
) === false
) {
$readonly = true;
}
/*
* Load filter form.
*/
// Group.
if ($id_group === null) {
$id_group = 0;
}
$data = html_print_input(
[
'name' => 'id_group_filter',
'returnAllGroup' => true,
'privilege' => 'AR',
'type' => 'select_groups',
'selected' => $id_group,
'nothing' => false,
'return' => true,
'size' => '80%',
]
);
$in = ''.__('Group').' ';
$in .= $data.'
';
$inputs[] = $in;
// Event type.
$types = get_event_types();
$types['not_normal'] = __('Not normal');
$data = html_print_select(
$types,
'event_type',
$event_type,
'',
__('All'),
'',
true
);
$in = ''.__('Event type').' ';
$in .= $data.'
';
$inputs[] = $in;
// Event status.
$data = html_print_select(
events_get_all_status(),
'status',
$status,
'',
'',
'',
true
);
$in = ''.__('Event status').' ';
$in .= $data.'
';
$inputs[] = $in;
// Max hours old.
$data = html_print_input_text(
'event_view_hr',
$event_view_hr,
'',
5,
255,
true
);
$in = ''.__('Max. hours old').' ';
$in .= $data.'
';
$inputs[] = $in;
// Duplicates group { events | agents }.
$data = html_print_select(
[
EVENT_GROUP_REP_ALL => __('All events'),
EVENT_GROUP_REP_EVENTS => __('Group events'),
EVENT_GROUP_REP_AGENTS => __('Group agents'),
EVENT_GROUP_REP_EXTRAIDS => __('Group extra id'),
],
'group_rep',
$group_rep,
'',
'',
0,
true
);
$in = ''.__('Repeated').' ';
$in .= $data.'
';
$inputs[] = $in;
// Free search.
$data = html_print_input_text('search', $search, '', '', 255, true);
// Search recursive groups.
$data .= ui_print_help_tip(
__('Search for elements NOT containing given text.'),
true
);
$data .= html_print_checkbox_switch(
'not_search',
$not_search,
$not_search,
true,
false,
'checked_slide_events(this);',
true
);
$in = ''.__('Free search').' ';
$in .= $data;
$in .= '
';
$inputs[] = $in;
if (is_array($severity) === false) {
if (empty($severity) === true && $severity !== '0') {
$severity = -1;
} else {
$severity = explode(',', $severity);
}
}
// Criticity - severity.
$data = html_print_select(
get_priorities(),
'severity',
$severity,
'',
__('All'),
-1,
true,
true,
true,
'',
false,
false,
false,
3
);
$in = ''.__('Severity').' ';
$in .= $data.'
';
$inputs[] = $in;
// Search recursive groups.
$data = html_print_checkbox_switch(
'search_recursive_groups',
$search_recursive_groups,
$search_recursive_groups,
true,
false,
'checked_slide_events(this);',
true
);
$in = '';
$in .= __('Group recursion');
$in .= ui_print_help_tip(
__('WARNING: This could cause a performace impact.'),
true
);
$in .= ' ';
$in .= $data;
$in .= '
';
$inputs[] = $in;
// Search secondary groups.
$data = html_print_checkbox_switch(
'search_secondary_groups',
$search_secondary_groups,
$search_secondary_groups,
true,
false,
'checked_slide_events(this);',
true
);
$in = '';
$in .= __('Search in secondary groups');
$in .= ui_print_help_tip(
__('WARNING: This could cause a performace impact.'),
true
);
$in .= ' ';
$in .= $data;
$in .= '
';
$inputs[] = $in;
// Trick view in table.
$inputs[] = '
';
$buttons = [];
$buttons[] = [
'id' => 'load-filter',
'class' => 'float-left margin-right-2 sub config',
'text' => __('Load filter'),
'onclick' => '',
];
if ($event_w === true || $event_m === true) {
$buttons[] = [
'id' => 'save-filter',
'class' => 'float-left margin-right-2 sub wand',
'text' => __('Save filter'),
'onclick' => '',
];
}
/*
* Advanced filter.
*/
$adv_inputs = [];
// Source.
$data = html_print_input_text('source', $source, '', '', 255, true);
$in = ''.__('Source').' ';
$in .= $data.'
';
$adv_inputs[] = $in;
// Extra ID.
$data = html_print_input_text('id_extra', $id_extra, '', 11, 255, true);
$in = ''.__('Extra ID').' ';
$in .= $data.'
';
$adv_inputs[] = $in;
// Comment.
$data = html_print_input_text(
'user_comment',
$user_comment,
'',
'',
255,
true
);
$in = ''.__('Comment').' ';
$in .= $data.'
';
$adv_inputs[] = $in;
// Agent search.
$params = [];
$params['show_helptip'] = true;
$params['input_name'] = 'text_agent';
$params['value'] = $text_agent;
$params['return'] = true;
if (is_metaconsole() === true) {
$params['javascript_page'] = 'enterprise/meta/include/ajax/events.ajax';
}
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent';
$params['hidden_input_idagent_value'] = $id_agent;
$params['size'] = '';
if ($id_agent !== null) {
if (is_metaconsole() === true) {
$metaconsole_agent = db_get_row_sql(
sprintf(
'SELECT alias, server_name
FROM tmetaconsole_agent
WHERE id_tagente = "%d" ',
$id_agent
)
);
if ($metaconsole_agent !== false) {
$params['value'] = $metaconsole_agent['alias'].' ('.$metaconsole_agent['server_name'].')';
}
} else {
$params['value'] = agents_get_alias($id_agent);
}
}
$data = ui_print_agent_autocomplete_input($params);
$in = ''.__('Agent search').' ';
$in .= $data.'
';
$adv_inputs[] = $in;
// Mixed. Metaconsole => server, Console => module.
if (is_metaconsole() === true) {
$title = __('Server');
$data = html_print_select(
$servers,
'server_id',
$server_id,
'',
'',
0,
true,
true,
true,
'',
false,
'height: 60px;'
);
} else {
$title = __('Module search');
$data = html_print_autocomplete_modules(
'module_search',
$text_module,
false,
true,
'',
[],
true,
$id_agent_module,
''
);
}
$in = ''.$title.' ';
$in .= $data.'
';
$adv_inputs[] = $in;
// User ack.
$user_users = users_get_user_users(
$config['id_user'],
$access,
true
);
$data = html_print_select(
$user_users,
'id_user_ack',
$id_user_ack,
'',
__('Any'),
0,
true
);
$in = ''.__('User ack.').' ';
$in .= $data.'
';
$adv_inputs[] = $in;
$data = html_print_select(
$user_users,
'owner_user',
$owner_user,
'',
__('Any'),
0,
true
);
$in = ''.__('Owner').' ';
$in .= $data.'
';
$adv_inputs[] = $in;
// Only alert events.
$data = html_print_select(
[
'0' => __('Filter alert events'),
'1' => __('Only alert events'),
],
'filter_only_alert',
$filter_only_alert,
'',
__('All'),
-1,
true
);
$adv_inputs[] = html_print_div(
[
'class' => 'filter_input',
'content' => sprintf(
'%s %s',
__('Alert events'),
$data
),
],
true
);
if (is_metaconsole() === true) {
$data = html_print_input_text(
'id_source_event',
$id_source_event,
'',
5,
255,
true
);
$adv_inputs[] = html_print_div(
[
'class' => 'filter_input',
'content' => sprintf(
'%s %s',
__('Id source event'),
$data
),
],
true
);
}
// Date from.
$inputDateFrom = html_print_input_text(
'date_from',
($date_from === '0000-00-00') ? '' : $date_from,
'',
false,
10,
true,
// Disabled.
false,
// Required.
false,
// Function.
'',
// Class.
'',
// OnChange.
'',
// Autocomplete.
'off'
);
// Time from.
$inputTimeFrom = html_print_input_text(
'time_from',
$time_from,
'',
false,
10,
true,
// Disabled.
false,
// Required.
false,
// Function.
'',
// Class.
'',
// OnChange.
'',
// Autocomplete.
'off'
);
// Date and Time From.
$adv_inputs[] = html_print_div(
[
'class' => 'filter_input',
'content' => sprintf(
'%s %s: %s',
__('From (date:time)'),
$inputDateFrom,
$inputTimeFrom
),
],
true
);
// Time to.
$inputTimeTo = html_print_input_text(
'time_to',
$time_to,
'',
false,
10,
true,
// Disabled.
false,
// Required.
false,
// Function.
'',
// Class.
'',
// OnChange.
'',
// Autocomplete.
'off'
);
// Date to.
$inputDateTo = html_print_input_text(
'date_to',
($date_to === '0000-00-00') ? '' : $date_to,
'',
false,
10,
true,
// Disabled.
false,
// Required.
false,
// Function.
'',
// Class.
'',
// OnChange.
'',
// Autocomplete.
'off'
);
// Date and Time To.
$adv_inputs[] = html_print_div(
[
'class' => 'filter_input',
'content' => sprintf(
'%s %s: %s',
__('To (date:time)'),
$inputDateTo,
$inputTimeTo
),
],
true
);
// Custom data filter type.
$custom_data_filter_type_input = html_print_select(
[
'0' => __('Filter custom data by field name'),
'1' => __('Filter custom data by field value'),
],
'custom_data_filter_type',
$custom_data_filter_type,
'',
false,
-1,
true
);
$adv_inputs[] = html_print_div(
[
'class' => 'filter_input',
'content' => sprintf(
'%s %s',
__('Custom data filter'),
$custom_data_filter_type_input
),
],
true
);
// Custom data.
$custom_data_input = html_print_input_text(
'custom_data',
$custom_data,
'',
5,
255,
true
);
$adv_inputs[] = html_print_div(
[
'class' => 'filter_input',
'content' => sprintf(
'%s %s',
__('Custom data search'),
$custom_data_input
),
],
true
);
// Tags.
if (is_metaconsole() === true) {
$data = ''.__('Events with following tags').' '.html_print_table($tabletags_with, true).' ';
$data .= ''.__('Events without following tags').' '.html_print_table($tabletags_without, true).' ';
} else {
$data = ''.__('Events with following tags').' '.html_print_table($tabletags_with, true).' ';
$data .= ''.__('Events without following tags').' '.html_print_table($tabletags_without, true).' ';
}
$in = '';
$in .= $data.'
';
$adv_inputs[] = $in;
// Load view.
$adv_filter = join('', $adv_inputs);
$filter = join('', $inputs);
$filter .= ui_toggle(
$adv_filter,
__('Advanced options'),
'',
'',
true,
true,
'white_box white_box_opened',
'no-border flex-row'
);
try {
$checkbox_all = html_print_checkbox(
'all_validate_box',
1,
false,
true
);
$default_fields = [
[
'text' => 'evento',
'class' => 'mw120px',
],
[
'text' => 'mini_severity',
'class' => 'no-padding',
],
'id_evento',
'agent_name',
'timestamp',
'event_type',
[
'text' => 'options',
'class' => 'action_buttons w120px',
],
[
'text' => 'm',
'extra' => $checkbox_all,
'class' => 'mw120px',
],
];
$fields = explode(',', $config['event_fields']);
// Always check something is shown.
if (empty($fields)) {
$fields = $default_fields;
}
if (in_array('mini_severity', $fields) > 0) {
$fields[array_search('mini_severity', $fields)] = [
'text' => 'mini_severity',
'class' => 'no-padding-imp',
];
}
// Identifies column instructions to make it unsortable.
if (in_array('instructions', $fields) > 0) {
$fields[array_search('instructions', $fields)] = [
'text' => 'instructions',
'class' => 'column-instructions',
];
}
$evento_id = array_search('evento', $fields);
if ($evento_id !== false) {
$fields[$evento_id] = [
'text' => 'evento',
'class' => 'mw250px',
];
}
// Always add options column.
$fields = array_merge(
$fields,
[
[
'text' => 'options',
'class' => 'action_buttons mw120px',
],
[
'text' => 'm',
'extra' => $checkbox_all,
'class' => 'w20px no-text-imp',
],
]
);
// Get column names.
$column_names = events_get_column_names($fields, true);
foreach ($column_names as $key => $column) {
if (is_array($column) && $column['text'] == 'S') {
$column_names[$key]['style'] = 'padding-left: 1em !important;';
}
}
// Open current filter quick reference.
$active_filters_div = '';
// Current filter.
$active_filters_div .= '
';
$active_filters_div .= '
'.__('Current filter').'
';
$active_filters_div .= '
';
if ($loaded_filter !== false) {
$active_filters_div .= htmlentities(io_safe_output($loaded_filter['id_name']));
} else {
$active_filters_div .= __('Not set.');
}
$active_filters_div .= '
';
$active_filters_div .= '
';
// Event status.
$active_filters_div .= '
';
$active_filters_div .= '
'.__('Event status').'
';
$active_filters_div .= '
';
switch ($status) {
case EVENT_ALL:
default:
$active_filters_div .= __('Any status.');
break;
case EVENT_NEW:
$active_filters_div .= __('New events.');
break;
case EVENT_VALIDATE:
$active_filters_div .= __('Validated.');
break;
case EVENT_PROCESS:
$active_filters_div .= __('In proccess.');
break;
case EVENT_NO_VALIDATED:
$active_filters_div .= __('Not validated.');
break;
}
$active_filters_div .= '
';
$active_filters_div .= '
';
// Max. hours old.
$active_filters_div .= '
';
$active_filters_div .= '
'.__('Max. hours old').'
';
$active_filters_div .= '
';
if ($event_view_hr == 0) {
$active_filters_div .= __('Any time.');
} else if ($event_view_hr == 1) {
$active_filters_div .= __('Last hour.');
} else if ($event_view_hr > 1) {
$active_filters_div .= __('Last %d hours.', $event_view_hr);
}
$active_filters_div .= '
';
$active_filters_div .= '
';
// Duplicates.
$active_filters_div .= '
';
$active_filters_div .= '
'.__('Duplicated').'
';
$active_filters_div .= '
';
if ($group_rep == EVENT_GROUP_REP_ALL) {
$active_filters_div .= __('All events.');
} else if ($group_rep == EVENT_GROUP_REP_EVENTS) {
$active_filters_div .= __('Group events');
} else if ($group_rep == EVENT_GROUP_REP_AGENTS) {
$active_filters_div .= __('Group agents.');
} else if ($group_rep == EVENT_GROUP_REP_EXTRAIDS) {
$active_filters_div .= __('Group extra id.');
}
$active_filters_div .= '
';
$active_filters_div .= '
';
// Close.
$active_filters_div .= '
';
$active_filters_div .= '
';
$table_id = 'table_events';
$form_id = 'events_form';
// Print datatable.
ui_print_datatable(
[
'id' => $table_id,
'class' => 'info_table events',
'style' => 'width: 100%;',
'ajax_url' => 'operation/events/events',
'ajax_data' => [
'get_events' => 1,
'history' => (int) $history,
'table_id' => $table_id,
],
'form' => [
'id' => $form_id,
'class' => 'flex-row',
'html' => $filter,
'inputs' => [],
'extra_buttons' => $buttons,
],
'extra_html' => $active_filters_div,
'pagination_options' => [
[
$config['block_size'],
10,
25,
100,
200,
500,
1000,
-1,
],
[
$config['block_size'],
10,
25,
100,
200,
500,
1000,
'All',
],
],
'order' => [
'field' => 'timestamp',
'direction' => 'desc',
],
'column_names' => $column_names,
'columns' => $fields,
'no_sortable_columns' => [
-1,
-2,
'column-instructions',
],
'ajax_return_operation' => 'buffers',
'ajax_return_operation_function' => 'process_buffers',
'drawCallback' => 'process_datatables_callback(this, settings)',
]
);
} catch (Exception $e) {
ui_print_error_message($e->getMessage());
}
// Event responses.
if (is_user_admin($config['id_user'])) {
$sql_event_resp = "SELECT id, name FROM tevent_response WHERE type LIKE 'command'";
$event_responses = db_get_all_rows_sql($sql_event_resp);
} else {
$id_groups = array_keys(users_get_groups(false, 'EW'));
$event_responses = db_get_all_rows_filter(
'tevent_response',
[
'id_group' => $id_groups,
'type' => 'command',
]
);
}
$array_events_actions = [];
if ($event_w === true && $readonly === false) {
$array_events_actions['in_progress_selected'] = __('In progress selected');
$array_events_actions['validate_selected'] = __('Validate selected');
}
if ($event_m === true && $readonly === false) {
$array_events_actions['delete_selected'] = __('Delete selected');
}
foreach ($event_responses as $val) {
$array_events_actions[$val['id']] = $val['name'];
}
if (check_acl(
$config['id_user'],
0,
'EW'
)
) {
echo '';
echo '';
echo '';
echo __(
'A maximum of %s event custom responses can be selected',
$config['max_execution_event_response']
).' ';
echo '';
echo __(
'Please, select an event'
).' ';
echo '
';
}
// Close viewer.
enterprise_hook('close_meta_frame');
// Datepicker requirements.
ui_require_css_file('datepicker');
ui_include_time_picker();
ui_require_jquery_file(
'ui.datepicker-'.get_user_language(),
'include/javascript/i18n/'
);
// End. Load required JS.
html_print_input_hidden('meta', (int) is_metaconsole());
html_print_input_hidden('history', (int) $history);
html_print_input_hidden(
'ajax_file',
ui_get_full_url('ajax.php', false, false, false)
);
// AJAX call options responses.
echo "
";
echo "
";
echo "
";
// Load filter div for dialog.
echo '
';
echo '
';
$autorefresh_draw = false;
if ($_GET['refr'] || (bool) ($do_refresh ?? false) === true) {
$autorefresh_draw = true;
}
?>