2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
//
|
2020-04-21 20:30:42 +08:00
|
|
|
// ZoneMinder web function library
|
2008-07-25 17:48:16 +08:00
|
|
|
// Copyright (C) 2001-2008 Philip Coombes
|
2008-07-14 21:54:50 +08:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
2016-12-26 23:23:16 +08:00
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2008-07-14 21:54:50 +08:00
|
|
|
//
|
|
|
|
|
2019-05-29 20:40:48 +08:00
|
|
|
function xhtmlHeaders($file, $title) {
|
2017-06-05 09:42:56 +08:00
|
|
|
global $css;
|
|
|
|
global $skin;
|
2018-02-09 01:29:42 +08:00
|
|
|
global $view;
|
2017-12-22 10:46:21 +08:00
|
|
|
|
|
|
|
# This idea is that we always include the classic css files,
|
|
|
|
# and then any different skin only needs to contain things that are different.
|
2019-05-29 20:40:48 +08:00
|
|
|
$baseCssPhpFile = getSkinFile('css/base/skin.css.php');
|
2017-12-22 10:46:21 +08:00
|
|
|
|
2019-05-29 20:40:48 +08:00
|
|
|
$skinCssPhpFile = getSkinFile('css/'.$css.'/skin.css.php');
|
2014-11-27 00:18:03 +08:00
|
|
|
|
2019-05-29 20:40:48 +08:00
|
|
|
$skinJsPhpFile = getSkinFile('js/skin.js.php');
|
|
|
|
$cssJsFile = getSkinFile('js/'.$css.'.js');
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2019-05-29 20:40:48 +08:00
|
|
|
$basename = basename($file, '.php');
|
2017-12-22 10:46:21 +08:00
|
|
|
|
2019-09-29 02:23:23 +08:00
|
|
|
$baseViewCssPhpFile = getSkinFile('/css/base/views/'.$basename.'.css.php');
|
2019-05-29 20:40:48 +08:00
|
|
|
$viewCssPhpFile = getSkinFile('/css/'.$css.'/views/'.$basename.'.css.php');
|
|
|
|
$viewJsFile = getSkinFile('views/js/'.$basename.'.js');
|
|
|
|
$viewJsPhpFile = getSkinFile('views/js/'.$basename.'.js.php');
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2019-05-29 20:40:48 +08:00
|
|
|
extract($GLOBALS, EXTR_OVERWRITE);
|
|
|
|
|
|
|
|
function output_link_if_exists($files) {
|
2018-02-09 01:29:42 +08:00
|
|
|
global $skin;
|
2017-12-22 10:46:21 +08:00
|
|
|
$html = array();
|
|
|
|
foreach ( $files as $file ) {
|
2019-05-29 20:40:48 +08:00
|
|
|
if ( getSkinFile($file) ) {
|
|
|
|
$html[] = '<link rel="stylesheet" href="'.cache_bust('skins/'.$skin.'/'.$file).'" type="text/css"/>';
|
2017-12-22 10:46:21 +08:00
|
|
|
}
|
|
|
|
}
|
2020-07-26 03:05:12 +08:00
|
|
|
$html[] = ''; // So we ge a trailing \n
|
|
|
|
return implode("\n", $html);
|
|
|
|
}
|
|
|
|
|
|
|
|
function output_cache_busted_stylesheet_links($files) {
|
|
|
|
$html = array();
|
|
|
|
foreach ( $files as $file ) {
|
|
|
|
$html[] = '<link rel="stylesheet" href="'.cache_bust($file).'" type="text/css"/>';
|
|
|
|
}
|
2020-08-03 22:57:08 +08:00
|
|
|
$html[] = ''; // So we ge a trailing \n
|
2017-12-22 10:46:21 +08:00
|
|
|
return implode("\n", $html);
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2016-03-16 12:17:05 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
2008-07-14 21:54:50 +08:00
|
|
|
<head>
|
2016-03-16 12:17:05 +08:00
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
2020-07-26 03:05:12 +08:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
2020-08-03 22:57:08 +08:00
|
|
|
<title><?php echo validHtmlStr(ZM_WEB_TITLE_PREFIX) . ' - ' . validHtmlStr($title) ?></title>
|
2017-10-02 23:55:36 +08:00
|
|
|
<?php
|
2020-07-26 03:05:12 +08:00
|
|
|
if ( file_exists("skins/$skin/css/$css/graphics/favicon.ico") ) {
|
2017-11-03 21:24:13 +08:00
|
|
|
echo "
|
|
|
|
<link rel=\"icon\" type=\"image/ico\" href=\"skins/$skin/css/$css/graphics/favicon.ico\"/>
|
|
|
|
<link rel=\"shortcut icon\" href=\"skins/$skin/css/$css/graphics/favicon.ico\"/>
|
|
|
|
";
|
2017-10-02 23:55:36 +08:00
|
|
|
} else {
|
2017-10-18 01:10:20 +08:00
|
|
|
echo '
|
|
|
|
<link rel="icon" type="image/ico" href="graphics/favicon.ico"/>
|
|
|
|
<link rel="shortcut icon" href="graphics/favicon.ico"/>
|
|
|
|
';
|
2017-10-02 23:55:36 +08:00
|
|
|
}
|
2020-07-26 03:05:12 +08:00
|
|
|
echo output_cache_busted_stylesheet_links(array(
|
|
|
|
'css/reset.css',
|
|
|
|
'css/overlay.css',
|
|
|
|
'css/bootstrap.min.css',
|
|
|
|
));
|
|
|
|
|
2020-08-03 22:57:08 +08:00
|
|
|
echo output_link_if_exists(array(
|
2018-01-11 23:57:07 +08:00
|
|
|
'css/base/skin.css',
|
|
|
|
'css/base/views/'.$basename.'.css',
|
2018-12-05 22:05:10 +08:00
|
|
|
'js/dateTimePicker/jquery-ui-timepicker-addon.css',
|
|
|
|
'js/jquery-ui-1.12.1/jquery-ui.structure.min.css',
|
2020-08-03 22:57:08 +08:00
|
|
|
));
|
2019-06-23 02:10:55 +08:00
|
|
|
if ( $css != 'base' )
|
2020-08-03 22:57:08 +08:00
|
|
|
echo output_link_if_exists(array(
|
2019-06-23 02:10:55 +08:00
|
|
|
'css/'.$css.'/skin.css',
|
|
|
|
'css/'.$css.'/views/'.$basename.'.css',
|
|
|
|
'css/'.$css.'/jquery-ui-theme.css',
|
2020-08-03 22:57:08 +08:00
|
|
|
));
|
2018-01-13 03:25:15 +08:00
|
|
|
?>
|
2020-08-03 22:57:08 +08:00
|
|
|
<link rel="stylesheet" href="skins/classic/js/jquery-ui-1.12.1/jquery-ui.theme.min.css" type="text/css"/>
|
|
|
|
<?php #Chosen can't be cache-busted because it loads sprites by relative path ?>
|
|
|
|
<link rel="stylesheet" href="skins/classic/js/chosen/chosen.min.css" type="text/css"/>
|
2018-01-13 03:25:15 +08:00
|
|
|
<?php
|
2019-02-13 05:41:08 +08:00
|
|
|
if ( $basename == 'watch' ) {
|
2020-02-25 02:13:54 +08:00
|
|
|
echo output_link_if_exists(array('/css/base/views/control.css'));
|
|
|
|
if ( $css != 'base' )
|
|
|
|
echo output_link_if_exists(array('/css/'.$css.'/views/control.css'));
|
2017-05-31 23:16:55 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<style type="text/css">
|
|
|
|
<?php
|
2019-09-29 02:23:23 +08:00
|
|
|
if ( $baseViewCssPhpFile ) {
|
|
|
|
require_once($baseViewCssPhpFile);
|
|
|
|
}
|
|
|
|
if ( $viewCssPhpFile ) {
|
2019-02-13 05:41:08 +08:00
|
|
|
require_once($viewCssPhpFile);
|
2019-09-29 02:23:23 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
</style>
|
2017-12-22 10:46:21 +08:00
|
|
|
|
2020-08-03 22:57:08 +08:00
|
|
|
<?php if ( $basename != 'login' and $basename != 'postlogin' ) { ?>
|
2018-04-06 23:43:19 +08:00
|
|
|
<script src="tools/mootools/mootools-core.js"></script>
|
|
|
|
<script src="tools/mootools/mootools-more.js"></script>
|
|
|
|
<script src="js/mootools.ext.js"></script>
|
2020-04-25 00:23:48 +08:00
|
|
|
<?php } ?>
|
2018-04-06 23:43:19 +08:00
|
|
|
<script src="skins/<?php echo $skin; ?>/js/jquery.js"></script>
|
|
|
|
<script src="skins/<?php echo $skin; ?>/js/jquery-ui-1.12.1/jquery-ui.js"></script>
|
|
|
|
<script src="skins/<?php echo $skin; ?>/js/bootstrap.min.js"></script>
|
|
|
|
<script src="skins/<?php echo $skin; ?>/js/chosen/chosen.jquery.min.js"></script>
|
|
|
|
<script src="skins/<?php echo $skin; ?>/js/dateTimePicker/jquery-ui-timepicker-addon.js"></script>
|
2017-12-16 11:57:42 +08:00
|
|
|
|
2018-07-10 02:10:06 +08:00
|
|
|
<script src="<?php echo cache_bust('js/Server.js'); ?>"></script>
|
2019-01-16 22:59:58 +08:00
|
|
|
<script nonce="<?php echo $cspNonce; ?>">
|
2019-01-19 23:32:40 +08:00
|
|
|
jQuery(document).ready(function() {
|
|
|
|
jQuery("#flip").click(function() {
|
2018-09-12 05:39:40 +08:00
|
|
|
jQuery("#panel").slideToggle("slow");
|
2019-12-03 01:33:13 +08:00
|
|
|
var flip = jQuery("#flip");
|
|
|
|
if ( flip.html() == 'keyboard_arrow_up' ) {
|
|
|
|
flip.html('keyboard_arrow_down');
|
|
|
|
Cookie.write('zmHeaderFlip', 'down', {duration: 10*365} );
|
|
|
|
} else {
|
|
|
|
flip.html('keyboard_arrow_up');
|
|
|
|
Cookie.write('zmHeaderFlip', 'up', {duration: 10*365} );
|
|
|
|
}
|
2018-09-12 05:39:40 +08:00
|
|
|
});
|
2020-07-28 05:14:15 +08:00
|
|
|
jQuery("#fbflip").click(function() {
|
|
|
|
jQuery("#fbpanel").slideToggle("slow");
|
|
|
|
var fbflip = jQuery("#fbflip");
|
|
|
|
if ( fbflip.html() == 'keyboard_arrow_up' ) {
|
|
|
|
fbflip.html('keyboard_arrow_down');
|
|
|
|
Cookie.write('zmFilterBarFlip', 'down', {duration: 10*365} );
|
|
|
|
} else {
|
|
|
|
fbflip.html('keyboard_arrow_up');
|
|
|
|
Cookie.write('zmFilterBarFlip', 'up', {duration: 10*365} );
|
2020-07-28 21:38:06 +08:00
|
|
|
jQuery('.chosen').chosen("destroy");
|
|
|
|
jQuery('.chosen').chosen();
|
2020-07-28 05:14:15 +08:00
|
|
|
}
|
|
|
|
});
|
2020-08-01 23:57:13 +08:00
|
|
|
jQuery(document).click(function(event) {
|
2020-08-02 05:20:51 +08:00
|
|
|
var target = jQuery(event.target);
|
|
|
|
var _mobileMenuOpen = jQuery("#main-header-nav").hasClass("show");
|
|
|
|
if (_mobileMenuOpen === true && !target.hasClass("navbar-toggler")) {
|
|
|
|
jQuery("button.navbar-toggler").click();
|
|
|
|
}
|
2020-08-01 23:57:13 +08:00
|
|
|
});
|
2018-09-12 05:39:40 +08:00
|
|
|
});
|
2017-06-16 00:13:40 +08:00
|
|
|
var $j = jQuery.noConflict();
|
|
|
|
// $j is now an alias to the jQuery function; creating the new alias is optional.
|
|
|
|
</script>
|
2019-01-31 03:36:46 +08:00
|
|
|
<script src="<?php echo cache_bust('skins/'.$skin.'/views/js/state.js') ?>"></script>
|
2017-06-16 00:13:40 +08:00
|
|
|
<?php
|
2020-04-21 20:30:42 +08:00
|
|
|
if ( $view == 'event' ) {
|
2016-10-28 05:05:33 +08:00
|
|
|
?>
|
2017-05-19 03:10:13 +08:00
|
|
|
<link href="skins/<?php echo $skin ?>/js/video-js.css" rel="stylesheet">
|
2017-10-04 07:28:06 +08:00
|
|
|
<link href="skins/<?php echo $skin ?>/js/video-js-skin.css" rel="stylesheet">
|
2017-05-19 03:10:13 +08:00
|
|
|
<script src="skins/<?php echo $skin ?>/js/video.js"></script>
|
|
|
|
<script src="./js/videojs.zoomrotate.js"></script>
|
2017-12-10 00:14:10 +08:00
|
|
|
<?php
|
2018-04-11 04:06:01 +08:00
|
|
|
}
|
2018-02-09 01:29:42 +08:00
|
|
|
?>
|
|
|
|
<script src="skins/<?php echo $skin ?>/js/moment.min.js"></script>
|
|
|
|
<?php
|
2017-05-31 23:16:55 +08:00
|
|
|
if ( $skinJsPhpFile ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2019-01-16 22:59:58 +08:00
|
|
|
<script nonce="<?php echo $cspNonce; ?>">
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
require_once( $skinJsPhpFile );
|
|
|
|
?>
|
|
|
|
</script>
|
|
|
|
<?php
|
2017-05-31 23:16:55 +08:00
|
|
|
}
|
|
|
|
if ( $viewJsPhpFile ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2019-01-16 22:59:58 +08:00
|
|
|
<script nonce="<?php echo $cspNonce; ?>">
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2017-05-31 23:16:55 +08:00
|
|
|
require_once( $viewJsPhpFile );
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
</script>
|
|
|
|
<?php
|
2017-05-31 23:16:55 +08:00
|
|
|
}
|
2015-05-02 04:03:40 +08:00
|
|
|
if ( $cssJsFile ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2018-04-06 23:43:19 +08:00
|
|
|
<script src="<?php echo cache_bust($cssJsFile) ?>"></script>
|
2017-10-03 00:39:39 +08:00
|
|
|
<?php
|
|
|
|
} else {
|
|
|
|
?>
|
2019-03-26 04:24:46 +08:00
|
|
|
<script src="<?php echo cache_bust('skins/classic/js/base.js') ?>"></script>
|
2020-01-18 03:51:02 +08:00
|
|
|
<?php }
|
2020-01-19 05:08:55 +08:00
|
|
|
$skinJsFile = getSkinFile('js/skin.js');
|
2020-01-18 03:51:02 +08:00
|
|
|
?>
|
2020-01-19 05:08:55 +08:00
|
|
|
<script src="<?php echo cache_bust($skinJsFile) ?>"></script>
|
2019-04-26 22:25:32 +08:00
|
|
|
<script src="<?php echo cache_bust('js/logger.js')?>"></script>
|
2018-09-23 22:51:46 +08:00
|
|
|
<?php
|
2018-11-13 04:09:15 +08:00
|
|
|
if ($basename == 'watch' or $basename == 'log' ) {
|
2018-09-23 22:51:46 +08:00
|
|
|
// This is used in the log popup for the export function. Not sure if it's used anywhere else
|
|
|
|
?>
|
2019-04-26 22:25:32 +08:00
|
|
|
<script src="<?php echo cache_bust('js/overlay.js') ?>"></script>
|
2018-09-23 22:51:46 +08:00
|
|
|
<?php } ?>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2017-05-31 23:16:55 +08:00
|
|
|
if ( $viewJsFile ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2019-03-06 03:33:03 +08:00
|
|
|
<script src="<?php echo cache_bust($viewJsFile) ?>"></script>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2017-05-31 23:16:55 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
</head>
|
|
|
|
<?php
|
2017-06-16 00:13:40 +08:00
|
|
|
} // end function xhtmlHeaders( $file, $title )
|
2016-05-07 02:30:32 +08:00
|
|
|
|
2018-11-08 01:33:54 +08:00
|
|
|
// Outputs an opening body tag, and any additional content that should go at the very top, like warnings and error messages.
|
|
|
|
function getBodyTopHTML() {
|
|
|
|
echo '
|
|
|
|
<body>
|
|
|
|
<noscript>
|
|
|
|
<div style="background-color:red;color:white;font-size:x-large;">
|
2019-02-10 10:06:21 +08:00
|
|
|
'. validHtmlStr(ZM_WEB_TITLE) .' requires Javascript. Please enable Javascript in your browser for this site.
|
2018-11-08 01:33:54 +08:00
|
|
|
|
|
|
|
</div>
|
|
|
|
</noscript>
|
|
|
|
';
|
|
|
|
global $error_message;
|
|
|
|
if ( $error_message ) {
|
|
|
|
echo '<div class="error">'.$error_message.'</div>';
|
|
|
|
}
|
|
|
|
} // end function getBodyTopHTML
|
|
|
|
|
2020-08-03 02:01:20 +08:00
|
|
|
function getNavBarHTML() {
|
2019-02-12 06:14:33 +08:00
|
|
|
# Provide a facility to turn off the headers if you put navbar=0 into the url
|
2020-07-28 00:15:37 +08:00
|
|
|
if ( isset($_REQUEST['navbar']) and $_REQUEST['navbar'] == '0' )
|
2018-10-11 02:02:46 +08:00
|
|
|
return '';
|
2017-10-05 09:51:30 +08:00
|
|
|
|
2016-10-21 01:38:12 +08:00
|
|
|
global $running;
|
2016-05-07 03:16:48 +08:00
|
|
|
global $user;
|
2017-10-10 22:38:13 +08:00
|
|
|
global $bandwidth_options;
|
2017-10-02 23:25:51 +08:00
|
|
|
global $view;
|
2017-12-02 23:09:19 +08:00
|
|
|
global $filterQuery;
|
2017-12-14 11:24:55 +08:00
|
|
|
global $sortQuery;
|
2017-12-15 21:45:49 +08:00
|
|
|
global $limitQuery;
|
2017-12-14 11:24:55 +08:00
|
|
|
|
2020-08-03 22:57:08 +08:00
|
|
|
if ( !$sortQuery ) {
|
2017-12-14 11:24:55 +08:00
|
|
|
parseSort();
|
|
|
|
}
|
2019-03-21 02:27:23 +08:00
|
|
|
if ( (!$filterQuery) and isset($_REQUEST['filter']) ) {
|
|
|
|
parseFilter($_REQUEST['filter']);
|
2017-12-02 23:09:19 +08:00
|
|
|
$filterQuery = $_REQUEST['filter']['query'];
|
|
|
|
}
|
2020-07-31 05:44:58 +08:00
|
|
|
|
2020-08-03 02:01:20 +08:00
|
|
|
ob_start();
|
2020-08-02 05:16:23 +08:00
|
|
|
|
2020-08-01 05:03:37 +08:00
|
|
|
if ( ZM_WEB_NAVBAR_TYPE == "normal" ) {
|
2020-08-03 02:01:20 +08:00
|
|
|
echo getNormalNavBarHTML($running, $user, $bandwidth_options, $view, $filterQuery, $sortQuery, $limitQuery);
|
2020-07-31 05:44:58 +08:00
|
|
|
} else {
|
2020-08-03 02:01:20 +08:00
|
|
|
echo getCollapsedNavBarHTML($running, $user, $bandwidth_options, $view, $filterQuery, $sortQuery, $limitQuery);
|
2020-07-31 05:44:58 +08:00
|
|
|
}
|
|
|
|
|
2020-08-02 05:16:23 +08:00
|
|
|
return ob_get_clean();
|
2020-07-31 05:44:58 +08:00
|
|
|
}
|
|
|
|
|
2020-08-01 05:03:37 +08:00
|
|
|
//
|
2020-07-31 05:44:58 +08:00
|
|
|
// The legacy navigation bar that collapses into a pulldown menu on small screens.
|
2020-08-01 05:03:37 +08:00
|
|
|
//
|
2020-08-03 02:01:20 +08:00
|
|
|
function getNormalNavBarHTML($running, $user, $bandwidth_options, $view, $filterQuery, $sortQuery, $limitQuery) {
|
2020-07-31 05:44:58 +08:00
|
|
|
|
2020-08-03 02:01:20 +08:00
|
|
|
$status = runtimeStatus($running);
|
2020-07-24 01:52:21 +08:00
|
|
|
|
2016-05-07 02:30:32 +08:00
|
|
|
?>
|
2020-08-03 02:48:15 +08:00
|
|
|
<div class="fixed-top container-fluid p-0">
|
2020-07-26 02:18:09 +08:00
|
|
|
<nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-center flex-row">
|
|
|
|
|
2020-07-29 01:20:18 +08:00
|
|
|
<div class="navbar-brand justify-content-start align-self-start">
|
2020-07-26 02:18:09 +08:00
|
|
|
<?php echo getNavBrandHTML() ?>
|
2020-07-23 02:12:59 +08:00
|
|
|
</div>
|
2020-07-26 02:18:09 +08:00
|
|
|
|
|
|
|
<!-- the Navigation Bar Hamburger Button -->
|
2020-07-27 23:13:02 +08:00
|
|
|
<div class="nav justify-content-end flex-grow-1">
|
|
|
|
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#main-header-nav" aria-expanded="false">
|
|
|
|
<span class="sr-only">Toggle navigation</span>
|
|
|
|
<span class="navbar-toggler-icon"></span>
|
|
|
|
</button>
|
|
|
|
</div>
|
2020-07-26 02:18:09 +08:00
|
|
|
|
2020-07-23 02:12:59 +08:00
|
|
|
<div class="collapse navbar-collapse" id="main-header-nav">
|
2019-12-03 01:33:13 +08:00
|
|
|
<?php
|
2020-07-24 01:52:21 +08:00
|
|
|
|
|
|
|
// *** Build the navigation bar menu items ***
|
|
|
|
if ( $user and $user['Username'] ) {
|
2020-07-31 05:56:38 +08:00
|
|
|
echo '<ul class="navbar-nav align-self-start justify-content-center">';
|
2020-07-26 02:18:09 +08:00
|
|
|
echo getConsoleHTML();
|
|
|
|
echo getOptionsHTML();
|
|
|
|
echo getLogHTML();
|
|
|
|
echo getDevicesHTML();
|
2020-07-31 05:14:41 +08:00
|
|
|
echo getGroupsHTML($view);
|
2020-08-03 22:57:08 +08:00
|
|
|
echo getFilterHTML($view, $filterQuery, $sortQuery, $limitQuery);
|
2020-07-31 05:14:41 +08:00
|
|
|
echo getCycleHTML($view);
|
|
|
|
echo getMontageHTML($view);
|
|
|
|
echo getMontageReviewHTML($view);
|
|
|
|
echo getRprtEvntAuditHTML($view);
|
2020-07-26 02:18:09 +08:00
|
|
|
echo getHeaderFlipHTML();
|
2020-07-24 01:52:21 +08:00
|
|
|
echo '</ul>';
|
|
|
|
|
2020-07-29 01:20:18 +08:00
|
|
|
echo '<ul class="nav navbar-nav justify-content-end align-self-start flex-grow-1">';
|
2020-07-24 01:52:21 +08:00
|
|
|
echo getAcctCircleHTML($user);
|
|
|
|
echo getStatusBtnHTML($status);
|
|
|
|
echo '</ul>';
|
2020-07-26 02:18:09 +08:00
|
|
|
}
|
2020-07-24 01:52:21 +08:00
|
|
|
?>
|
2020-07-26 02:18:09 +08:00
|
|
|
</div>
|
|
|
|
</nav><!-- End First Navbar -->
|
|
|
|
|
|
|
|
<nav class="navbar navbar-expand-md bg-dark justify-content-center p-0">
|
|
|
|
<div class="container-fluid" id="panel"<?php echo ( isset($_COOKIE['zmHeaderFlip']) and $_COOKIE['zmHeaderFlip'] == 'down' ) ? 'style="display:none;"' : '' ?>>
|
2017-12-02 11:15:29 +08:00
|
|
|
<?php
|
2020-07-24 01:52:21 +08:00
|
|
|
|
2020-07-28 00:15:37 +08:00
|
|
|
if ( (!ZM_OPT_USE_AUTH) or $user ) {
|
2020-07-24 01:52:21 +08:00
|
|
|
|
|
|
|
// *** Build the statistics shown on the navigation bar ***
|
2017-12-02 11:15:29 +08:00
|
|
|
?>
|
2020-07-28 00:15:37 +08:00
|
|
|
<div id="reload" class="container-fluid">
|
|
|
|
<ul id="Bandwidth" class="navbar-nav justify-content-start">
|
|
|
|
<?php echo getBandwidthHTML($bandwidth_options, $user) ?>
|
|
|
|
</ul>
|
|
|
|
|
2020-08-01 05:03:37 +08:00
|
|
|
<ul class="navbar-nav list-inline justify-content-center">
|
2020-07-28 00:15:37 +08:00
|
|
|
<?php
|
|
|
|
echo getSysLoadHTML();
|
|
|
|
echo getDbConHTML();
|
|
|
|
echo getStorageHTML();
|
|
|
|
echo getShmHTML();
|
2020-08-03 03:49:19 +08:00
|
|
|
echo getLogIconHTML();
|
2020-07-28 00:15:37 +08:00
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<ul id="Version" class="nav navbar-nav justify-content-end">
|
2020-07-31 20:31:40 +08:00
|
|
|
<?php echo getZMVersionHTML() ?>
|
2020-07-28 00:15:37 +08:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
} // end if (!ZM_OPT_USE_AUTH) or $user )
|
|
|
|
?>
|
2020-07-31 00:55:54 +08:00
|
|
|
</div><!-- End Collapsible Panel -->
|
2020-07-26 02:18:09 +08:00
|
|
|
</nav><!-- End Second Navbar -->
|
2020-08-03 02:48:15 +08:00
|
|
|
|
|
|
|
<nav class="navbar navbar-expand-md bg-dark justify-content-center p-0">
|
|
|
|
<?php echo getConsoleBannerHTML() ?>
|
|
|
|
</nav><!-- End Third Navbar -->
|
2020-07-26 02:18:09 +08:00
|
|
|
</div>
|
2020-07-23 02:12:59 +08:00
|
|
|
<?php
|
2020-07-31 05:44:58 +08:00
|
|
|
} // end function getNormalNavBarHTML()
|
2020-07-24 01:52:21 +08:00
|
|
|
|
2020-07-31 05:44:58 +08:00
|
|
|
//
|
2020-08-01 05:03:37 +08:00
|
|
|
// A new, slimmer navigation bar, permanently collapsed into a dropdown
|
2020-07-31 05:44:58 +08:00
|
|
|
//
|
2020-08-03 02:01:20 +08:00
|
|
|
function getCollapsedNavBarHTML($running, $user, $bandwidth_options, $view, $filterQuery, $sortQuery, $limitQuery) {
|
2020-08-01 22:07:21 +08:00
|
|
|
|
2020-08-03 02:01:20 +08:00
|
|
|
$status = runtimeStatus($running);
|
2020-08-01 22:07:21 +08:00
|
|
|
|
2020-08-01 05:03:37 +08:00
|
|
|
?>
|
2020-08-03 02:48:15 +08:00
|
|
|
<div class="fixed-top container-fluid p-0">
|
|
|
|
<nav class="navbar navbar-dark bg-dark px-1 flex-nowrap">
|
2020-08-01 05:03:37 +08:00
|
|
|
|
|
|
|
<div class="navbar-brand align-self-start px-0">
|
|
|
|
<?php echo getNavBrandHTML() ?>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<nav class="navbar navbar-expand-md align-self-start px-0">
|
|
|
|
<ul class="nav navbar-nav list-group px-0">
|
|
|
|
<?php
|
|
|
|
|
2020-08-01 22:07:21 +08:00
|
|
|
// *** Build the statistics shown on the navigation bar ***
|
|
|
|
if ( (!ZM_OPT_USE_AUTH) or $user ) {
|
2020-08-01 05:03:37 +08:00
|
|
|
?>
|
2020-08-01 22:07:21 +08:00
|
|
|
<div id="reload" class="collapse navbar-collapse px-0">
|
2020-08-01 05:03:37 +08:00
|
|
|
|
|
|
|
<ul id="Version" class="pr-2">
|
|
|
|
<?php echo getZMVersionHTML() ?>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<ul id="Bandwidth" class="px-2">
|
|
|
|
<?php echo getBandwidthHTML($bandwidth_options, $user) ?>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
echo getSysLoadHTML();
|
|
|
|
echo getDbConHTML();
|
|
|
|
echo getStorageHTML();
|
|
|
|
echo getShmHTML();
|
2020-08-03 03:49:19 +08:00
|
|
|
echo getLogIconHTML();
|
2020-08-01 05:03:37 +08:00
|
|
|
?>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2020-08-01 22:07:21 +08:00
|
|
|
<?php
|
|
|
|
} // end if (!ZM_OPT_USE_AUTH) or $user )
|
|
|
|
?>
|
2020-08-01 05:03:37 +08:00
|
|
|
</nav>
|
|
|
|
|
|
|
|
<ul class="list-group list-group-horizontal ml-auto">
|
|
|
|
<?php
|
|
|
|
echo getAcctCircleHTML($user);
|
|
|
|
echo getStatusBtnHTML($status);
|
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<!-- the Navigation Bar Hamburger Button -->
|
2020-08-01 22:07:21 +08:00
|
|
|
<?php if ( (!ZM_OPT_USE_AUTH) or $user ) { ?>
|
2020-08-02 05:16:23 +08:00
|
|
|
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#main-header-nav" aria-haspopup="true" aria-expanded="false">
|
2020-08-01 05:03:37 +08:00
|
|
|
<span class="sr-only">Toggle navigation</span>
|
|
|
|
<span class="navbar-toggler-icon"></span>
|
|
|
|
</button>
|
2020-08-01 22:07:21 +08:00
|
|
|
<?php } ?>
|
2020-08-01 05:03:37 +08:00
|
|
|
|
|
|
|
<div style="background-color:#485460" class="dropdown-menu dropdown-menu-right px-3" id="main-header-nav">
|
|
|
|
<?php
|
|
|
|
if ( $user and $user['Username'] ) {
|
|
|
|
echo '<ul class="navbar-nav">';
|
|
|
|
echo getConsoleHTML();
|
|
|
|
echo getOptionsHTML();
|
|
|
|
echo getLogHTML();
|
|
|
|
echo getDevicesHTML();
|
|
|
|
echo getGroupsHTML($view);
|
|
|
|
echo getFilterHTML($view,$filterQuery,$sortQuery,$limitQuery);
|
|
|
|
echo getCycleHTML($view);
|
|
|
|
echo getMontageHTML($view);
|
|
|
|
echo getMontageReviewHTML($view);
|
|
|
|
echo getRprtEvntAuditHTML($view);
|
|
|
|
echo '</ul>';
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
|
2020-08-03 02:48:15 +08:00
|
|
|
</nav><!-- End First Navbar -->
|
2020-08-01 05:03:37 +08:00
|
|
|
|
2020-08-03 02:48:15 +08:00
|
|
|
<nav class="navbar navbar-expand-md bg-dark justify-content-center p-0">
|
|
|
|
<?php echo getConsoleBannerHTML() ?>
|
|
|
|
</nav><!-- End Second Navbar -->
|
|
|
|
</div>
|
|
|
|
|
2020-08-01 05:03:37 +08:00
|
|
|
<?php
|
2020-07-31 05:44:58 +08:00
|
|
|
} // End function getCollapsedNavBarHTML
|
2020-07-23 02:12:59 +08:00
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
// Returns the html representing the current unix style system load
|
2020-07-23 02:12:59 +08:00
|
|
|
function getSysLoadHTML() {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-07-23 02:12:59 +08:00
|
|
|
|
2020-08-03 00:31:36 +08:00
|
|
|
$result .= '<li id="getSysLoadHTML" class="Load nav-item mx-2">'.PHP_EOL;
|
|
|
|
$result .= '<i class="material-icons md-18">trending_up</i>'.PHP_EOL;
|
|
|
|
$result .= ' '.translate('Load').': '.getLoad().PHP_EOL;
|
|
|
|
$result .= '</li>'.PHP_EOL;
|
|
|
|
|
|
|
|
return $result;
|
2020-07-23 02:12:59 +08:00
|
|
|
}
|
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
// Returns the html representing the current number of connections made to the database
|
2020-07-23 02:12:59 +08:00
|
|
|
function getDbConHTML() {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2019-12-14 06:47:51 +08:00
|
|
|
$connections = dbFetchOne('SHOW status WHERE variable_name=\'threads_connected\'', 'Value');
|
|
|
|
$max_connections = dbFetchOne('SHOW variables WHERE variable_name=\'max_connections\'', 'Value');
|
2018-10-29 21:59:26 +08:00
|
|
|
$percent_used = $max_connections ? 100 * $connections / $max_connections : 100;
|
2020-08-03 22:57:08 +08:00
|
|
|
$class = ( $percent_used > 90 ) ? ' text-warning' : '';
|
2020-07-23 02:12:59 +08:00
|
|
|
|
2020-08-03 22:57:08 +08:00
|
|
|
$result .= '<li id="getDbConHTML" class="nav-item dropdown mx-2' .$class. '">'.PHP_EOL;
|
2020-08-03 00:31:36 +08:00
|
|
|
$result .= '<i class="material-icons md-18 mr-1">storage</i>'.PHP_EOL;
|
|
|
|
$result .= translate('DB'). ': ' .$connections. '/' .$max_connections.PHP_EOL;
|
|
|
|
$result .= '</li>'.PHP_EOL;
|
|
|
|
|
|
|
|
return $result;
|
2020-07-23 02:12:59 +08:00
|
|
|
}
|
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
// Returns the html representing up to 4 storage areas and their current capacity
|
2020-07-23 02:12:59 +08:00
|
|
|
function getStorageHTML() {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-07-23 02:12:59 +08:00
|
|
|
|
|
|
|
$func = function($S) {
|
2018-04-18 05:14:40 +08:00
|
|
|
$class = '';
|
|
|
|
if ( $S->disk_usage_percent() > 98 ) {
|
2020-07-26 23:41:05 +08:00
|
|
|
$class = 'text-danger';
|
2018-04-18 05:14:40 +08:00
|
|
|
} else if ( $S->disk_usage_percent() > 90 ) {
|
2020-07-26 23:41:05 +08:00
|
|
|
$class = 'text-warning';
|
2018-04-18 05:14:40 +08:00
|
|
|
}
|
|
|
|
$title = human_filesize($S->disk_used_space()) . ' of ' . human_filesize($S->disk_total_space()).
|
|
|
|
( ( $S->disk_used_space() != $S->event_disk_space() ) ? ' ' .human_filesize($S->event_disk_space()) . ' used by events' : '' );
|
2020-08-03 02:01:20 +08:00
|
|
|
return '<span class="ml-1 '.$class.'" title="'.$title.'">'.$S->Name() . ': ' . $S->disk_usage_percent().'%' . '</span>';
|
2020-07-23 02:12:59 +08:00
|
|
|
};
|
2018-04-18 05:14:40 +08:00
|
|
|
|
2020-07-23 02:12:59 +08:00
|
|
|
$storage_areas = ZM\Storage::find(array('Enabled'=>true));
|
|
|
|
$num_storage_areas = count($storage_areas);
|
|
|
|
$storage_paths = null;
|
|
|
|
$storage_areas_with_no_server_id = array();
|
|
|
|
foreach ( $storage_areas as $area ) {
|
|
|
|
$storage_paths[$area->Path()] = $area;
|
|
|
|
if ( ! $area->ServerId() ) {
|
|
|
|
$storage_areas_with_no_server_id[] = $area;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-03 00:31:36 +08:00
|
|
|
$result .= '<li id="getStorageHTML" class="nav-item dropdown mx-2">'.translate('Storage').':';
|
2020-07-23 02:12:59 +08:00
|
|
|
|
|
|
|
if ( $num_storage_areas > 4 ) {
|
2019-12-14 06:47:51 +08:00
|
|
|
$storage_areas = $storage_areas_with_no_server_id;
|
2020-07-23 02:12:59 +08:00
|
|
|
} else {
|
2020-08-03 00:31:36 +08:00
|
|
|
$result .= implode(', ', array_map($func, $storage_areas));
|
2020-07-23 02:12:59 +08:00
|
|
|
}
|
2020-08-03 00:31:36 +08:00
|
|
|
$result .= '</li>'.PHP_EOL;
|
|
|
|
|
|
|
|
return $result;
|
2020-07-23 02:12:59 +08:00
|
|
|
}
|
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
// Returns the html representing the current capacity of mapped memory filesystem (usually /dev/shm)
|
2020-07-23 02:12:59 +08:00
|
|
|
function getShmHTML() {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-02-11 03:20:46 +08:00
|
|
|
$shm_percent = getDiskPercent(ZM_PATH_MAP);
|
2020-05-22 01:32:33 +08:00
|
|
|
$shm_total_space = disk_total_space(ZM_PATH_MAP);
|
2020-05-22 01:34:09 +08:00
|
|
|
$shm_used = $shm_total_space - disk_free_space(ZM_PATH_MAP);
|
2020-05-22 01:32:33 +08:00
|
|
|
|
2020-02-11 03:20:46 +08:00
|
|
|
$class = '';
|
|
|
|
if ( $shm_percent > 98 ) {
|
2020-07-26 23:41:05 +08:00
|
|
|
$class = 'text-danger';
|
2020-02-11 03:20:46 +08:00
|
|
|
} else if ( $shm_percent > 90 ) {
|
2020-07-26 23:41:05 +08:00
|
|
|
$class = 'text-warning';
|
2020-02-11 03:20:46 +08:00
|
|
|
}
|
2020-08-03 00:31:36 +08:00
|
|
|
$result .= ' <li id="getShmHTML" class="nav-item dropdown ' .$class. '" title="' .human_filesize($shm_used). ' of ' .human_filesize($shm_total_space). '">' .ZM_PATH_MAP. ': '.$shm_percent.'%</li>'.PHP_EOL;
|
|
|
|
|
|
|
|
return $result;
|
2020-07-23 02:12:59 +08:00
|
|
|
}
|
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
// Returns the html representing the optional web console banner text
|
2020-07-23 02:12:59 +08:00
|
|
|
function getConsoleBannerHTML() {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-07-23 02:12:59 +08:00
|
|
|
|
|
|
|
if ( defined('ZM_WEB_CONSOLE_BANNER') and ZM_WEB_CONSOLE_BANNER != '' ) {
|
2020-08-03 02:48:15 +08:00
|
|
|
$result .= '<h2 id="getConsoleBannerHTML">'.validHtmlStr(ZM_WEB_CONSOLE_BANNER).'</h2>';
|
2020-07-23 02:12:59 +08:00
|
|
|
}
|
2020-08-03 00:31:36 +08:00
|
|
|
return $result;
|
2020-07-23 02:12:59 +08:00
|
|
|
}
|
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
// Returns the html representing the current high,medium,low bandwidth setting
|
2020-08-03 22:57:08 +08:00
|
|
|
function getBandwidthHTML($bandwidth_options, $user) {
|
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-08-03 22:57:08 +08:00
|
|
|
$result .= '<li id="getBandwidthHTML" class="nav-item dropdown">'.
|
|
|
|
makePopupLink('?view=bandwidth', 'zmBandwidth', 'bandwidth', "<i class='material-icons md-18'>network_check</i> ".$bandwidth_options[$_COOKIE['zmBandwidth']] . ' ', ($user && $user['MaxBandwidth'] != 'low' )).
|
|
|
|
'</li>'.PHP_EOL;
|
2020-08-03 00:31:36 +08:00
|
|
|
|
|
|
|
return $result;
|
2020-07-23 02:12:59 +08:00
|
|
|
}
|
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
// Returns the html representing the version of ZoneMinder
|
2020-07-31 20:31:40 +08:00
|
|
|
function getZMVersionHTML() {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-07-31 20:31:40 +08:00
|
|
|
$class = (ZM_DYN_DB_VERSION&&(ZM_DYN_DB_VERSION!=ZM_VERSION))?'text-danger':'';
|
2020-08-03 22:57:08 +08:00
|
|
|
$result .= '<li id="getZMVersionHTML" class="nav-item dropdown">'.
|
|
|
|
makePopupLink('?view=version', 'zmVersion', 'version', '<span class="version ' .$class. '">v' .ZM_VERSION. '</span>', canEdit('System')).
|
|
|
|
'</li>'.PHP_EOL;
|
2020-08-03 00:31:36 +08:00
|
|
|
|
|
|
|
return $result;
|
2020-07-23 02:12:59 +08:00
|
|
|
}
|
2017-07-13 22:07:23 +08:00
|
|
|
|
2020-07-24 01:52:21 +08:00
|
|
|
// Returns the html representing the ZoneMinder logo
|
|
|
|
function getNavBrandHTML() {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
|
|
|
$result .= '<a id="getNavBrandHTML" href="' .validHtmlStr(ZM_HOME_URL). '" target="' .validHtmlStr(ZM_WEB_TITLE). '">' .ZM_HOME_CONTENT. '</a>'.PHP_EOL;
|
|
|
|
|
|
|
|
return $result;
|
2020-07-24 01:52:21 +08:00
|
|
|
}
|
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
// Returns the html representing the Console menu item
|
|
|
|
function getConsoleHTML() {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
if ( canView('Monitors') ) {
|
2020-08-03 00:31:36 +08:00
|
|
|
$result .= '<li id="getConsoleHTML" class="nav-item dropdown"><a class="nav-link" href="?view=console">'.translate('Console').'</a></li>'.PHP_EOL;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
2020-08-03 00:31:36 +08:00
|
|
|
|
|
|
|
return $result;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the html representing the Options menu item
|
|
|
|
function getOptionsHTML() {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
if ( canView('System') ) {
|
2020-08-03 00:31:36 +08:00
|
|
|
$result .= '<li id="getOptionsHTML" class="nav-item dropdown"><a class="nav-link" href="?view=options">'.translate('Options').'</a></li>'.PHP_EOL;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
2020-08-03 00:31:36 +08:00
|
|
|
|
|
|
|
return $result;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the html representing the Log menu item
|
|
|
|
function getLogHTML() {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
if ( canView('System') ) {
|
|
|
|
if ( ZM\logToDatabase() > ZM\Logger::NOLOG ) {
|
2020-07-26 23:41:05 +08:00
|
|
|
$logstate = logState();
|
2020-07-30 03:42:06 +08:00
|
|
|
$class = ($logstate == 'ok') ? 'text-success' : ($logstate == 'alert' ? 'text-warning' : (($logstate == 'alarm' ? 'text-danger' : '')));
|
2020-08-03 02:01:20 +08:00
|
|
|
$result .= '<li id="getLogHTML" class="nav-item dropdown">'.makePopupLink('?view=log', 'zmLog', 'log', '<span class="nav-link '.$class.'">'.translate('Log').'</span>').'</li>'.PHP_EOL;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
|
|
|
}
|
2020-08-03 00:31:36 +08:00
|
|
|
|
|
|
|
return $result;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
|
|
|
|
2020-08-03 03:49:19 +08:00
|
|
|
// Returns the html representing the log icon
|
|
|
|
function getLogIconHTML() {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 03:49:19 +08:00
|
|
|
|
|
|
|
if ( canView('System') ) {
|
|
|
|
if ( ZM\logToDatabase() > ZM\Logger::NOLOG ) {
|
|
|
|
$logstate = logState();
|
|
|
|
$class = ($logstate == 'ok') ? 'text-success' : ($logstate == 'alert' ? 'text-warning' : (($logstate == 'alarm' ? 'text-danger' : '')));
|
2020-08-03 22:57:08 +08:00
|
|
|
$result .= '<li id="getLogIconHTML" class="nav-item dropdown">'.
|
|
|
|
makePopupLink('?view=log', 'zmLog', 'log', '<span class="mx-1 ' .$class. '"><i class="material-icons md-18">report</i>'.translate('Log').'</span>').
|
|
|
|
'</li>'.PHP_EOL;
|
2020-08-03 03:49:19 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
// Returns the html representing the X10 Devices menu item
|
|
|
|
function getDevicesHTML() {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
if ( ZM_OPT_X10 && canView('Devices') ) {
|
2020-08-03 00:31:36 +08:00
|
|
|
$result .= '<li id="getDevicesHTML" class="nav-item dropdown"><a class="nav-link" href="?view=devices">Devices</a></li>'.PHP_EOL;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
2020-08-03 00:31:36 +08:00
|
|
|
|
|
|
|
return $result;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the html representing the Groups menu item
|
2020-07-31 05:14:41 +08:00
|
|
|
function getGroupsHTML($view) {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-08-03 00:05:52 +08:00
|
|
|
$class = $view == 'groups' ? ' selected' : '';
|
2020-08-03 02:01:20 +08:00
|
|
|
$result .= '<li id="getGroupsHTML" class="nav-item dropdown"><a class="nav-link'.$class.'" href="?view=groups">'. translate('Groups') .'</a></li>'.PHP_EOL;
|
2020-08-03 00:31:36 +08:00
|
|
|
|
|
|
|
return $result;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the html representing the Filter menu item
|
2020-08-03 22:57:08 +08:00
|
|
|
function getFilterHTML($view, $filterQuery, $sortQuery, $limitQuery) {
|
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-08-03 00:05:52 +08:00
|
|
|
$class = $view == 'filter' ? ' selected' : '';
|
2020-08-03 02:01:20 +08:00
|
|
|
$result .= '<li id="getFilterHTML" class="nav-item dropdown"><a class="nav-link'.$class.'" href="?view=filter'.$filterQuery.$sortQuery.$limitQuery.'">'.translate('Filters').'</a></li>'.PHP_EOL;
|
2020-08-03 00:31:36 +08:00
|
|
|
|
|
|
|
return $result;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the html representing the Cycle menu item
|
2020-07-31 05:14:41 +08:00
|
|
|
function getCycleHTML($view) {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
if ( canView('Stream') ) {
|
2020-08-03 00:05:52 +08:00
|
|
|
$class = $view == 'cycle' ? ' selected' : '';
|
2020-08-03 02:01:20 +08:00
|
|
|
$result .= '<li id="getCycleHTML" class="nav-item dropdown"><a class="nav-link'.$class.'" href="?view=cycle">' .translate('Cycle'). '</a></li>'.PHP_EOL;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
2020-08-03 00:31:36 +08:00
|
|
|
|
|
|
|
return $result;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the html representing the Montage menu item
|
2020-07-31 05:14:41 +08:00
|
|
|
function getMontageHTML($view) {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
if ( canView('Stream') ) {
|
2020-08-03 00:05:52 +08:00
|
|
|
$class = $view == 'cycle' ? ' selected' : '';
|
2020-08-03 02:01:20 +08:00
|
|
|
$result .= '<li id="getMontageHTML" class="nav-item dropdown"><a class="nav-link'.$class.'" href="?view=montage">' .translate('Montage'). '</a></li>'.PHP_EOL;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
2020-08-03 00:31:36 +08:00
|
|
|
|
|
|
|
return $result;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the html representing the MontageReview menu item
|
2020-07-31 05:14:41 +08:00
|
|
|
function getMontageReviewHTML($view) {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
if ( canView('Events') ) {
|
|
|
|
if ( isset($_REQUEST['filter']['Query']['terms']['attr']) ) {
|
|
|
|
$terms = $_REQUEST['filter']['Query']['terms'];
|
|
|
|
$count = 0;
|
|
|
|
foreach ($terms as $term) {
|
|
|
|
if ( $term['attr'] == 'StartDateTime' ) {
|
|
|
|
$count += 1;
|
|
|
|
if ($term['op'] == '>=') $minTime = $term['val'];
|
|
|
|
if ($term['op'] == '<=') $maxTime = $term['val'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( $count == 2 ) {
|
|
|
|
$montageReviewQuery = '&minTime='.$minTime.'&maxTime='.$maxTime;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$live = isset($montageReviewQuery) ? '&fit=1'.$montageReviewQuery.'&live=0' : '';
|
2020-08-03 00:05:52 +08:00
|
|
|
$class = $view == 'montagereview' ? ' selected' : '';
|
2020-08-03 02:01:20 +08:00
|
|
|
$result .= '<li id="getMontageReviewHTML" class="nav-item dropdown"><a class="nav-link'.$class.'" href="?view=montagereview' .$live. '">'.translate('MontageReview').'</a></li>'.PHP_EOL;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
2020-08-03 00:31:36 +08:00
|
|
|
|
|
|
|
return $result;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the html representing the Audit Events Report menu item
|
2020-07-31 05:14:41 +08:00
|
|
|
function getRprtEvntAuditHTML($view) {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
if ( canView('Events') ) {
|
2020-08-03 00:05:52 +08:00
|
|
|
$class = $view == 'report_event_audit' ? ' selected' : '';
|
2020-08-03 02:01:20 +08:00
|
|
|
$result .= '<li id="getRprtEvntAuditHTML" class="nav-item dropdown"><a class="nav-link'.$class.'" href="?view=report_event_audit">'.translate('ReportEventAudit').'</a></li>'.PHP_EOL;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
2020-08-03 00:31:36 +08:00
|
|
|
|
|
|
|
return $result;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the html representing the header collapse toggle menu item
|
|
|
|
function getHeaderFlipHTML() {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
$header = ( isset($_COOKIE['zmHeaderFlip']) and $_COOKIE['zmHeaderFlip'] == 'down') ? 'down' : 'up';
|
2020-08-03 00:31:36 +08:00
|
|
|
$result .= '<li id="getHeaderFlipHTML" class="nav-item dropdown"><a class="nav-link" href="#"><i id="flip" class="material-icons md-18">keyboard_arrow_' .$header. '</i></a></li>'.PHP_EOL;
|
|
|
|
|
|
|
|
return $result;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the html representing the logged in user name and avatar
|
|
|
|
function getAcctCircleHTML($user=null) {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
if ( ZM_OPT_USE_AUTH and $user ) {
|
2020-08-03 00:31:36 +08:00
|
|
|
$result .= '<p id="getAcctCircleHTML" class="navbar-text mr-2">'.PHP_EOL;
|
2020-08-03 22:57:08 +08:00
|
|
|
$result .= makePopupLink('?view=logout', 'zmLogout', 'logout',
|
|
|
|
'<i class="material-icons">account_circle</i> '. $user['Username'],
|
|
|
|
(ZM_AUTH_TYPE == 'builtin') ).PHP_EOL;
|
2020-08-03 00:31:36 +08:00
|
|
|
$result .= '</p>'.PHP_EOL;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
2020-08-03 00:31:36 +08:00
|
|
|
|
|
|
|
return $result;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the html representing the runtime status button
|
|
|
|
function getStatusBtnHTML($status) {
|
2020-08-03 22:57:08 +08:00
|
|
|
$result = '';
|
2020-08-03 00:31:36 +08:00
|
|
|
|
2020-07-23 23:52:12 +08:00
|
|
|
if ( canEdit('System') ) {
|
2020-08-03 00:31:36 +08:00
|
|
|
//$result .= '<li class="nav-item dropdown">'.PHP_EOL;
|
|
|
|
$result .= '<form id="getStatusBtnHTML" class="form-inline">'.PHP_EOL;
|
|
|
|
$result .= '<button type="button" class="btn btn-default navbar-btn" data-toggle="modal" data-target="#modalState">' .$status. '</button>'.PHP_EOL;
|
|
|
|
$result .= '</form>'.PHP_EOL;
|
|
|
|
//$result .= '</li>'.PHP_EOL;
|
2020-07-23 23:52:12 +08:00
|
|
|
|
|
|
|
if ( ZM_SYSTEM_SHUTDOWN ) {
|
2020-08-03 00:31:36 +08:00
|
|
|
$result .= '<p class="navbar-text">'.PHP_EOL;
|
|
|
|
$result .= makePopupLink('?view=shutdown', 'zmShutdown', 'shutdown', '<i class="material-icons md-18">power_settings_new</i>' ).PHP_EOL;
|
|
|
|
$result .= '</p>'.PHP_EOL;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
} else if ( canView('System') ) {
|
2020-08-03 00:31:36 +08:00
|
|
|
$result .= '<p id="getStatusBtnHTML" class="navbar-text">'.PHP_EOL;
|
|
|
|
$result .= $status.PHP_EOL;
|
|
|
|
$result .= '</p>'.PHP_EOL;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
2020-08-03 00:31:36 +08:00
|
|
|
|
|
|
|
return $result;
|
2020-07-23 23:52:12 +08:00
|
|
|
}
|
|
|
|
|
2020-07-31 05:14:41 +08:00
|
|
|
function runtimeStatus($running=null) {
|
|
|
|
if ( $running == null )
|
|
|
|
$running = daemonCheck();
|
|
|
|
if ( $running ) {
|
|
|
|
$state = dbFetchOne('SELECT Name FROM States WHERE isActive=1', 'Name');
|
|
|
|
if ( $state == 'default' )
|
|
|
|
$state = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
return $running ? ($state ? $state : translate('Running')) : translate('Stopped');
|
|
|
|
}
|
|
|
|
|
2017-07-13 00:49:01 +08:00
|
|
|
function xhtmlFooter() {
|
2019-01-16 22:59:58 +08:00
|
|
|
global $cspNonce;
|
2017-07-13 22:07:23 +08:00
|
|
|
global $view;
|
2017-07-13 00:49:01 +08:00
|
|
|
global $skin;
|
2018-06-06 23:40:38 +08:00
|
|
|
if ( canEdit('System') ) {
|
|
|
|
include("skins/$skin/views/state.php");
|
|
|
|
}
|
2017-07-13 00:49:01 +08:00
|
|
|
?>
|
2019-01-16 22:59:58 +08:00
|
|
|
<script nonce="<?php echo $cspNonce; ?>">$j('.chosen').chosen();</script>
|
2018-06-06 23:40:38 +08:00
|
|
|
</body>
|
2017-12-14 05:15:03 +08:00
|
|
|
</html>
|
2017-07-13 00:49:01 +08:00
|
|
|
<?php
|
|
|
|
} // end xhtmlFooter
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|