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 = [];
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
40	// perform Zabbix server check only for standard pages
41	if ($config['server_check_interval'] && !empty($ZBX_SERVER) && !empty($ZBX_SERVER_PORT)) {
42		$scripts[] = 'servercheck.js';
43	}
44}
45$pageHeader->addCssFile('styles/'.CHtml::encode($theme).'.css');
46
47$pageHeader->addJsFile('js/browsers.js');
48$pageHeader->addJsBeforeScripts('var PHP_TZ_OFFSET = '.date('Z').';');
49
50// show GUI messages in pages with menus and in fullscreen mode
51$showGuiMessaging = (!defined('ZBX_PAGE_NO_MENU') || $_REQUEST['fullscreen'] == 1) ? 1 : 0;
52$path = 'jsLoader.php?ver='.ZABBIX_VERSION.'&amp;lang='.$data['user']['lang'].'&showGuiMessaging='.$showGuiMessaging;
53$pageHeader->addJsFile($path);
54
55if ($scripts) {
56	$pageHeader->addJsFile('jsLoader.php?'.'files[]='.implode('&amp;files[]=', $scripts));
57}
58
59foreach ($data['javascript']['files'] as $path) {
60	$pageHeader->addJsFile($path);
61}
62
63$pageHeader->display();
64
65echo '<body>';
66echo '<div class="'.ZBX_STYLE_MSG_BAD_GLOBAL.'" id="msg-bad-global"></div>';
67