2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
//
|
|
|
|
// ZoneMinder web function library, $Date: 2008-07-08 16:06:45 +0100 (Tue, 08 Jul 2008) $, $Revision: 2484 $
|
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
|
|
|
//
|
|
|
|
|
2016-05-04 01:25:39 +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
|
|
|
$skinJsFile = getSkinFile('js/skin.js');
|
|
|
|
$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
|
|
|
}
|
|
|
|
}
|
|
|
|
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">
|
2019-06-23 02:10:55 +08:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
2019-02-10 10:06:21 +08:00
|
|
|
<title><?php echo validHtmlStr(ZM_WEB_TITLE_PREFIX); ?> - <?php echo validHtmlStr($title) ?></title>
|
2017-10-02 23:55:36 +08:00
|
|
|
<?php
|
2017-10-03 01:05:23 +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
|
|
|
}
|
|
|
|
?>
|
2008-07-16 21:18:05 +08:00
|
|
|
<link rel="stylesheet" href="css/reset.css" type="text/css"/>
|
2011-07-28 00:09:09 +08:00
|
|
|
<link rel="stylesheet" href="css/overlay.css" type="text/css"/>
|
2016-03-12 14:16:19 +08:00
|
|
|
<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"/>
|
2018-03-25 06:25:39 +08:00
|
|
|
|
2017-12-22 10:46:21 +08:00
|
|
|
<?php
|
|
|
|
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',
|
2019-05-29 20:40:48 +08:00
|
|
|
#'js/jquery-ui-1.12.1/jquery-ui.theme.min.css',
|
2017-12-22 10:46:21 +08:00
|
|
|
)
|
|
|
|
);
|
2019-06-23 02:10:55 +08:00
|
|
|
if ( $css != 'base' )
|
|
|
|
echo output_link_if_exists( array(
|
|
|
|
'css/'.$css.'/skin.css',
|
|
|
|
'css/'.$css.'/views/'.$basename.'.css',
|
|
|
|
'css/'.$css.'/jquery-ui-theme.css',
|
|
|
|
)
|
|
|
|
);
|
2018-01-13 03:25:15 +08:00
|
|
|
?>
|
2019-05-29 20:40:48 +08:00
|
|
|
<link rel="stylesheet" href="skins/classic/js/jquery-ui-1.12.1/jquery-ui.theme.min.css" type="text/css"/>
|
2018-02-03 02:26:44 +08:00
|
|
|
<!--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' ) {
|
2018-01-12 02:14:11 +08:00
|
|
|
echo output_link_if_exists( array(
|
|
|
|
'/css/base/views/control.css',
|
|
|
|
'/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>
|
|
|
|
<?php
|
|
|
|
?>
|
2017-12-22 10:46:21 +08:00
|
|
|
|
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>
|
|
|
|
<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
|
|
|
});
|
|
|
|
});
|
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
|
|
|
|
if ( $title == 'Login' && (defined('ZM_OPT_USE_GOOG_RECAPTCHA') && ZM_OPT_USE_GOOG_RECAPTCHA) ) {
|
|
|
|
?>
|
2016-03-13 08:14:07 +08:00
|
|
|
<script src='https://www.google.com/recaptcha/api.js'></script>
|
2017-06-16 00:13:40 +08:00
|
|
|
<?php
|
2018-02-09 01:29:42 +08:00
|
|
|
} else 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>
|
2015-05-02 04:03:40 +08:00
|
|
|
<?php } ?>
|
2018-04-06 23:43:19 +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
|
|
|
|
|
2017-11-30 12:04:38 +08:00
|
|
|
function getNavBarHTML($reload = null) {
|
2019-02-12 06:14:33 +08:00
|
|
|
# Provide a facility to turn off the headers if you put navbar=0 into the url
|
2018-10-11 02:02:46 +08:00
|
|
|
if ( isset($_REQUEST['navbar']) and $_REQUEST['navbar']=='0' )
|
|
|
|
return '';
|
2017-10-05 09:51:30 +08:00
|
|
|
|
2016-05-07 02:58:41 +08:00
|
|
|
$versionClass = (ZM_DYN_DB_VERSION&&(ZM_DYN_DB_VERSION!=ZM_VERSION))?'errorText':'';
|
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
|
|
|
|
2017-12-15 21:45:49 +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'];
|
|
|
|
}
|
2019-03-21 02:27:23 +08:00
|
|
|
if ( $reload === null ) {
|
2017-12-02 11:15:29 +08:00
|
|
|
ob_start();
|
|
|
|
if ( $running == null )
|
|
|
|
$running = daemonCheck();
|
2019-05-13 22:30:41 +08:00
|
|
|
if ( $running ) {
|
|
|
|
$state = dbFetchOne('SELECT Name FROM States WHERE isActive=1', 'Name');
|
|
|
|
if ( $state == 'default' )
|
|
|
|
$state = '';
|
|
|
|
}
|
|
|
|
$status = $running ? ($state ? $state : translate('Running')) : translate('Stopped');
|
2016-05-07 02:30:32 +08:00
|
|
|
?>
|
2017-01-31 10:16:21 +08:00
|
|
|
<div class="navbar navbar-inverse navbar-static-top">
|
2016-05-07 02:30:32 +08:00
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="navbar-header">
|
|
|
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#main-header-nav" aria-expanded="false">
|
2019-12-03 01:33:13 +08:00
|
|
|
<span class="sr-only">Toggle navigation</span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
<span class="icon-bar"></span>
|
2016-05-07 02:30:32 +08:00
|
|
|
</button>
|
2019-05-13 22:30:41 +08:00
|
|
|
<div class="navbar-brand">
|
|
|
|
<a href="<?php echo validHtmlStr(ZM_HOME_URL); ?>" target="<?php echo validHtmlStr(ZM_WEB_TITLE); ?>"><?php echo ZM_HOME_CONTENT ?></a>
|
|
|
|
</div>
|
2016-05-07 02:30:32 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="collapse navbar-collapse" id="main-header-nav">
|
|
|
|
<ul class="nav navbar-nav">
|
2019-12-03 01:33:13 +08:00
|
|
|
<?php
|
|
|
|
if ( $user and $user['Username'] ) {
|
|
|
|
if ( canView('Monitors') ) {
|
|
|
|
?>
|
2016-05-07 02:30:32 +08:00
|
|
|
<li><a href="?view=console"><?php echo translate('Console') ?></a></li>
|
2019-12-03 01:33:13 +08:00
|
|
|
<?php
|
|
|
|
} // end if canView('Monitors')
|
|
|
|
if ( canView('System') ) {
|
|
|
|
?>
|
2016-05-07 02:30:32 +08:00
|
|
|
<li><a href="?view=options"><?php echo translate('Options') ?></a></li>
|
2017-10-26 02:11:19 +08:00
|
|
|
<li>
|
|
|
|
<?php
|
2019-12-03 01:33:13 +08:00
|
|
|
if ( ZM\logToDatabase() > ZM\Logger::NOLOG ) {
|
|
|
|
if ( ! ZM_RUN_AUDIT ) {
|
|
|
|
# zmaudit can clean the logs, but if we aren't running it, then we should clean them regularly
|
|
|
|
if ( preg_match('/^\d+$/', ZM_LOG_DATABASE_LIMIT) ) {
|
|
|
|
# Number of lines, instead of an interval
|
|
|
|
$rows = dbFetchOne('SELECT Count(*) AS Rows FROM Logs', 'Rows');
|
|
|
|
if ( $rows > ZM_LOG_DATABASE_LIMIT ) {
|
|
|
|
dbQuery('DELETE low_priority FROM Logs ORDER BY TimeKey ASC LIMIT ?', array($rows - ZM_LOG_DATABASE_LIMIT));
|
|
|
|
}
|
|
|
|
} else if ( preg_match('/^\d\s*(hour|minute|day|week|month|year)$/', ZM_LOG_DATABASE_LIMIT, $matches) ) {
|
|
|
|
dbQuery('DELETE FROM Logs WHERE TimeKey < unix_timestamp( NOW() - interval '.ZM_LOG_DATABASE_LIMIT.') LIMIT 100');
|
|
|
|
} else {
|
|
|
|
ZM\Error('Potentially invalid value for ZM_LOG_DATABASE_LIMIT: ' . ZM_LOG_DATABASE_LIMIT);
|
2019-03-01 05:12:34 +08:00
|
|
|
}
|
|
|
|
}
|
2019-12-03 01:33:13 +08:00
|
|
|
echo makePopupLink('?view=log', 'zmLog', 'log', '<span class="'.logState().'">'.translate('Log').'</span>');
|
2017-10-26 02:11:19 +08:00
|
|
|
}
|
2019-12-03 01:33:13 +08:00
|
|
|
?>
|
|
|
|
</li>
|
2017-10-26 02:11:19 +08:00
|
|
|
<?php
|
2019-12-03 01:33:13 +08:00
|
|
|
} // end if canview(System)
|
|
|
|
if ( ZM_OPT_X10 && canView('Devices') ) { ?>
|
2017-07-12 23:17:07 +08:00
|
|
|
<li><a href="?view=devices">Devices</a></li>
|
2019-12-03 01:33:13 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<li><a href="?view=groups"<?php echo $view=='groups'?' class="selected"':''?>><?php echo translate('Groups') ?></a></li>
|
2017-12-15 21:45:49 +08:00
|
|
|
<li><a href="?view=filter<?php echo $filterQuery.$sortQuery.$limitQuery ?>"<?php echo $view=='filter'?' class="selected"':''?>><?php echo translate('Filters') ?></a></li>
|
2016-05-07 02:30:32 +08:00
|
|
|
|
2016-11-03 21:41:54 +08:00
|
|
|
<?php
|
2019-02-12 03:15:24 +08:00
|
|
|
if ( canView('Stream') ) {
|
2016-05-07 02:30:32 +08:00
|
|
|
?>
|
2018-04-11 04:06:01 +08:00
|
|
|
<li><a href="?view=cycle"<?php echo $view=='cycle'?' class="selected"':''?>><?php echo translate('Cycle') ?></a></li>
|
2017-10-02 21:02:57 +08:00
|
|
|
<li><a href="?view=montage"<?php echo $view=='montage'?' class="selected"':''?>><?php echo translate('Montage') ?></a></li>
|
2017-06-16 00:13:40 +08:00
|
|
|
<?php
|
|
|
|
}
|
2019-12-03 01:33:13 +08:00
|
|
|
|
2017-06-16 00:13:40 +08:00
|
|
|
if ( canView('Events') ) {
|
2019-12-03 01:33:13 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2017-06-16 00:13:40 +08:00
|
|
|
?>
|
2019-02-12 03:15:24 +08:00
|
|
|
<li><a href="?view=montagereview<?php echo isset($montageReviewQuery)?'&fit=1'.$montageReviewQuery.'&live=0':'' ?>"<?php echo $view=='montagereview'?' class="selected"':''?>><?php echo translate('MontageReview')?></a></li>
|
2019-12-03 01:33:13 +08:00
|
|
|
<li><a href="?view=report_event_audit"<?php echo $view=='report_event_audit'?' class="selected"':''?>><?php echo translate('ReportEventAudit') ?></a></li>
|
2017-06-16 00:13:40 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2019-12-03 01:33:13 +08:00
|
|
|
<li><a href="#"><i id="flip" class="material-icons md-18 pull-right">keyboard_arrow_<?php echo ( isset($_COOKIE['zmHeaderFlip']) and $_COOKIE['zmHeaderFlip'] == 'down') ? 'down' : 'up' ?></i></a></li>
|
2016-05-07 02:30:32 +08:00
|
|
|
</ul>
|
|
|
|
|
|
|
|
<div class="navbar-right">
|
2019-05-31 23:01:09 +08:00
|
|
|
<?php
|
|
|
|
if ( ZM_OPT_USE_AUTH and $user ) {
|
|
|
|
?>
|
|
|
|
<p class="navbar-text">
|
|
|
|
<i class="material-icons">account_circle</i>
|
|
|
|
<?php echo makePopupLink( '?view=logout', 'zmLogout', 'logout', $user['Username'], (ZM_AUTH_TYPE == "builtin") ) ?>
|
|
|
|
</p>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
if ( canEdit('System') ) {
|
|
|
|
?>
|
2016-05-07 02:30:32 +08:00
|
|
|
<button type="button" class="btn btn-default navbar-btn" data-toggle="modal" data-target="#modalState"><?php echo $status ?></button>
|
2019-04-13 01:08:58 +08:00
|
|
|
<?php if ( ZM_SYSTEM_SHUTDOWN ) { ?>
|
|
|
|
<p class="navbar-text">
|
2019-06-11 03:57:53 +08:00
|
|
|
<?php echo makePopupLink('?view=shutdown', 'zmShutdown', 'shutdown', '<i class="material-icons md-18">power_settings_new</i>' ) ?>
|
2019-04-13 01:08:58 +08:00
|
|
|
</p>
|
|
|
|
<?php } ?>
|
2019-02-12 03:15:24 +08:00
|
|
|
<?php } else if ( canView('System') ) { ?>
|
2019-05-13 22:30:41 +08:00
|
|
|
<p class="navbar-text"><?php echo $status ?></p>
|
2016-05-07 02:30:32 +08:00
|
|
|
<?php } ?>
|
|
|
|
</div>
|
2019-02-13 02:17:55 +08:00
|
|
|
<?php } # end if !$user or $user['Id'] meaning logged in ?>
|
2016-05-07 02:30:32 +08:00
|
|
|
</div><!-- End .navbar-collapse -->
|
|
|
|
</div> <!-- End .container-fluid -->
|
2018-10-11 01:11:27 +08:00
|
|
|
<div id="panel"<?php echo ( isset($_COOKIE['zmHeaderFlip']) and $_COOKIE['zmHeaderFlip'] == 'down' ) ? 'style="display:none;"' : '' ?>>
|
2017-12-02 11:15:29 +08:00
|
|
|
<?php
|
2019-02-12 03:15:24 +08:00
|
|
|
} //end reload null. Runs on full page load
|
2018-01-11 23:57:07 +08:00
|
|
|
|
|
|
|
if ( (!ZM_OPT_USE_AUTH) or $user ) {
|
2019-05-31 23:01:09 +08:00
|
|
|
if ($reload == 'reload') ob_start();
|
2017-12-02 11:15:29 +08:00
|
|
|
?>
|
2018-03-25 21:56:41 +08:00
|
|
|
<div id="reload" class="container-fluid reduced-text">
|
2018-01-11 23:57:07 +08:00
|
|
|
<div id="Bandwidth" class="pull-left">
|
2018-03-25 21:56:41 +08:00
|
|
|
<?php echo makePopupLink( '?view=bandwidth', 'zmBandwidth', 'bandwidth', "<i class='material-icons md-18'>network_check</i> ".$bandwidth_options[$_COOKIE['zmBandwidth']] . ' ', ($user && $user['MaxBandwidth'] != 'low' ) ) ?>
|
2017-12-22 10:46:21 +08:00
|
|
|
</div>
|
2018-01-11 23:57:07 +08:00
|
|
|
<div id="Version" class="pull-right">
|
2019-02-12 03:15:24 +08:00
|
|
|
<?php echo makePopupLink( '?view=version', 'zmVersion', 'version', '<span class="version '.$versionClass.'">v'.ZM_VERSION.'</span>', canEdit('System') ) ?>
|
2017-12-22 10:46:21 +08:00
|
|
|
</div>
|
|
|
|
<ul class="list-inline">
|
2018-03-25 21:56:41 +08:00
|
|
|
<li class="Load"><i class="material-icons md-18">trending_up</i> <?php echo translate('Load') ?>: <?php echo getLoad() ?></li>
|
2019-05-31 23:01:09 +08:00
|
|
|
<i class="material-icons md-18">storage</i>
|
2017-04-29 02:17:09 +08:00
|
|
|
<?php
|
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;
|
2017-04-29 02:17:09 +08:00
|
|
|
echo '<li'. ( $percent_used > 90 ? ' class="warning"' : '' ).'>'.translate('DB').':'.$connections.'/'.$max_connections.'</li>';
|
|
|
|
?>
|
2017-02-03 01:15:16 +08:00
|
|
|
<li><?php echo translate('Storage') ?>:
|
|
|
|
<?php
|
2019-02-22 22:19:07 +08:00
|
|
|
$storage_areas = ZM\Storage::find();
|
2017-02-03 01:15:16 +08:00
|
|
|
$storage_paths = null;
|
2019-12-14 06:47:51 +08:00
|
|
|
$storage_areas_with_no_server_id = array();
|
2017-02-03 01:15:16 +08:00
|
|
|
foreach ( $storage_areas as $area ) {
|
|
|
|
$storage_paths[$area->Path()] = $area;
|
2019-12-14 06:47:51 +08:00
|
|
|
if ( ! $area->ServerId() ) {
|
|
|
|
$storage_areas_with_no_server_id[] = $area;
|
|
|
|
}
|
2017-02-03 01:15:16 +08:00
|
|
|
}
|
2018-04-18 05:14:40 +08:00
|
|
|
$func = function($S){
|
|
|
|
$class = '';
|
|
|
|
if ( $S->disk_usage_percent() > 98 ) {
|
2019-02-12 03:15:24 +08:00
|
|
|
$class = 'error';
|
2018-04-18 05:14:40 +08:00
|
|
|
} else if ( $S->disk_usage_percent() > 90 ) {
|
2019-02-12 03:15:24 +08:00
|
|
|
$class = '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' : '' );
|
|
|
|
|
2019-06-11 03:57:53 +08:00
|
|
|
return '<span class="'.$class.'" title="'.$title.'">'.$S->Name() . ': ' . $S->disk_usage_percent().'%' . '</span>
|
|
|
|
'; };
|
2017-10-11 02:06:21 +08:00
|
|
|
#$func = function($S){ return '<span title="">'.$S->Name() . ': ' . $S->disk_usage_percent().'%' . '</span>'; };
|
2019-05-31 23:01:09 +08:00
|
|
|
if ( count($storage_areas) > 4 )
|
2019-12-14 06:47:51 +08:00
|
|
|
$storage_areas = $storage_areas_with_no_server_id;
|
2019-05-31 23:01:09 +08:00
|
|
|
if ( count($storage_areas) <= 4 )
|
2019-12-14 06:47:51 +08:00
|
|
|
echo implode(', ', array_map($func, $storage_areas));
|
2016-11-12 11:40:00 +08:00
|
|
|
echo ' ' . ZM_PATH_MAP .': '. getDiskPercent(ZM_PATH_MAP).'%';
|
2016-09-21 00:18:50 +08:00
|
|
|
?></li>
|
2016-05-07 04:08:32 +08:00
|
|
|
</ul>
|
2018-07-07 04:59:10 +08:00
|
|
|
<?php if ( defined('ZM_WEB_CONSOLE_BANNER') and ZM_WEB_CONSOLE_BANNER != '' ) { ?>
|
2019-02-10 10:06:21 +08:00
|
|
|
<h3 id="development"><?php echo validHtmlStr(ZM_WEB_CONSOLE_BANNER); ?></h3>
|
2018-07-07 04:59:10 +08:00
|
|
|
<?php } ?>
|
2017-12-08 01:54:22 +08:00
|
|
|
<!-- End .footer/reload --></div>
|
2017-12-02 11:15:29 +08:00
|
|
|
<?php
|
2019-05-31 23:01:09 +08:00
|
|
|
if ($reload == 'reload') return ob_get_clean();
|
2018-01-11 23:57:07 +08:00
|
|
|
} // end if (!ZM_OPT_USE_AUTH) or $user )
|
2017-12-02 11:15:29 +08:00
|
|
|
?>
|
2018-09-12 05:39:40 +08:00
|
|
|
</div>
|
2017-12-02 11:15:29 +08:00
|
|
|
</div><!-- End .navbar .navbar-default -->
|
2016-05-07 02:30:32 +08:00
|
|
|
<?php
|
2018-10-11 02:02:46 +08:00
|
|
|
return ob_get_clean();
|
2017-06-16 00:13:40 +08:00
|
|
|
} // end function getNavBarHTML()
|
2017-07-13 22:07:23 +08:00
|
|
|
|
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;
|
2017-07-13 22:07:23 +08:00
|
|
|
global $running;
|
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
|
|
|
?>
|