Merge branch 'release-1.34'

This commit is contained in:
Isaac Connor 2020-04-23 10:26:16 -04:00
commit e770be2e13
6 changed files with 54 additions and 52 deletions

View File

@ -301,7 +301,7 @@ sub zmMemVerify {
}
return !undef;
}
} # end sub zmMemVerify
sub zmMemRead {
my $monitor = shift;
@ -375,10 +375,8 @@ sub zmMemInvalidate {
my $mem_key = zmMemKey($monitor);
if ( $mem_key ) {
zmMemDetach($monitor);
} else {
Warning('no memkey in zmMemInvalidate');
}
}
} # end sub zmMemInvalidate
sub zmMemTidy {
zmMemClean();
@ -504,10 +502,10 @@ sub zmHasAlarmed {
my $last_event_id = shift;
my ( $state, $last_event ) = zmMemRead($monitor,
['shared_data:state' ,'shared_data:last_event']
['shared_data:state', 'shared_data:last_event']
);
if ( $state == STATE_ALARM || $state == STATE_ALERT ) {
if ( $state == STATE_ALARM or $state == STATE_ALERT ) {
return $last_event;
} elsif( $last_event != $last_event_id ) {
return $last_event;

View File

@ -51,7 +51,7 @@ our %EXPORT_TAGS = (
);
push( @{$EXPORT_TAGS{all}}, @{$EXPORT_TAGS{$_}} ) foreach keys %EXPORT_TAGS;
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{all} } );
our @EXPORT = @EXPORT_OK;
@ -77,17 +77,17 @@ sub zmMemAttach {
my ( $monitor, $size ) = @_;
if ( !$size ) {
Error("No size passed to zmMemAttach for monitor $$monitor{Id}");
Error('No size passed to zmMemAttach for monitor '.$$monitor{Id});
return undef;
}
if ( defined($monitor->{MMapAddr}) ) {
Debug("zmMemAttach already attached at $monitor->{MMapAddr}");
Debug("zmMemAttach already attached at $monitor->{MMapAddr} for $$monitor{Id}");
return !undef;
}
my $mmap_file = $Config{ZM_PATH_MAP}.'/zm.mmap.'.$monitor->{Id};
if ( ! -e $mmap_file ) {
Error("Memory map file '$mmap_file' does not exist. zmc might not be running.");
Error("Memory map file '$mmap_file' does not exist in zmMemAttach. zmc might not be running.");
return undef;
}
my $mmap_file_size = -s $mmap_file;
@ -119,18 +119,24 @@ sub zmMemDetach {
if ( $monitor->{MMap} ) {
if ( ! munmap(${$monitor->{MMap}}) ) {
Warn( "Unable to munmap for monitor $$monitor{Id}\n");
Warn("Unable to munmap for monitor $$monitor{Id}");
}
delete $monitor->{MMap};
} else {
Warn("No MMap for $$monitor{Id}");
}
if ( $monitor->{MMapAddr} ) {
delete $monitor->{MMapAddr};
} else {
Warn("No MMapAddr in $$monitor{Id}");
}
if ( $monitor->{MMapHandle} ) {
close($monitor->{MMapHandle});
delete $monitor->{MMapHandle};
} else {
Warn("No MMapHandle in $$monitor{Id}");
}
}
} # end sub zmMemDetach
sub zmMemGet {
my $monitor = shift;
@ -162,7 +168,7 @@ sub zmMemPut {
}
sub zmMemClean {
Debug("Removing memory map files");
Debug('Removing memory map files');
my $mapPath = $Config{ZM_PATH_MAP}.'/zm.mmap.*';
foreach my $mapFile( glob( $mapPath ) ) {
( $mapFile ) = $mapFile =~ /^(.+)$/;

View File

@ -29,8 +29,13 @@ if ( ('login' == $action) && isset($_REQUEST['username']) && ( ZM_AUTH_TYPE == '
&& defined('ZM_OPT_GOOG_RECAPTCHA_SITEKEY')
&& ZM_OPT_USE_GOOG_RECAPTCHA
&& ZM_OPT_GOOG_RECAPTCHA_SECRETKEY
&& ZM_OPT_GOOG_RECAPTCHA_SITEKEY )
{
&& ZM_OPT_GOOG_RECAPTCHA_SITEKEY
) {
if ( !isset($_REQUEST['g-recaptcha-response']) ) {
ZM\Error('reCaptcha authentication failed. No g-recpatcha-response in REQUEST: ');
unset($user); // unset should be ok here because we aren't in a function
return;
}
$url = 'https://www.google.com/recaptcha/api/siteverify';
$fields = array (
'secret' => ZM_OPT_GOOG_RECAPTCHA_SECRETKEY,

View File

@ -1,6 +1,6 @@
<?php
//
// ZoneMinder web function library, $Date: 2008-07-08 16:06:45 +0100 (Tue, 08 Jul 2008) $, $Revision: 2484 $
// ZoneMinder web function library
// Copyright (C) 2001-2008 Philip Coombes
//
// This program is free software; you can redistribute it and/or
@ -146,11 +146,7 @@ if ( $css != 'base' )
</script>
<script src="<?php echo cache_bust('skins/'.$skin.'/views/js/state.js') ?>"></script>
<?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>
<?php
} else if ( $view == 'event' ) {
if ( $view == 'event' ) {
?>
<link href="skins/<?php echo $skin ?>/js/video-js.css" rel="stylesheet">
<link href="skins/<?php echo $skin ?>/js/video-js-skin.css" rel="stylesheet">
@ -341,22 +337,22 @@ if ( $user and $user['Username'] ) {
<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>
<li><a href="?view=report_event_audit"<?php echo $view=='report_event_audit'?' class="selected"':''?>><?php echo translate('ReportEventAudit') ?></a></li>
<?php
}
} // end if canView(Events)
?>
<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>
</ul>
<div class="navbar-right">
<div class="navbar-right">
<?php
if ( ZM_OPT_USE_AUTH and $user ) {
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')) ?>
<?php echo makePopupLink('?view=logout', 'zmLogout', 'logout', $user['Username'], (ZM_AUTH_TYPE == 'builtin') ) ?>
</p>
<?php
}
if ( canEdit('System') ) {
<?php
}
if ( canEdit('System') ) {
?>
<button type="button" class="btn btn-default navbar-btn" data-toggle="modal" data-target="#modalState"><?php echo $status ?></button>
<?php if ( ZM_SYSTEM_SHUTDOWN ) { ?>
@ -367,7 +363,9 @@ if ( canEdit('System') ) {
<?php } else if ( canView('System') ) { ?>
<p class="navbar-text"><?php echo $status ?></p>
<?php } ?>
</div>
</div>
<?php } else { # end if !$user or $user['Id'] meaning logged in ?>
</ul>
<?php } # end if !$user or $user['Id'] meaning logged in ?>
</div><!-- End .navbar-collapse -->
</div> <!-- End .container-fluid -->

View File

@ -138,11 +138,7 @@ function validateForm( form ) {
if ( (form.elements['newMonitor[SaveJPEGs]'].value == '0') && (form.elements['newMonitor[VideoWriter]'].value == '0') ) {
warnings[warnings.length] = "<?php echo translate('BadNoSaveJPEGsOrVideoWriter'); ?>";
}
console.log(form.elements['newMonitor[SaveJPEGs]'].value);
console.log(form.elements['newMonitor[VideoWriter]'].value);
}
console.log(warnings);
if ( warnings.length ) {
if ( !confirm(warnings.join("\n")) ) {
return false;

View File

@ -22,18 +22,17 @@ xhtmlHeaders(__FILE__, translate('Login'));
<label for="inputPassword" class="sr-only"><?php echo translate('Password') ?></label>
<input type="password" id="inputPassword" name="password" class="form-control" placeholder="Password" required autocomplete="current-password"/>
<?php
if (defined('ZM_OPT_USE_GOOG_RECAPTCHA')
<?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>';
} ?>
&& 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>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>';
} ?>
<button class="btn btn-lg btn-primary btn-block" type="submit"><?php echo translate('Login') ?></button>
</div>
</form>
</div>