Merge ../ZoneMinder.master into storageareas

This commit is contained in:
Isaac Connor 2016-10-26 14:46:39 -04:00
commit fb96b262d7
10 changed files with 110 additions and 99 deletions

View File

@ -1711,7 +1711,7 @@ our @options =
}, },
{ {
name => "ZM_OPT_FAST_DELETE", name => "ZM_OPT_FAST_DELETE",
default => "yes", default => "no",
description => "Delete only event database records for speed", description => "Delete only event database records for speed",
help => qqq(" help => qqq("
Normally an event created as the result of an alarm consists of Normally an event created as the result of an alarm consists of
@ -1722,7 +1722,8 @@ our @options =
option which means that the browser client only deletes the key option which means that the browser client only deletes the key
entries in the events table, which means the events will no entries in the events table, which means the events will no
longer appear in the listing, and leaves the zmaudit daemon to longer appear in the listing, and leaves the zmaudit daemon to
clear up the rest later. clear up the rest later. Note that this feature is less relevant
with modern hardware. Recommend this feature be left off.
"), "),
type => $types{boolean}, type => $types{boolean},
category => "system", category => "system",

View File

@ -1,5 +1,5 @@
<VirtualHost *:80> <VirtualHost *:80>
DocumentRoot /var/www/zm DocumentRoot /usr/local/share/zoneminder
DirectoryIndex index.php DirectoryIndex index.php
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

View File

@ -72,7 +72,7 @@ class DATABASE_CONFIG {
'password' => ZM_DB_PASS, 'password' => ZM_DB_PASS,
'database' => ZM_DB_NAME, 'database' => ZM_DB_NAME,
'prefix' => '', 'prefix' => '',
//'encoding' => 'utf8', 'encoding' => 'utf8',
); );
public $test = array( public $test = array(

View File

@ -99,7 +99,18 @@ class HostController extends AppController {
)); ));
} }
function getTimeZone()
{
//http://php.net/manual/en/function.date-default-timezone-get.php
$tz = date_default_timezone_get();
$this->set(array(
'tz' => $tz,
'_serialize' => array('tz')
));
}
function getVersion() { function getVersion() {
//throw new UnauthorizedException(__('API Disabled'));
$version = Configure::read('ZM_VERSION'); $version = Configure::read('ZM_VERSION');
// not going to use the ZM_API_VERSION // not going to use the ZM_API_VERSION
// requires recompilation and dependency on ZM upgrade // requires recompilation and dependency on ZM upgrade

View File

@ -536,10 +536,6 @@ function makePopupButton( $url, $winName, $winSize, $buttonValue, $condition=1,
return( $string ); return( $string );
} }
function truncText( $text, $length, $deslash=1 ) {
return( preg_replace( "/^(.{".$length.",}?)\b.*$/", "\\1&hellip;", ($deslash?stripslashes($text):$text) ) );
}
function htmlSelect( $name, $contents, $values, $behaviours=false ) { function htmlSelect( $name, $contents, $values, $behaviours=false ) {
$behaviourText = ""; $behaviourText = "";
@ -562,6 +558,10 @@ function htmlSelect( $name, $contents, $values, $behaviours=false ) {
return $html; return $html;
} }
function truncText( $text, $length, $deslash=1 ) {
return( preg_replace( "/^(.{".$length.",}?)\b.*$/", "\\1&hellip;", ($deslash?stripslashes($text):$text) ) );
}
function buildSelect( $name, $contents, $behaviours=false ) function buildSelect( $name, $contents, $behaviours=false )
{ {
$value = ""; $value = "";

View File

@ -1,3 +1,7 @@
#scaleControl {
float: right;
}
#controls { #controls {
width: 80%; width: 80%;
text-align: center; text-align: center;

View File

@ -29,19 +29,19 @@ $eid = validInt($_REQUEST['eid']);
if ( !empty($_REQUEST['fid']) ) if ( !empty($_REQUEST['fid']) )
$fid = validInt($_REQUEST['fid']); $fid = validInt($_REQUEST['fid']);
$sql = 'SELECT E.*,M.Name AS MonitorName,M.DefaultScale,M.VideoWriter FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?'; $Event = new Event( $eid );
$event = dbFetchOne( $sql, NULL, array($eid) ); $Monitor = $Event->Monitor();
if ( !empty($fid) ) { if ( !empty($fid) ) {
$sql = 'SELECT * FROM Frames WHERE EventId = ? AND FrameId = ?'; $sql = 'SELECT * FROM Frames WHERE EventId = ? AND FrameId = ?';
if ( !($frame = dbFetchOne( $sql, NULL, array($eid, $fid) )) ) if ( !($frame = dbFetchOne( $sql, NULL, array($eid, $fid) )) )
$frame = array( 'FrameId'=>$fid, 'Type'=>'Normal', 'Score'=>0 ); $frame = array( 'FrameId'=>$fid, 'Type'=>'Normal', 'Score'=>0 );
} else { } else {
$frame = dbFetchOne( 'SELECT * FROM Frames WHERE EventId = ? AND Score = ?', NULL, array( $eid, $event['MaxScore'] ) ); $frame = dbFetchOne( 'SELECT * FROM Frames WHERE EventId = ? AND Score = ?', NULL, array( $eid, $Event->MaxScore() ) );
} }
$Frame = new Frame( $frame ); $Frame = new Frame( $frame );
$maxFid = $event['Frames']; $maxFid = $Event->Frames();
$firstFid = 1; $firstFid = 1;
$prevFid = $Frame->FrameId()-1; $prevFid = $Frame->FrameId()-1;
@ -50,10 +50,15 @@ $lastFid = $maxFid;
$alarmFrame = $Frame->Type()=='Alarm'; $alarmFrame = $Frame->Type()=='Alarm';
if ( isset( $_REQUEST['scale'] ) ) if ( isset( $_REQUEST['scale'] ) ) {
$scale = validInt($_REQUEST['scale']); $scale = validInt($_REQUEST['scale']);
else } else if ( isset( $_COOKIE['zmWatchScale'.$Monitor->Id()] ) ) {
$scale = max( reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE ); $scale = $_COOKIE['zmWatchScale'.$Monitor->Id()];
} else if ( isset( $_COOKIE['zmWatchScale'] ) ) {
$scale = $_COOKIE['zmWatchScale'];
} else {
$scale = max( reScale( SCALE_BASE, $Monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
}
$show = 'capt'; $show = 'capt';
if ( isset($_REQUEST['show']) ) { if ( isset($_REQUEST['show']) ) {
@ -61,7 +66,7 @@ if ( isset($_REQUEST['show']) ) {
#} else if ( $imageData['hasAnalImage'] ) { #} else if ( $imageData['hasAnalImage'] ) {
#$show = 'anal'; #$show = 'anal';
} }
$imageData = getImageSrc( $event, $frame, $scale, ($show=="capt") ); $imageData = $Event->getImageSrc( $frame, $scale, ($show=="capt") );
$imagePath = $imageData['thumbPath']; $imagePath = $imageData['thumbPath'];
$eventPath = $imageData['eventPath']; $eventPath = $imageData['eventPath'];
@ -70,38 +75,43 @@ $rImagePath = sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-diag-r.jpg", $eventPath,
$focusWindow = true; $focusWindow = true;
xhtmlHeaders(__FILE__, translate('Frame')." - ".$event['Id']." - ".$Frame->FrameId() ); xhtmlHeaders(__FILE__, translate('Frame')." - ".$Event->Id()." - ".$Frame->FrameId() );
?> ?>
<body> <body>
<div id="page"> <div id="page">
<div id="header"> <div id="header">
<form>
<div id="headerButtons"> <div id="headerButtons">
<?php if ( ZM_RECORD_EVENT_STATS && $alarmFrame ) { echo makePopupLink( '?view=stats&amp;eid='.$event['Id'].'&amp;fid='.$Frame->FrameId(), 'zmStats', 'stats', translate('Stats') ); } ?> <?php if ( ZM_RECORD_EVENT_STATS && $alarmFrame ) { echo makePopupLink( '?view=stats&amp;eid='.$Event->Id().'&amp;fid='.$Frame->FrameId(), 'zmStats', 'stats', translate('Stats') ); } ?>
<?php if ( canEdit( 'Events' ) ) { ?><a href="?view=none&amp;action=delete&amp;markEid=<?php echo $event['Id'] ?>"><?php echo translate('Delete') ?></a><?php } ?> <?php if ( canEdit( 'Events' ) ) { ?><a href="?view=none&amp;action=delete&amp;markEid=<?php echo $Event->Id() ?>"><?php echo translate('Delete') ?></a><?php } ?>
<a href="#" onclick="closeWindow(); return( false );"><?php echo translate('Close') ?></a> <a href="#" onclick="closeWindow(); return( false );"><?php echo translate('Close') ?></a>
</div> </div>
<h2><?php echo translate('Frame') ?> <?php echo $event['Id']."-".$Frame->FrameId()." (".$Frame->Score().")" ?></h2> <div id="scaleControl"><label for="scale"><?php echo translate('Scale') ?></label><?php echo buildSelect( "scale", $scales, "changeScale();" ); ?></div>
<h2><?php echo translate('Frame') ?> <?php echo $Event->Id()."-".$Frame->FrameId()." (".$Frame->Score().")" ?></h2>
<input type="hidden" name="base_width" id="base_width" value="<?php echo $Event->Width(); ?>"/>
<input type="hidden" name="base_height" id="base_height" value="<?php echo $Event->Height(); ?>"/>
</form>
</div> </div>
<div id="content"> <div id="content">
<p id="image"> <p id="image">
<a href="?view=frame&amp;eid=<?php echo $event['Id'] ?>&amp;fid=<?php echo $Frame->FrameId() ?>&amp;scale=<?php echo $scale ?>&amp;show=<?php echo $show == 'anal' ? 'capt':'anal' ?>"> <a href="?view=frame&amp;eid=<?php echo $Event->Id() ?>&amp;fid=<?php echo $Frame->FrameId() ?>&amp;scale=<?php echo $scale ?>&amp;show=<?php echo $show == 'anal' ? 'capt':'anal' ?>">
<img src="<?php echo $Frame->getImageSrc($imageData['isAnalImage']?'analyse':'capture') ?>" width="<?php echo reScale( $event['Width'], $event['DefaultScale'], $scale ) ?>" height="<?php echo reScale( $event['Height'], $event['DefaultScale'], $scale ) ?>" alt="<?php echo $Frame->EventId()."-".$Frame->FrameId() ?>" class="<?php echo $imageData['imageClass'] ?>"/> <img id="frameImg" src="<?php echo $Frame->getImageSrc($imageData['isAnalImage']?'analyse':'capture') ?>" width="<?php echo reScale( $Event->Width(), $Monitor->DefaultScale(), $scale ) ?>" height="<?php echo reScale( $Event->Height(), $Monitor->DefaultScale(), $scale ) ?>" alt="<?php echo $Frame->EventId()."-".$Frame->FrameId() ?>" class="<?php echo $imageData['imageClass'] ?>"/>
</p> </p>
<p id="controls"> <p id="controls">
<?php if ( $Frame->FrameId() > 1 ) { ?> <?php if ( $Frame->FrameId() > 1 ) { ?>
<a id="firstLink" href="?view=frame&amp;eid=<?php echo $event['Id'] ?>&amp;fid=<?php echo $firstFid ?>&amp;scale=<?php echo $scale ?>&amp;show=<?php echo $show ?>"><?php echo translate('First') ?></a> <a id="firstLink" href="?view=frame&amp;eid=<?php echo $Event->Id() ?>&amp;fid=<?php echo $firstFid ?>&amp;scale=<?php echo $scale ?>&amp;show=<?php echo $show ?>"><?php echo translate('First') ?></a>
<a id="prevLink" href="?view=frame&amp;eid=<?php echo $event['Id'] ?>&amp;fid=<?php echo $prevFid ?>&amp;scale=<?php echo $scale ?>&amp;show=<?php echo $show ?>"><?php echo translate('Prev') ?></a> <a id="prevLink" href="?view=frame&amp;eid=<?php echo $Event->Id() ?>&amp;fid=<?php echo $prevFid ?>&amp;scale=<?php echo $scale ?>&amp;show=<?php echo $show ?>"><?php echo translate('Prev') ?></a>
<?php } if ( $Frame->FrameId() < $maxFid ) { ?> <?php } if ( $Frame->FrameId() < $maxFid ) { ?>
<a id="nextLink" href="?view=frame&amp;eid=<?php echo $event['Id'] ?>&amp;fid=<?php echo $nextFid ?>&amp;scale=<?php echo $scale ?>&amp;show=<?php echo $show ?>"><?php echo translate('Next') ?></a> <a id="nextLink" href="?view=frame&amp;eid=<?php echo $Event->Id() ?>&amp;fid=<?php echo $nextFid ?>&amp;scale=<?php echo $scale ?>&amp;show=<?php echo $show ?>"><?php echo translate('Next') ?></a>
<a id="lastLink" href="?view=frame&amp;eid=<?php echo $event['Id'] ?>&amp;fid=<?php echo $lastFid ?>&amp;scale=<?php echo $scale ?>&amp;show=<?php echo $show ?>"><?php echo translate('Last') ?></a> <a id="lastLink" href="?view=frame&amp;eid=<?php echo $Event->Id() ?>&amp;fid=<?php echo $lastFid ?>&amp;scale=<?php echo $scale ?>&amp;show=<?php echo $show ?>"><?php echo translate('Last') ?></a>
<?php } ?> <?php } ?>
</p> </p>
<?php if (file_exists ($dImagePath)) { ?> <?php if (file_exists ($dImagePath)) { ?>
<p id="diagImagePath"><?php echo $dImagePath ?></p> <p id="diagImagePath"><?php echo $dImagePath ?></p>
<p id="diagImage"><img src="<?php echo viewImagePath( $dImagePath ) ?>" width="<?php echo reScale( $event['Width'], $event['DefaultScale'], $scale ) ?>" height="<?php echo reScale( $event['Height'], $event['DefaultScale'], $scale ) ?>" class="<?php echo $imageData['imageClass'] ?>"/></p> <p id="diagImage"><img src="<?php echo viewImagePath( $dImagePath ) ?>" width="<?php echo reScale( $Event->Width(), $Monitor->DefaultScale(), $scale ) ?>" height="<?php echo reScale( $Event->Height(), $Monitor->DefaultScale(), $scale ) ?>" class="<?php echo $imageData['imageClass'] ?>"/></p>
<?php } if (file_exists ($rImagePath)) { ?> <?php } if (file_exists ($rImagePath)) { ?>
<p id="refImagePath"><?php echo $rImagePath ?></p> <p id="refImagePath"><?php echo $rImagePath ?></p>
<p id="refImage"><img src="<?php echo viewImagePath( $rImagePath ) ?>" width="<?php echo reScale( $event['Width'], $event['DefaultScale'], $scale ) ?>" height="<?php echo reScale( $event['Height'], $event['DefaultScale'], $scale ) ?>" class="<?php echo $imageData['imageClass'] ?>"/></p> <p id="refImage"><img src="<?php echo viewImagePath( $rImagePath ) ?>" width="<?php echo reScale( $Event->Width(), $Monitor->DefaultScale(), $scale ) ?>" height="<?php echo reScale( $Event->Height(), $Monitor->DefaultScale(), $scale ) ?>" class="<?php echo $imageData['imageClass'] ?>"/></p>
<?php } ?> <?php } ?>
</div> </div>
</div> </div>

View File

@ -0,0 +1,15 @@
function changeScale() {
var scale = $('scale').get('value');
var img = $('frameImg');
if ( img ) {
var baseWidth = $('base_width').value;
var baseHeight = $('base_height').value;
var newWidth = ( baseWidth * scale ) / SCALE_BASE;
var newHeight = ( baseHeight * scale ) / SCALE_BASE;
img.style.width = newWidth + "px";
img.style.height = newHeight + "px";
}
Cookie.write( 'zmWatchScale', scale, { duration: 10*365 } );
}

View File

@ -0,0 +1,2 @@
var SCALE_BASE = <?php echo SCALE_BASE ?>;

View File

@ -2,72 +2,40 @@
xhtmlHeaders(__FILE__, translate('Login') ); xhtmlHeaders(__FILE__, translate('Login') );
?> ?>
<body> <body>
<style> <div id="page">
body { <div id="header">
background-color: #f8f8f8; <h1>ZoneMinder <?php echo translate('Login') ?></h1>
} </div>
<div id="content">
input[type="text"] { <form name="loginForm" id="loginForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
margin-bottom: -1px; <input type="hidden" name="action" value="login"/>
border-bottom-right-radius: 0; <input type="hidden" name="view" value="postlogin"/>
border-bottom-left-radius: 0; <input type="hidden" name="postLoginQuery" value="<?php echo $_SERVER['QUERY_STRING'] ?>">
} <table id="loginTable" class="minor" cellspacing="0">
<tbody>
input[type="password"] { <tr>
margin-bottom: 10px; <td class="colLeft"><?php echo translate('Username') ?></td>
border-top-left-radius: 0; <td class="colRight"><input type="text" name="username" autocorrect="off" autocapitalize="off" spellcheck="false" value="<?php echo isset($_REQUEST['username'])?validHtmlStr($_REQUEST['username']):"" ?>" size="12"/></td>
border-top-right-radius: 0; </tr>
} <tr>
<td class="colLeft"><?php echo translate('Password') ?></td>
input[type="submit"] { <td class="colRight"><input type="password" name="password" value="" size="12"/></td>
margin-top: 20px; </tr>
} </tbody>
</table>
form { <input type="submit" value="<?php echo translate('Login') ?>"/>
max-width: 450px; <!-- PP: Added recaptcha widget if enabled -->
padding: 40px 60px; <?php
margin: 15px auto; if (defined('ZM_OPT_USE_GOOG_RECAPTCHA')
border: 1px solid #e7e7e7; && defined('ZM_OPT_GOOG_RECAPTCHA_SITEKEY')
background-color: #fff; && defined('ZM_OPT_GOOG_RECAPTCHA_SECRETKEY')
box-shadow: 0 0 6px 0 rgba(0,0,0,0.08); && ZM_OPT_USE_GOOG_RECAPTCHA && ZM_OPT_GOOG_RECAPTCHA_SITEKEY && ZM_OPT_GOOG_RECAPTCHA_SECRETKEY)
} {
echo "<br/><br/><center> <div class='g-recaptcha' data-sitekey='".ZM_OPT_GOOG_RECAPTCHA_SITEKEY."'></div> </center>";
.form-control { }
height: 54px; ?>
} </form>
</div>
h1 { </div>
font-size: 250%;
margin-top: 0;
margin-bottom: 15px;
}
</style>
<div class="container">
<form class="center-block" name="loginForm" id="loginForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="action" value="login"/>
<input type="hidden" name="view" value="postlogin"/>
<input type="hidden" name="postLoginQuery" value="<?php echo $_SERVER['QUERY_STRING'] ?>">
<h1><?php echo translate('Login') ?></h1>
<label for="inputEmail" class="sr-only"><?php echo translate('Username') ?></label>
<input type="text" name="username" class="form-control" placeholder="Username" required autofocus />
<label for="inputPassword" class="sr-only"><?php echo translate('Password') ?></label>
<input type="password" name="password" value="" size="12" class="form-control" placeholder="Password" required />
<?php
if (defined('ZM_OPT_USE_GOOG_RECAPTCHA')
&& defined('ZM_OPT_GOOG_RECAPTCHA_SITEKEY')
&& defined('ZM_OPT_GOOG_RECAPTCHA_SECRETKEY')
&& ZM_OPT_USE_GOOG_RECAPTCHA && ZM_OPT_GOOG_RECAPTCHA_SITEKEY && ZM_OPT_GOOG_RECAPTCHA_SECRETKEY)
{
echo "<div class='g-recaptcha' data-sitekey='".ZM_OPT_GOOG_RECAPTCHA_SITEKEY."'></div>";
} ?>
<input class="btn btn-lg btn-primary btn-block" type="submit" value="<?php echo translate('Login') ?>"/>
</form>
</div>
</body> </body>
</html> </html>