1<?php
2/*
3** Zabbix
4** Copyright (C) 2001-2021 Zabbix SIA
5**
6** This program is free software; you can redistribute it and/or modify
7** it under the terms of the GNU General Public License as published by
8** the Free Software Foundation; either version 2 of the License, or
9** (at your option) any later version.
10**
11** This program is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14** GNU General Public License for more details.
15**
16** You should have received a copy of the GNU General Public License
17** along with this program; if not, write to the Free Software
18** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19**/
20
21
22global $DB, $ZBX_SERVER, $ZBX_SERVER_NAME, $ZBX_SERVER_PORT;
23
24$page_title = $data['page']['title'];
25if (isset($ZBX_SERVER_NAME) && $ZBX_SERVER_NAME !== '') {
26	$page_title = $ZBX_SERVER_NAME.NAME_DELIMITER.$page_title;
27}
28
29$pageHeader = new CPageHeader($page_title);
30
31$scripts = $data['javascript']['files'];
32
33$theme = ZBX_DEFAULT_THEME;
34if (!empty($DB['DB'])) {
35	$config = select_config();
36	$theme = getUserTheme($data['user']);
37
38	$pageHeader->addStyle(getTriggerSeverityCss($config));
39	$pageHeader->addStyle(getTriggerStatusCss($config));
40
41	// perform Zabbix server check only for standard pages
42	if ($config['server_check_interval'] && !empty($ZBX_SERVER) && !empty($ZBX_SERVER_PORT)) {
43		$scripts[] = 'servercheck.js';
44	}
45}
46
47// Show GUI messages in pages with menus and in fullscreen and kiosk mode.
48$show_gui_messaging = (!defined('ZBX_PAGE_NO_MENU')
49	|| in_array($data['web_layout_mode'], [ZBX_LAYOUT_FULLSCREEN, ZBX_LAYOUT_KIOSKMODE]))
50		? intval(!CWebUser::isGuest())
51		: null;
52
53$pageHeader
54	->addCssFile('assets/styles/'.CHtml::encode($theme).'.css')
55	->addJsBeforeScripts(
56		'var PHP_TZ_OFFSET = '.date('Z').','.
57			'PHP_ZBX_FULL_DATE_TIME = "'.ZBX_FULL_DATE_TIME.'";'
58	)
59	->addJsFile((new CUrl('js/browsers.js'))->getUrl())
60	->addJsFile((new CUrl('jsLoader.php'))
61		->setArgument('lang', $data['user']['lang'])
62		->setArgument('ver', ZABBIX_VERSION)
63		->setArgument('showGuiMessaging', $show_gui_messaging)
64		->getUrl()
65	);
66
67if ($scripts) {
68	$pageHeader->addJsFile((new CUrl('jsLoader.php'))
69		->setArgument('ver', ZABBIX_VERSION)
70		->setArgument('lang', $data['user']['lang'])
71		->setArgument('files', $scripts)
72		->getUrl()
73	);
74}
75$pageHeader->display();
76
77echo '<body lang="'.CWebUser::getLang().'">';
78echo '<output class="'.ZBX_STYLE_MSG_GLOBAL_FOOTER.' '.ZBX_STYLE_MSG_WARNING.'" id="msg-global-footer"></output>';
79