Merge branch 'master' into storageareas
This commit is contained in:
commit
29f0747895
|
@ -1,40 +1,28 @@
|
|||
<?php
|
||||
define( "MSG_TIMEOUT", 2.0 );
|
||||
define( "MSG_DATA_SIZE", 4+256 );
|
||||
define("MSG_TIMEOUT", 2.0);
|
||||
define("MSG_DATA_SIZE", 4+256);
|
||||
|
||||
if ( canEdit( 'Monitors' ) )
|
||||
{
|
||||
$zmuCommand = getZmuCommand( " -m ".validInt($_REQUEST['id']) );
|
||||
if ( canEdit('Monitors') ) {
|
||||
$zmuCommand = getZmuCommand(' -m '.validInt($_REQUEST['id']));
|
||||
|
||||
switch ( validJsStr($_REQUEST['command']) )
|
||||
{
|
||||
case "disableAlarms" :
|
||||
{
|
||||
$zmuCommand .= " -n";
|
||||
switch ( validJsStr($_REQUEST['command']) ) {
|
||||
case 'disableAlarms' :
|
||||
$zmuCommand .= ' -n';
|
||||
break;
|
||||
}
|
||||
case "enableAlarms" :
|
||||
{
|
||||
$zmuCommand .= " -c";
|
||||
case 'enableAlarms' :
|
||||
$zmuCommand .= ' -c';
|
||||
break;
|
||||
}
|
||||
case "forceAlarm" :
|
||||
{
|
||||
$zmuCommand .= " -a";
|
||||
case 'forceAlarm' :
|
||||
$zmuCommand .= ' -a';
|
||||
break;
|
||||
}
|
||||
case "cancelForcedAlarm" :
|
||||
{
|
||||
$zmuCommand .= " -c";
|
||||
case 'cancelForcedAlarm' :
|
||||
$zmuCommand .= ' -c';
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
ajaxError( "Unexpected command '".validJsStr($_REQUEST['command'])."'" );
|
||||
}
|
||||
ajaxError("Unexpected command '".validJsStr($_REQUEST['command'])."'");
|
||||
}
|
||||
ajaxResponse( exec( escapeshellcmd( $zmuCommand ) ) );
|
||||
ajaxResponse(exec(escapeshellcmd($zmuCommand)));
|
||||
} else {
|
||||
ajaxError( 'Insufficient permissions' );
|
||||
ajaxError('Insufficient permissions');
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -215,7 +215,7 @@ private $control_fields = array(
|
|||
|
||||
if ( ZM_OPT_USE_AUTH ) {
|
||||
if ( ZM_AUTH_RELAY == 'hashed' ) {
|
||||
$args['auth'] = generateAuthHash( ZM_AUTH_HASH_IPS );
|
||||
$args['auth'] = generateAuthHash(ZM_AUTH_HASH_IPS);
|
||||
} elseif ( ZM_AUTH_RELAY == 'plain' ) {
|
||||
$args['user'] = $_SESSION['username'];
|
||||
$args['pass'] = $_SESSION['password'];
|
||||
|
|
|
@ -104,7 +104,6 @@ function getAuthUser($auth) {
|
|||
} // end getAuthUser($auth)
|
||||
|
||||
function generateAuthHash($useRemoteAddr, $force=false) {
|
||||
$auth = '';
|
||||
if ( ZM_OPT_USE_AUTH and ZM_AUTH_RELAY == 'hashed' and isset($_SESSION['username']) and $_SESSION['passwordHash'] ) {
|
||||
# regenerate a hash at half the liftetime of a hash, an hour is 3600 so half is 1800
|
||||
$time = time();
|
||||
|
@ -121,18 +120,21 @@ function generateAuthHash($useRemoteAddr, $force=false) {
|
|||
}
|
||||
#Logger::Debug("Generated using hour:".$local_time[2] . ' mday:' . $local_time[3] . ' month:'.$local_time[4] . ' year: ' . $local_time[5] );
|
||||
$auth = md5($authKey);
|
||||
if ( ! $force ) {
|
||||
if ( !$force ) {
|
||||
session_start();
|
||||
$_SESSION['AuthHash'] = $auth;
|
||||
$_SESSION['AuthHashGeneratedAt'] = $time;
|
||||
session_write_close();
|
||||
} else {
|
||||
return $auth;
|
||||
}
|
||||
#Logger::Debug("Generated new auth $auth at " . $_SESSION['AuthHashGeneratedAt']. " using $authKey" );
|
||||
#} else {
|
||||
#Logger::Debug("Using cached auth " . $_SESSION['AuthHash'] ." beacuse generatedat:" . $_SESSION['AuthHashGeneratedAt'] . ' < now:'. $time . ' - ' . ZM_AUTH_HASH_TTL . ' * 1800 = '. $mintime);
|
||||
} # end if AuthHash is not cached
|
||||
}
|
||||
return $auth;
|
||||
return $_SESSION['AuthHash'];
|
||||
} # end if using AUTH and AUTH_RELAY
|
||||
return '';
|
||||
}
|
||||
|
||||
function visibleMonitor($mid) {
|
||||
|
|
|
@ -2159,12 +2159,13 @@ function getStreamHTML( $monitor, $options = array() ) {
|
|||
$options['buffer'] = $monitor->StreamReplayBuffer();
|
||||
//Warning("width: " . $options['width'] . ' height: ' . $options['height']. ' scale: ' . $options['scale'] );
|
||||
|
||||
if ( $monitor->Type() == "WebSite" ) {
|
||||
return getWebSiteUrl( 'liveStream'.$monitor->Id(), $monitor->Path(),
|
||||
( isset($options['width']) ? $options['width'] : NULL ),
|
||||
( isset($options['height']) ? $options['height'] : NULL ),
|
||||
$monitor->Name()
|
||||
);
|
||||
if ( $monitor->Type() == 'WebSite' ) {
|
||||
return getWebSiteUrl(
|
||||
'liveStream'.$monitor->Id(), $monitor->Path(),
|
||||
( isset($options['width']) ? $options['width'] : NULL ),
|
||||
( isset($options['height']) ? $options['height'] : NULL ),
|
||||
$monitor->Name()
|
||||
);
|
||||
//FIXME, the width and height of the image need to be scaled.
|
||||
} else if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
|
||||
$streamSrc = $monitor->getStreamSrc( array(
|
||||
|
@ -2177,7 +2178,7 @@ function getStreamHTML( $monitor, $options = array() ) {
|
|||
return getVideoStreamHTML( 'liveStream'.$monitor->Id(), $streamSrc, $options['width'], $options['height'], ZM_MPEG_LIVE_FORMAT, $monitor->Name() );
|
||||
} else if ( $options['mode'] == 'stream' and canStream() ) {
|
||||
$options['mode'] = 'jpeg';
|
||||
$streamSrc = $monitor->getStreamSrc( $options );
|
||||
$streamSrc = $monitor->getStreamSrc($options);
|
||||
|
||||
if ( canStreamNative() )
|
||||
return getImageStreamHTML( 'liveStream'.$monitor->Id(), $streamSrc, $options['width'], $options['height'], $monitor->Name());
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
require_once('includes/Monitor.php');
|
||||
|
||||
if ( !canView( 'Stream' ) ) {
|
||||
if ( !canView('Stream') ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
}
|
||||
|
@ -31,24 +31,24 @@ if ( ! isset($_REQUEST['mid']) ) {
|
|||
}
|
||||
|
||||
// This is for input sanitation
|
||||
$mid = intval( $_REQUEST['mid'] );
|
||||
if ( ! visibleMonitor( $mid ) ) {
|
||||
$mid = intval($_REQUEST['mid']);
|
||||
if ( ! visibleMonitor($mid) ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$monitor = new Monitor( $mid );
|
||||
$monitor = new Monitor($mid);
|
||||
|
||||
#Whether to show the controls button
|
||||
$showPtzControls = ( ZM_OPT_CONTROL && $monitor->Controllable() && canView('Control') && $monitor->Type() != 'WebSite' );
|
||||
|
||||
if ( isset( $_REQUEST['scale'] ) ) {
|
||||
if ( isset($_REQUEST['scale']) ) {
|
||||
$scale = validInt($_REQUEST['scale']);
|
||||
} else if ( isset( $_COOKIE['zmWatchScale'.$mid] ) ) {
|
||||
} else if ( isset($_COOKIE['zmWatchScale'.$mid]) ) {
|
||||
$scale = $_COOKIE['zmWatchScale'.$mid];
|
||||
} else {
|
||||
$scale = reScale( SCALE_BASE, $monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE );
|
||||
$scale = reScale(SCALE_BASE, $monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE);
|
||||
}
|
||||
|
||||
$connkey = generateConnKey();
|
||||
|
@ -59,7 +59,7 @@ noCacheHeaders();
|
|||
|
||||
$popup = ((isset($_REQUEST['popup'])) && ($_REQUEST['popup'] == 1));
|
||||
|
||||
xhtmlHeaders( __FILE__, $monitor->Name()." - ".translate('Feed') );
|
||||
xhtmlHeaders( __FILE__, $monitor->Name().' - '.translate('Feed') );
|
||||
?>
|
||||
<body>
|
||||
<div id="page">
|
||||
|
@ -82,11 +82,16 @@ if ( canView( 'Control' ) && $monitor->Type() == 'Local' ) {
|
|||
<div id="imageFeed"><?php echo getStreamHTML( $monitor, array('scale'=>$scale) ); ?></div>
|
||||
<?php if ( $monitor->Type() != 'WebSite' ) { ?>
|
||||
<div id="monitorStatus">
|
||||
<?php if ( canEdit( 'Monitors' ) ) { ?>
|
||||
<div id="enableDisableAlarms"><a id="enableAlarmsLink" href="#" onclick="cmdEnableAlarms(); return( false );" class="hidden"><?php echo translate('EnableAlarms') ?></a><a id="disableAlarmsLink" href="#" onclick="cmdDisableAlarms(); return( false );" class="hidden"><?php echo translate('DisableAlarms') ?></a></div>
|
||||
<?php if ( canEdit('Monitors') ) { ?>
|
||||
<div id="enableDisableAlarms">
|
||||
<a id="enableAlarmsLink" href="#" onclick="cmdEnableAlarms();return false;" class="hidden">
|
||||
<?php echo translate('EnableAlarms') ?></a>
|
||||
<a id="disableAlarmsLink" href="#" onclick="cmdDisableAlarms();return false;" class="hidden">
|
||||
<?php echo translate('DisableAlarms') ?></a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
if ( canEdit( 'Monitors' ) ) {
|
||||
if ( canEdit('Monitors') ) {
|
||||
?>
|
||||
<div id="forceCancelAlarm">
|
||||
<a id="forceAlarmLink" href="#" onclick="cmdForceAlarm();"><?php echo translate('ForceAlarm') ?></a>
|
||||
|
|
Loading…
Reference in New Issue