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	$theme = getUserTheme($data['user']);
40
41	$pageHeader->addStyle(getTriggerSeverityCss());
42	$pageHeader->addStyle(getTriggerStatusCss());
43
44	// Perform Zabbix server check only for standard pages.
45	if ($data['config']['server_check_interval'] && !empty($ZBX_SERVER) && !empty($ZBX_SERVER_PORT)) {
46		$scripts[] = 'servercheck.js';
47	}
48}
49
50// Show GUI messages in pages with menus and in kiosk mode.
51$show_gui_messaging = (!defined('ZBX_PAGE_NO_MENU') || $data['web_layout_mode'] == ZBX_LAYOUT_KIOSKMODE)
52		? intval(!CWebUser::isGuest())
53		: null;
54
55$pageHeader
56	->addCssFile('assets/styles/'.CHtml::encode($theme).'.css')
57	->addJsBeforeScripts(
58		'var PHP_TZ_OFFSET = '.date('Z').','.
59			'PHP_ZBX_FULL_DATE_TIME = "'.ZBX_FULL_DATE_TIME.'";'
60	)
61	->addJsFile((new CUrl('js/browsers.js'))->getUrl())
62	->addJsFile((new CUrl('jsLoader.php'))
63		->setArgument('lang', $data['user']['lang'])
64		->setArgument('ver', ZABBIX_VERSION)
65		->setArgument('showGuiMessaging', $show_gui_messaging)
66		->getUrl()
67	);
68
69if ($scripts) {
70	$pageHeader->addJsFile((new CUrl('jsLoader.php'))
71		->setArgument('ver', ZABBIX_VERSION)
72		->setArgument('lang', $data['user']['lang'])
73		->setArgument('files', $scripts)
74		->getUrl()
75	);
76}
77$pageHeader->display();
78
79echo '<body lang="'.CWebUser::getLang().'">';
80