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; return !undef;
} } # end sub zmMemVerify
sub zmMemRead { sub zmMemRead {
my $monitor = shift; my $monitor = shift;
@ -375,10 +375,8 @@ sub zmMemInvalidate {
my $mem_key = zmMemKey($monitor); my $mem_key = zmMemKey($monitor);
if ( $mem_key ) { if ( $mem_key ) {
zmMemDetach($monitor); zmMemDetach($monitor);
} else {
Warning('no memkey in zmMemInvalidate');
}
} }
} # end sub zmMemInvalidate
sub zmMemTidy { sub zmMemTidy {
zmMemClean(); zmMemClean();
@ -507,7 +505,7 @@ sub zmHasAlarmed {
['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; return $last_event;
} elsif( $last_event != $last_event_id ) { } elsif( $last_event != $last_event_id ) {
return $last_event; return $last_event;

View File

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

View File

@ -29,8 +29,13 @@ if ( ('login' == $action) && isset($_REQUEST['username']) && ( ZM_AUTH_TYPE == '
&& defined('ZM_OPT_GOOG_RECAPTCHA_SITEKEY') && defined('ZM_OPT_GOOG_RECAPTCHA_SITEKEY')
&& ZM_OPT_USE_GOOG_RECAPTCHA && ZM_OPT_USE_GOOG_RECAPTCHA
&& ZM_OPT_GOOG_RECAPTCHA_SECRETKEY && 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'; $url = 'https://www.google.com/recaptcha/api/siteverify';
$fields = array ( $fields = array (
'secret' => ZM_OPT_GOOG_RECAPTCHA_SECRETKEY, 'secret' => ZM_OPT_GOOG_RECAPTCHA_SECRETKEY,

View File

@ -1,6 +1,6 @@
<?php <?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 // Copyright (C) 2001-2008 Philip Coombes
// //
// This program is free software; you can redistribute it and/or // This program is free software; you can redistribute it and/or
@ -146,11 +146,7 @@ if ( $css != 'base' )
</script> </script>
<script src="<?php echo cache_bust('skins/'.$skin.'/views/js/state.js') ?>"></script> <script src="<?php echo cache_bust('skins/'.$skin.'/views/js/state.js') ?>"></script>
<?php <?php
if ( $title == 'Login' && (defined('ZM_OPT_USE_GOOG_RECAPTCHA') && ZM_OPT_USE_GOOG_RECAPTCHA) ) { if ( $view == 'event' ) {
?>
<script src='https://www.google.com/recaptcha/api.js'></script>
<?php
} else if ( $view == 'event' ) {
?> ?>
<link href="skins/<?php echo $skin ?>/js/video-js.css" rel="stylesheet"> <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"> <link href="skins/<?php echo $skin ?>/js/video-js-skin.css" rel="stylesheet">
@ -341,7 +337,7 @@ 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=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> <li><a href="?view=report_event_audit"<?php echo $view=='report_event_audit'?' class="selected"':''?>><?php echo translate('ReportEventAudit') ?></a></li>
<?php <?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> <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> </ul>
@ -368,6 +364,8 @@ if ( canEdit('System') ) {
<p class="navbar-text"><?php echo $status ?></p> <p class="navbar-text"><?php echo $status ?></p>
<?php } ?> <?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 ?> <?php } # end if !$user or $user['Id'] meaning logged in ?>
</div><!-- End .navbar-collapse --> </div><!-- End .navbar-collapse -->
</div> <!-- End .container-fluid --> </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') ) { if ( (form.elements['newMonitor[SaveJPEGs]'].value == '0') && (form.elements['newMonitor[VideoWriter]'].value == '0') ) {
warnings[warnings.length] = "<?php echo translate('BadNoSaveJPEGsOrVideoWriter'); ?>"; 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 ( warnings.length ) {
if ( !confirm(warnings.join("\n")) ) { if ( !confirm(warnings.join("\n")) ) {
return false; return false;

View File

@ -22,18 +22,17 @@ xhtmlHeaders(__FILE__, translate('Login'));
<label for="inputPassword" class="sr-only"><?php echo translate('Password') ?></label> <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"/> <input type="password" id="inputPassword" name="password" class="form-control" placeholder="Password" required autocomplete="current-password"/>
<?php <?php
if (defined('ZM_OPT_USE_GOOG_RECAPTCHA') if (
defined('ZM_OPT_USE_GOOG_RECAPTCHA')
&& defined('ZM_OPT_GOOG_RECAPTCHA_SITEKEY') && defined('ZM_OPT_GOOG_RECAPTCHA_SITEKEY')
&& defined('ZM_OPT_GOOG_RECAPTCHA_SECRETKEY') && defined('ZM_OPT_GOOG_RECAPTCHA_SECRETKEY')
&& ZM_OPT_USE_GOOG_RECAPTCHA && ZM_OPT_GOOG_RECAPTCHA_SITEKEY && 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>'; 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> <button class="btn btn-lg btn-primary btn-block" type="submit"><?php echo translate('Login') ?></button>
</div> </div>
</form> </form>
</div> </div>