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
22/**
23 * @var CPartial $this
24 */
25
26global $DB, $ZBX_SERVER, $ZBX_SERVER_NAME, $ZBX_SERVER_PORT;
27
28$page_title = $data['page']['title'];
29if (isset($ZBX_SERVER_NAME) && $ZBX_SERVER_NAME !== '') {
30	$page_title = $ZBX_SERVER_NAME.NAME_DELIMITER.$page_title;
31}
32
33$pageHeader = new CPageHeader($page_title);
34
35$scripts = $data['javascript']['files'];
36
37$theme = ZBX_DEFAULT_THEME;
38if (!empty($DB['DB'])) {
39	$config = select_config();
40	$theme = getUserTheme($data['user']);
41
42	$pageHeader->addStyle(getTriggerSeverityCss($config));
43	$pageHeader->addStyle(getTriggerStatusCss($config));
44
45	// perform Zabbix server check only for standard pages
46	if ($config['server_check_interval'] && !empty($ZBX_SERVER) && !empty($ZBX_SERVER_PORT)) {
47		$scripts[] = 'servercheck.js';
48	}
49}
50
51// Show GUI messages in pages with menus and in kiosk mode.
52$show_gui_messaging = (!defined('ZBX_PAGE_NO_MENU') || $data['web_layout_mode'] == ZBX_LAYOUT_KIOSKMODE)
53		? intval(!CWebUser::isGuest())
54		: null;
55
56$pageHeader
57	->addCssFile('assets/styles/'.CHtml::encode($theme).'.css')
58	->addJsBeforeScripts(
59		'var PHP_TZ_OFFSET = '.date('Z').','.
60			'PHP_ZBX_FULL_DATE_TIME = "'.ZBX_FULL_DATE_TIME.'";'
61	)
62	->addJsFile((new CUrl('js/browsers.js'))->getUrl())
63	->addJsFile((new CUrl('jsLoader.php'))
64		->setArgument('lang', $data['user']['lang'])
65		->setArgument('ver', ZABBIX_VERSION)
66		->setArgument('showGuiMessaging', $show_gui_messaging)
67		->getUrl()
68	);
69
70if ($scripts) {
71	$pageHeader->addJsFile((new CUrl('jsLoader.php'))
72		->setArgument('ver', ZABBIX_VERSION)
73		->setArgument('lang', $data['user']['lang'])
74		->setArgument('files', $scripts)
75		->getUrl()
76	);
77}
78$pageHeader->display();
79
80echo '<body lang="'.CWebUser::getLang().'">';
81