Merge branch 'master' into replace_function_concept

This commit is contained in:
Isaac Connor 2022-02-15 17:02:03 -05:00
commit 2bc0ec269a
5 changed files with 19 additions and 11 deletions

View File

@ -221,7 +221,7 @@ sub Sql {
} else { } else {
( my $stripped_value = $value ) =~ s/^["\']+?(.+)["\']+?$/$1/; ( my $stripped_value = $value ) =~ s/^["\']+?(.+)["\']+?$/$1/;
# Empty value will result in () from split # Empty value will result in () from split
foreach my $temp_value ( $stripped_value ? split( /["'\s]*?,["'\s]*?/, $stripped_value ) : $stripped_value ) { foreach my $temp_value ( $stripped_value ne '' ? split( /["'\s]*?,["'\s]*?/, $stripped_value ) : $stripped_value ) {
if ( $term->{attr} eq 'AlarmedZoneId' ) { if ( $term->{attr} eq 'AlarmedZoneId' ) {
$value = '(SELECT * FROM Stats WHERE EventId=E.Id AND Score > 0 AND ZoneId='.$value.')'; $value = '(SELECT * FROM Stats WHERE EventId=E.Id AND Score > 0 AND ZoneId='.$value.')';
} elsif ( $term->{attr} =~ /^MonitorName/ ) { } elsif ( $term->{attr} =~ /^MonitorName/ ) {
@ -313,7 +313,7 @@ sub Sql {
$self->{Sql} .= ' IS NOT '.$value; $self->{Sql} .= ' IS NOT '.$value;
} elsif ( $term->{op} eq '=[]' or $term->{op} eq 'IN' ) { } elsif ( $term->{op} eq '=[]' or $term->{op} eq 'IN' ) {
$self->{Sql} .= ' IN ('.join(',', @value_list).")"; $self->{Sql} .= ' IN ('.join(',', @value_list).")";
} elsif ( $term->{op} eq '![]' ) { } elsif ( $term->{op} eq '![]' or $term->{op} eq 'NOT IN') {
$self->{Sql} .= ' NOT IN ('.join(',', @value_list).')'; $self->{Sql} .= ' NOT IN ('.join(',', @value_list).')';
} elsif ( $term->{op} eq 'LIKE' ) { } elsif ( $term->{op} eq 'LIKE' ) {
$self->{Sql} .= ' LIKE '.$value; $self->{Sql} .= ' LIKE '.$value;

View File

@ -2163,7 +2163,7 @@ bool Monitor::Analyse() {
ref_image.Blend(y_image, ( state==ALARM ? alarm_ref_blend_perc : ref_blend_perc )); ref_image.Blend(y_image, ( state==ALARM ? alarm_ref_blend_perc : ref_blend_perc ));
} else if (snap->image) { } else if (snap->image) {
Debug(1, "Blending because %p and format %d != %d, %d", snap->in_frame, Debug(1, "Blending because %p and format %d != %d, %d", snap->in_frame,
snap->in_frame->format, (snap->in_frame ? snap->in_frame->format : -1),
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUVJ420P AV_PIX_FMT_YUVJ420P
); );
@ -2683,7 +2683,7 @@ bool Monitor::Decode() {
if (config.timestamp_on_capture) { if (config.timestamp_on_capture) {
Debug(3, "Timestamping"); Debug(3, "Timestamping");
TimestampImage(packet->image, packet->timestamp); TimestampImage(capture_image, packet->timestamp);
} }
image_buffer[index]->Assign(*(packet->image)); image_buffer[index]->Assign(*(packet->image));

View File

@ -24,6 +24,7 @@
#if ZM_MEM_MAPPED #if ZM_MEM_MAPPED
#include <sys/mman.h> #include <sys/mman.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h>
#else // ZM_MEM_MAPPED #else // ZM_MEM_MAPPED
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/shm.h> #include <sys/shm.h>

View File

@ -11,13 +11,20 @@
<?php <?php
require_once('includes/Filter.php'); require_once('includes/Filter.php');
$fid = validInt($_REQUEST['fid']); $fid = validInt($_REQUEST['fid']);
if (!$fid) {
echo '<div class="error">No filter id specified.</div>'; $filter = null;
} else { if ($fid) {
$filter = new ZM\Filter($_REQUEST['fid']); $filter = new ZM\Filter($fid);
if (!$filter->Id()) { if (!$filter->Id()) {
echo '<div class="error">Filter not found for id '.$_REQUEST['fid'].'</div>'; echo '<div class="error">Filter not found for id '.$_REQUEST['fid'].'</div>';
} }
} else {
$filter = new ZM\Filter();
if ( isset($_REQUEST['filter'])) {
$filter->set($_REQUEST['filter']);
} else {
echo '<div class="error">No filter id or contents specified.</div>';
}
} }
?> ?>
<form name="contentForm" id="filterdebugForm" method="post" action="?"> <form name="contentForm" id="filterdebugForm" method="post" action="?">

View File

@ -42,7 +42,7 @@ $filter = new ZM\Filter();
$filter->addTerm(array('attr'=>'StartDateTime', 'op'=>'>=', 'val'=>$minTime, 'obr'=>'1')); $filter->addTerm(array('attr'=>'StartDateTime', 'op'=>'>=', 'val'=>$minTime, 'obr'=>'1'));
$filter->addTerm(array('attr'=>'StartDateTime', 'op'=>'<=', 'val'=>$maxTime, 'cnj'=>'and', 'cbr'=>'1')); $filter->addTerm(array('attr'=>'StartDateTime', 'op'=>'<=', 'val'=>$maxTime, 'cnj'=>'and', 'cbr'=>'1'));
if ( count($selected_monitor_ids) ) { if ( count($selected_monitor_ids) ) {
$filter->addTerm(array('attr'=>'MonitorId', 'op'=>'IN', 'val'=>implode(',', $selected_monitor_ids), 'cnj'=>'and')); $filter->addTerm(array('attr'=>'MonitorId', 'op'=>'=[]', 'val'=>implode(',', $selected_monitor_ids), 'cnj'=>'and'));
} else if ( ( $group_id != 0 || isset($_SESSION['ServerId']) || isset($_SESSION['StorageId']) || isset($_SESSION['Status']) ) ) { } else if ( ( $group_id != 0 || isset($_SESSION['ServerId']) || isset($_SESSION['StorageId']) || isset($_SESSION['Status']) ) ) {
# this should be redundant # this should be redundant
for ( $i=0; $i < count($displayMonitors); $i++ ) { for ( $i=0; $i < count($displayMonitors); $i++ ) {
@ -164,11 +164,11 @@ for ( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
if ( count($FileMissing) ) { if ( count($FileMissing) ) {
$FileMissing_filter = new ZM\Filter(); $FileMissing_filter = new ZM\Filter();
$FileMissing_filter->addTerm(array('attr'=>'Id', 'op'=>'IN', 'val'=>implode(',', array_map(function($Event){return $Event->Id();}, $FileMissing)))); $FileMissing_filter->addTerm(array('attr'=>'Id', 'op'=>'=[]', 'val'=>implode(',', array_map(function($Event){return $Event->Id();}, $FileMissing))));
} }
if ( count($ZeroSize) ) { if ( count($ZeroSize) ) {
$ZeroSize_filter = new ZM\Filter(); $ZeroSize_filter = new ZM\Filter();
$ZeroSize_filter->addTerm(array('attr'=>'Id', 'op'=>'IN', 'val'=>implode(',', array_map(function($Event){return $Event->Id();}, $ZeroSize)))); $ZeroSize_filter->addTerm(array('attr'=>'Id', 'op'=>'=[]', 'val'=>implode(',', array_map(function($Event){return $Event->Id();}, $ZeroSize))));
} }
?> ?>
<tr id="<?php echo 'monitor_id-'.$monitor['Id'] ?>" title="<?php echo $monitor['Id'] ?>"> <tr id="<?php echo 'monitor_id-'.$monitor['Id'] ?>" title="<?php echo $monitor['Id'] ?>">