', $menuTypeClass);
?>
';
// ======= Servers List ===============================================
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
$servers = [];
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
if ($servers['all'] != 0) {
$servers['up'] = (int) servers_check_status();
$servers['down'] = ($servers['all'] - $servers['up']);
if ($servers['up'] == 0) {
// All Servers down or no servers at all.
$servers_check_img = html_print_image('images/system_error@header.svg', true, ['alt' => 'cross', 'class' => 'main_menu_icon bot', 'title' => __('All systems').': '.__('Down')]);
} else if ($servers['down'] != 0) {
// Some servers down.
$servers_check_img = html_print_image('images/system_warning@header.svg', true, ['alt' => 'error', 'class' => 'main_menu_icon bot', 'title' => $servers['down'].' '.__('servers down')]);
} else {
// All servers up.
$servers_check_img = html_print_image('images/system_ok@header.svg', true, ['alt' => 'ok', 'class' => 'main_menu_icon bot', 'title' => __('All systems').': '.__('Ready')]);
}
unset($servers);
// Since this is the header, we don't like to trickle down variables.
$servers_check_img_link = html_print_anchor(
[
'href' => 'index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60',
'content' => $servers_check_img,
],
true
);
};
$servers_list = html_print_div(
[
'id' => 'servers_list',
'content' => $servers_check_img_link,
],
true
);
}
// ======= Alerts ===============================================
$check_minor_release_available = false;
$pandora_management = check_acl($config['id_user'], 0, 'PM');
$check_minor_release_available = db_check_minor_relase_available();
if ($check_minor_release_available === true) {
if (users_is_admin($config['id_user'])) {
if ($config['language'] === 'es') {
set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. '.__('Sobre actualización de revisión menor').'', 'Revisión/es menor/es disponible/s');
} else {
set_pandora_error_for_header('There are one or more minor releases waiting for update. '.__('About minor release update').'', 'minor release/s available');
}
}
}
// Search.
$acl_head_search = true;
if ($config['acl_enterprise'] == 1 && !users_is_admin()) {
$acl_head_search = db_get_sql(
"SELECT sec FROM tusuario
INNER JOIN tusuario_perfil ON tusuario.id_user = tusuario_perfil.id_usuario
INNER JOIN tprofile_view ON tprofile_view.id_profile = tusuario_perfil.id_perfil
WHERE tusuario.id_user = '".$config['id_user']."' AND (sec = '*' OR sec = 'head_search')"
);
}
if ($acl_head_search) {
// Search bar.
$search_bar = '';
$header_searchbar = '';
}
// ======= Autorefresh code =============================
$autorefresh_txt = '';
$autorefresh_additional = '';
$ignored_params = [
'agent_config' => false,
'code' => false,
];
if (!isset($_GET['sec2'])) {
$_GET['sec2'] = '';
}
if ($_GET['sec'] == 'main' || !isset($_GET['sec'])) {
// Home screen chosen by the user.
$home_page = '';
if (isset($config['id_user'])) {
$user_info = users_get_user_by_id($config['id_user']);
$home_page = io_safe_output($user_info['section']);
$home_url = $user_info['data_section'];
}
if ($home_page != '') {
switch ($home_page) {
case 'Event list':
$_GET['sec2'] = 'operation/events/events';
break;
case 'Group view':
$_GET['sec2'] = 'operation/agentes/group_view';
break;
case 'Alert detail':
$_GET['sec2'] = 'operation/agentes/alerts_status';
break;
case 'Tactical view':
$_GET['sec2'] = 'operation/agentes/tactical';
break;
case 'Default':
default:
$_GET['sec2'] = 'general/logon_ok';
break;
case 'Dashboard':
$_GET['sec2'] = 'operation/dashboard/dashboard';
break;
case 'Visual console':
$_GET['sec2'] = 'operation/visual_console/render_view';
break;
case 'Other':
$home_url = io_safe_output($home_url);
$url_array = parse_url($home_url);
parse_str($url_array['query'], $res);
foreach ($res as $key => $param) {
$_GET[$key] = $param;
}
break;
}
}
}
if (!isset($_GET['refr'])) {
$_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']
);
$header_autorefresh = '';
$header_autorefresh_counter = '';
if ($config['legacy_vc']
|| ($_GET['sec2'] !== 'operation/visual_console/render_view')
|| (($_GET['sec2'] !== 'operation/visual_console/render_view')
&& $config['legacy_vc'])
) {
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')) {
$do_refresh = false;
}
}
if ($do_refresh) {
$autorefresh_img = html_print_image(
'images/auto_refresh@header.svg',
true,
[
'class' => 'main_menu_icon bot',
'alt' => 'lightning',
'title' => __('Configure autorefresh'),
]
);
if ((isset($select[0]['time_autorefresh']) === true)
&& $select[0]['time_autorefresh'] !== 0
&& $config['refr'] === null
) {
$config['refr'] = $select[0]['time_autorefresh'];
$autorefresh_txt .= ' (';
$autorefresh_txt .= date(
'i:s',
$config['refr']
);
$autorefresh_txt .= ')';
} else if ($_GET['refr']) {
$autorefresh_txt .= ' (';
$autorefresh_txt .= date('i:s', $config['refr']);
$autorefresh_txt .= ')';
}
$ignored_params['refr'] = '';
$values = get_refresh_time_array();
$autorefresh_additional = '';
$autorefresh_additional .= html_print_select(
$values,
'ref',
'',
'',
__('Select'),
'0',
true,
false,
false
);
$autorefresh_additional .= '';
unset($values);
if ($home_page != '') {
$autorefresh_link_open_img = '';
} else {
$autorefresh_link_open_img = '';
}
if ($_GET['refr']
|| ((isset($select[0]['time_autorefresh']) === true)
&& $select[0]['time_autorefresh'] !== 0)
) {
if ($home_page != '') {
$autorefresh_link_open_txt = '';
} else {
$autorefresh_link_open_txt = '';
}
} else {
$autorefresh_link_open_txt = '';
}
$autorefresh_link_close = '';
$display_counter = 'display:block';
} else {
$autorefresh_img = html_print_image(
'images/auto_refresh@header.svg',
true,
[
'class' => 'main_menu_icon bot autorefresh_disabled invert_filter',
'alt' => 'lightning',
'title' => __('Disabled autorefresh'),
]
);
$ignored_params['refr'] = false;
$autorefresh_link_open_img = '';
$autorefresh_link_open_txt = '';
$autorefresh_link_close = '';
$display_counter = 'display:none';
}
} else {
$autorefresh_img = html_print_image(
'images/auto_refresh@header.svg',
true,
[
'class' => 'main_menu_icon bot autorefresh_disabled invert_filter',
'alt' => 'lightning',
'title' => __('Disabled autorefresh'),
]
);
$ignored_params['refr'] = false;
$autorefresh_link_open_img = '';
$autorefresh_link_open_txt = '';
$autorefresh_link_close = '';
$display_counter = 'display:none';
}
$header_autorefresh = '';
$header_autorefresh_counter = '';
}
// Button for feedback pandora.
if (enterprise_installed() && $config['activate_feedback'] !== false) {
$header_feedback = '';
}
// Support.
if (enterprise_installed()) {
$header_support_link = $config['custom_support_url'];
} else {
$header_support_link = 'https://pandorafms.com/forums/';
}
$header_support = '';
// Documentation.
$header_docu = '';
// User.
$headerUser = [];
$headerUser[] = html_print_image(
'images/edit_user@header.svg',
true,
[
'title' => __('Edit my user'),
'class' => 'main_menu_icon bot invert_filter',
'alt' => 'user',
]
);
$headerUser[] = sprintf('', $config['id_user']);
$header_user = html_print_div(
[
'id' => 'header_user',
'content' => html_print_anchor(
[
'href' => sprintf('index.php?sec=gusuarios&sec2=godmode/users/configure_user&edit_user=1&pure=0&id_user=%s', $config['id_user']),
'content' => implode('', $headerUser),
],
true
),
],
true
);
// Logout.
$header_logout = '';
if (is_reporting_console_node() === true) {
echo '';
echo '';
echo '';
} else {
echo '
';
}
?>