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
|
|
|
|
|
|
|
// Don't load in additional JS to these views
|
|
|
|
$bad_views = array('monitor', 'log');
|
|
|
|
|
2008-07-14 21:54:50 +08:00
|
|
|
function xhtmlHeaders( $file, $title )
|
|
|
|
{
|
2016-05-07 03:24:20 +08:00
|
|
|
global $css;
|
|
|
|
global $skin;
|
2014-11-27 00:18:03 +08:00
|
|
|
$skinCssFile = getSkinFile( 'css/'.$css.'/skin.css' );
|
|
|
|
$skinCssPhpFile = getSkinFile( 'css/'.$css.'/skin.css.php' );
|
|
|
|
|
2008-07-14 21:54:50 +08:00
|
|
|
$skinJsFile = getSkinFile( 'js/skin.js' );
|
|
|
|
$skinJsPhpFile = getSkinFile( 'js/skin.js.php' );
|
2015-05-02 04:50:29 +08:00
|
|
|
$cssJsFile = getSkinFile( 'js/'.$css.'.js' );
|
2008-07-14 21:54:50 +08:00
|
|
|
|
|
|
|
$basename = basename( $file, '.php' );
|
2014-11-27 00:18:03 +08:00
|
|
|
$viewCssFile = getSkinFile( '/css/'.$css.'/views/'.$basename.'.css' );
|
|
|
|
$viewCssPhpFile = getSkinFile( '/css/'.$css.'/views/'.$basename.'.css.php' );
|
2008-07-14 21:54:50 +08:00
|
|
|
$viewJsFile = getSkinFile( 'views/js/'.$basename.'.js' );
|
|
|
|
$viewJsPhpFile = getSkinFile( 'views/js/'.$basename.'.js.php' );
|
|
|
|
|
|
|
|
extract( $GLOBALS, EXTR_OVERWRITE );
|
|
|
|
?>
|
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">
|
2016-11-30 04:25:24 +08:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
|
2014-12-05 07:44:23 +08:00
|
|
|
<title><?php echo ZM_WEB_TITLE_PREFIX ?> - <?php echo validHtmlStr($title) ?></title>
|
2008-07-16 21:18:05 +08:00
|
|
|
<link rel="icon" type="image/ico" href="graphics/favicon.ico"/>
|
|
|
|
<link rel="shortcut icon" href="graphics/favicon.ico"/>
|
|
|
|
<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"/>
|
2014-12-05 07:44:23 +08:00
|
|
|
<link rel="stylesheet" href="<?php echo $skinCssFile ?>" type="text/css" media="screen"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
if ( $viewCssFile )
|
|
|
|
{
|
|
|
|
?>
|
2014-12-05 07:44:23 +08:00
|
|
|
<link rel="stylesheet" href="<?php echo $viewCssFile ?>" type="text/css" media="screen"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
if ( $viewCssPhpFile )
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<style type="text/css">
|
2009-10-17 01:04:44 +08:00
|
|
|
/*<![CDATA[*/
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
require_once( $viewCssPhpFile );
|
|
|
|
?>
|
2009-10-17 01:04:44 +08:00
|
|
|
/*]]>*/
|
2008-07-14 21:54:50 +08:00
|
|
|
</style>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2009-10-15 01:38:13 +08:00
|
|
|
<script type="text/javascript" src="tools/mootools/mootools-core.js"></script>
|
|
|
|
<script type="text/javascript" src="tools/mootools/mootools-more.js"></script>
|
2008-07-14 21:54:50 +08:00
|
|
|
<script type="text/javascript" src="js/mootools.ext.js"></script>
|
2016-05-04 01:25:39 +08:00
|
|
|
<?php if ( !in_array($basename, $bad_views) ) { ?>
|
2016-05-17 02:37:35 +08:00
|
|
|
<!--<script type="text/javascript" src="js/overlay.js"></script>-->
|
2016-09-17 00:20:17 +08:00
|
|
|
<script type="text/javascript" src="skins/<?php echo $skin; ?>/js/jquery-1.11.3.js"></script>
|
2017-01-31 08:17:14 +08:00
|
|
|
<script type="text/javascript" src="skins/<?php echo $skin; ?>/js/jquery-ui.js"></script>
|
2016-09-17 00:20:17 +08:00
|
|
|
<script type="text/javascript" src="skins/<?php echo $skin; ?>/js/bootstrap.min.js"></script>
|
2017-01-31 08:17:14 +08:00
|
|
|
<script type="text/javascript">
|
2016-05-07 00:40:23 +08:00
|
|
|
//<![CDATA[
|
|
|
|
<!--
|
2016-05-13 21:45:24 +08:00
|
|
|
var $j = jQuery.noConflict();
|
|
|
|
// $j is now an alias to the jQuery function; creating the new alias is optional.
|
|
|
|
|
2016-05-07 03:24:20 +08:00
|
|
|
<?php include("skins/$skin/views/js/state.js.php")?>
|
2016-05-07 00:40:23 +08:00
|
|
|
//-->
|
|
|
|
//]]>
|
|
|
|
</script>
|
2016-09-17 00:20:17 +08:00
|
|
|
<script type="text/javascript" src="skins/<?php echo $skin; ?>/views/js/state.js"></script>
|
2016-05-04 00:59:24 +08:00
|
|
|
<?php } ?>
|
2016-03-13 08:14:07 +08:00
|
|
|
<?php if ( $title == 'Login' && (defined('ZM_OPT_USE_GOOG_RECAPTCHA') && ZM_OPT_USE_GOOG_RECAPTCHA) ) { ?>
|
|
|
|
<script src='https://www.google.com/recaptcha/api.js'></script>
|
2016-10-28 05:05:33 +08:00
|
|
|
<?php } else if ( $title == 'Event' ) {
|
|
|
|
?>
|
|
|
|
<link href="//vjs.zencdn.net/4.11/video-js.css" rel="stylesheet">
|
|
|
|
<script src="//vjs.zencdn.net/4.11/video.js"></script>
|
|
|
|
<script src="./js/videojs.zoomrotate.js"></script>
|
|
|
|
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"></script>
|
|
|
|
<?php
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
if ( $skinJsPhpFile )
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
2009-10-17 01:04:44 +08:00
|
|
|
//<![CDATA[
|
|
|
|
<!--
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
require_once( $skinJsPhpFile );
|
|
|
|
?>
|
2009-10-17 01:04:44 +08:00
|
|
|
//-->
|
|
|
|
//]]>
|
2008-07-14 21:54:50 +08:00
|
|
|
</script>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
if ( $viewJsPhpFile )
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
2009-10-17 01:04:44 +08:00
|
|
|
//<![CDATA[
|
|
|
|
<!--
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
require_once( $viewJsPhpFile );
|
|
|
|
?>
|
2009-10-17 01:04:44 +08:00
|
|
|
//-->
|
|
|
|
//]]>
|
2008-07-14 21:54:50 +08:00
|
|
|
</script>
|
|
|
|
<?php
|
|
|
|
}
|
2015-05-02 04:03:40 +08:00
|
|
|
if ( $cssJsFile ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2015-05-02 04:03:40 +08:00
|
|
|
<script type="text/javascript" src="<?php echo $cssJsFile ?>"></script>
|
|
|
|
<?php } ?>
|
2014-12-05 07:44:23 +08:00
|
|
|
<script type="text/javascript" src="<?php echo $skinJsFile ?>"></script>
|
2016-05-17 02:37:35 +08:00
|
|
|
<script type="text/javascript" src="js/logger.js"></script>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
if ( $viewJsFile )
|
|
|
|
{
|
|
|
|
?>
|
2014-12-05 07:44:23 +08:00
|
|
|
<script type="text/javascript" src="<?php echo $viewJsFile ?>"></script>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</head>
|
|
|
|
<?php
|
|
|
|
}
|
2016-05-07 02:30:32 +08:00
|
|
|
|
|
|
|
function getNavBarHTML() {
|
|
|
|
|
2016-05-07 02:58:41 +08:00
|
|
|
$group = NULL;
|
|
|
|
if ( ! empty($_COOKIE['zmGroup']) ) {
|
|
|
|
if ( $group = dbFetchOne( 'select * from Groups where Id = ?', NULL, array($_COOKIE['zmGroup'])) )
|
|
|
|
$groupIds = array_flip(explode( ',', $group['MonitorIds'] ));
|
|
|
|
}
|
2016-05-07 02:30:32 +08:00
|
|
|
|
2016-05-07 02:58:41 +08:00
|
|
|
$maxWidth = 0;
|
|
|
|
$maxHeight = 0;
|
|
|
|
# Used to determine if the Cycle button should be made available
|
|
|
|
$cycleCount = 0;
|
|
|
|
$monitors = dbFetchAll( "select * from Monitors order by Sequence asc" );
|
2016-05-07 03:44:35 +08:00
|
|
|
global $displayMonitors;
|
2016-05-07 02:58:41 +08:00
|
|
|
$displayMonitors = array();
|
|
|
|
for ( $i = 0; $i < count($monitors); $i++ ) {
|
|
|
|
if ( !visibleMonitor( $monitors[$i]['Id'] ) ) {
|
|
|
|
continue;
|
2016-05-07 02:30:32 +08:00
|
|
|
}
|
2016-05-07 02:58:41 +08:00
|
|
|
if ( $group && !empty($groupIds) && !array_key_exists( $monitors[$i]['Id'], $groupIds ) ) {
|
|
|
|
continue;
|
2016-05-07 02:30:32 +08:00
|
|
|
}
|
2016-05-07 02:58:41 +08:00
|
|
|
if ( $monitors[$i]['Function'] != 'None' ) {
|
|
|
|
$cycleCount++;
|
|
|
|
$scaleWidth = reScale( $monitors[$i]['Width'], $monitors[$i]['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
|
|
|
|
$scaleHeight = reScale( $monitors[$i]['Height'], $monitors[$i]['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
|
|
|
|
if ( $maxWidth < $scaleWidth ) $maxWidth = $scaleWidth;
|
|
|
|
if ( $maxHeight < $scaleHeight ) $maxHeight = $scaleHeight;
|
2016-05-07 02:30:32 +08:00
|
|
|
}
|
|
|
|
$displayMonitors[] = $monitors[$i];
|
2016-05-07 02:58:41 +08:00
|
|
|
}
|
2016-05-07 02:30:32 +08:00
|
|
|
|
2016-05-07 02:58:41 +08:00
|
|
|
$cycleWidth = $maxWidth;
|
|
|
|
$cycleHeight = $maxHeight;
|
2016-05-07 02:30:32 +08:00
|
|
|
|
|
|
|
|
2016-05-07 02:58:41 +08:00
|
|
|
$versionClass = (ZM_DYN_DB_VERSION&&(ZM_DYN_DB_VERSION!=ZM_VERSION))?'errorText':'';
|
2016-05-07 02:30:32 +08:00
|
|
|
|
2016-05-07 02:58:41 +08:00
|
|
|
ob_start();
|
|
|
|
global $CLANG;
|
|
|
|
global $VLANG;
|
2016-05-07 03:16:48 +08:00
|
|
|
global $CLANG;
|
|
|
|
global $VLANG;
|
2016-10-21 01:38:12 +08:00
|
|
|
global $running;
|
|
|
|
if ( $running == null )
|
|
|
|
$running = daemonCheck();
|
|
|
|
$status = $running?translate('Running'):translate('Stopped');
|
2016-05-07 03:16:48 +08:00
|
|
|
global $user;
|
2016-05-07 04:08:32 +08:00
|
|
|
global $bwArray;
|
2016-05-07 02:30:32 +08:00
|
|
|
?>
|
2016-05-08 06:11:58 +08:00
|
|
|
<div class="navbar navbar-inverse navbar-fixed-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">
|
|
|
|
<span class="sr-only">Toggle navigation</span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
</button>
|
|
|
|
<a class="navbar-brand" href="http://www.zoneminder.com" target="ZoneMinder">ZoneMinder</a>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="collapse navbar-collapse" id="main-header-nav">
|
|
|
|
<ul class="nav navbar-nav">
|
|
|
|
<li><a href="?view=console"><?php echo translate('Console') ?></a></li>
|
|
|
|
<?php if ( canView( 'System' ) ) { ?>
|
|
|
|
<li><a href="?view=options"><?php echo translate('Options') ?></a></li>
|
|
|
|
<li><?php if ( logToDatabase() > Logger::NOLOG ) { ?> <?php echo makePopupLink( '?view=log', 'zmLog', 'log', '<span class="'.logState().'">'.translate('Log').'</span>' ) ?><?php } ?></li>
|
|
|
|
<?php } ?>
|
|
|
|
<?php if ( ZM_OPT_X10 && canView( 'Devices' ) ) { ?>
|
|
|
|
<li><a href="/?view=devices">Devices</a></li>
|
|
|
|
<?php } ?>
|
|
|
|
<li><?php echo makePopupLink( '?view=groups', 'zmGroups', 'groups', sprintf( $CLANG['MonitorCount'], count($displayMonitors), zmVlang( $VLANG['Monitor'], count($displayMonitors) ) ).($group?' ('.$group['Name'].')':''), canView( 'Groups' ) ); ?></li>
|
|
|
|
<li><?php echo makePopupLink( '?view=filter&filter[terms][0][attr]=DateTime&filter[terms][0][op]=%3c&filter[terms][0][val]=now', 'zmFilter', 'filter', translate('Filters'), canView( 'Events' ) ) ?></li>
|
|
|
|
|
2016-11-03 21:41:54 +08:00
|
|
|
<?php
|
|
|
|
$cycleGroup = isset($_COOKIE['zmGroup'])?$_COOKIE['zmGroup']:0;
|
|
|
|
if ( canView( 'Stream' ) && $cycleCount > 1 ) {
|
2016-05-07 02:30:32 +08:00
|
|
|
?>
|
|
|
|
<li><?php echo makePopupLink( '?view=cycle&group='.$cycleGroup, 'zmCycle'.$cycleGroup, array( 'cycle', $cycleWidth, $cycleHeight ), translate('Cycle'), $running ) ?></li>
|
|
|
|
<li><?php echo makePopupLink( '?view=montage&group='.$cycleGroup, 'zmMontage'.$cycleGroup, 'montage', translate('Montage'), $running ) ?></li>
|
2016-10-21 01:38:12 +08:00
|
|
|
<?php } ?>
|
|
|
|
<?php if ( canView('Events') ) { ?>
|
|
|
|
<li><?php echo makePopupLink( '?view=montagereview&group='.$cycleGroup, 'zmMontageReview'.$cycleGroup, 'montagereview', translate('MontageReview') ) ?></li>
|
2016-05-07 02:30:32 +08:00
|
|
|
<?php } ?>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<div class="navbar-right">
|
|
|
|
<?php if ( ZM_OPT_USE_AUTH ) { ?>
|
|
|
|
<p class="navbar-text"><?php echo translate('LoggedInAs') ?> <?php echo makePopupLink( '?view=logout', 'zmLogout', 'logout', $user['Username'], (ZM_AUTH_TYPE == "builtin") ) ?> </p>
|
|
|
|
<?php } ?>
|
|
|
|
|
|
|
|
<?php if ( canEdit( 'System' ) ) { ?>
|
|
|
|
<button type="button" class="btn btn-default navbar-btn" data-toggle="modal" data-target="#modalState"><?php echo $status ?></button>
|
|
|
|
|
|
|
|
<?php } else if ( canView( 'System' ) ) { ?>
|
|
|
|
<p class="navbar-text"> <?php echo $status ?> </p>
|
|
|
|
<?php } ?>
|
|
|
|
</div>
|
|
|
|
</div><!-- End .navbar-collapse -->
|
|
|
|
</div> <!-- End .container-fluid -->
|
2016-05-07 04:08:32 +08:00
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="pull-left">
|
|
|
|
<?php echo makePopupLink( '?view=bandwidth', 'zmBandwidth', 'bandwidth', $bwArray[$_COOKIE['zmBandwidth']], ($user && $user['MaxBandwidth'] != 'low' ) ) ?> <?php echo translate('BandwidthHead') ?>
|
|
|
|
</div>
|
|
|
|
<div class="pull-right">
|
|
|
|
<?php echo makePopupLink( '?view=version', 'zmVersion', 'version', '<span class="'.$versionClass.'">v'.ZM_VERSION.'</span>', canEdit( 'System' ) ) ?>
|
2016-09-13 22:25:49 +08:00
|
|
|
<?php if ( defined('ZM_WEB_CONSOLE_BANNER') and ZM_WEB_CONSOLE_BANNER != '' ) { ?>
|
2016-08-22 23:42:44 +08:00
|
|
|
<h3 id="development"><?php echo ZM_WEB_CONSOLE_BANNER ?></h3>
|
|
|
|
<?php } ?>
|
2016-05-07 04:08:32 +08:00
|
|
|
</div>
|
|
|
|
<ul class="list-inline">
|
|
|
|
<li><?php echo translate('Load') ?>: <?php echo getLoad() ?></li>
|
2016-09-21 00:18:50 +08:00
|
|
|
<li><?php echo translate('Storage') ?>: <?php
|
|
|
|
|
|
|
|
$storage_areas = Storage::find_all();
|
2017-01-31 06:29:15 +08:00
|
|
|
$storage_paths = null;
|
|
|
|
foreach ( $storage_areas as $area ) {
|
|
|
|
$storage_paths[$area->Path()] = $area;
|
|
|
|
}
|
|
|
|
if ( ! $storage_paths[ZM_DIR_EVENTS] ) {
|
2016-09-21 00:18:50 +08:00
|
|
|
array_push( $storage_areas, new Storage() );
|
2017-01-31 06:29:15 +08:00
|
|
|
}
|
2016-09-21 00:18:50 +08:00
|
|
|
$func = function($S){ return $S->Name() . ': ' . $S->disk_usage_percent().'%'; };
|
|
|
|
|
|
|
|
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>
|
|
|
|
</div> <!-- End .footer -->
|
|
|
|
|
2016-05-07 02:30:32 +08:00
|
|
|
</div> <!-- End .navbar .navbar-default -->
|
|
|
|
<?php
|
|
|
|
return( ob_get_clean() );
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|