diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm b/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm index 6e6dcf9a8..43359f297 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Filter.pm @@ -221,7 +221,7 @@ sub Sql { } else { ( my $stripped_value = $value ) =~ s/^["\']+?(.+)["\']+?$/$1/; # 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' ) { $value = '(SELECT * FROM Stats WHERE EventId=E.Id AND Score > 0 AND ZoneId='.$value.')'; } elsif ( $term->{attr} =~ /^MonitorName/ ) { @@ -313,7 +313,7 @@ sub Sql { $self->{Sql} .= ' IS NOT '.$value; } elsif ( $term->{op} eq '=[]' or $term->{op} eq 'IN' ) { $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).')'; } elsif ( $term->{op} eq 'LIKE' ) { $self->{Sql} .= ' LIKE '.$value; diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 4b4ae0582..2beb2ab64 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -2163,7 +2163,7 @@ bool Monitor::Analyse() { ref_image.Blend(y_image, ( state==ALARM ? alarm_ref_blend_perc : ref_blend_perc )); } else if (snap->image) { 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_YUVJ420P ); @@ -2683,7 +2683,7 @@ bool Monitor::Decode() { if (config.timestamp_on_capture) { Debug(3, "Timestamping"); - TimestampImage(packet->image, packet->timestamp); + TimestampImage(capture_image, packet->timestamp); } image_buffer[index]->Assign(*(packet->image)); diff --git a/src/zm_monitor_monitorlink.cpp b/src/zm_monitor_monitorlink.cpp index 95432388a..9e7a60d49 100644 --- a/src/zm_monitor_monitorlink.cpp +++ b/src/zm_monitor_monitorlink.cpp @@ -24,6 +24,7 @@ #if ZM_MEM_MAPPED #include #include +#include #else // ZM_MEM_MAPPED #include #include diff --git a/web/ajax/modals/filterdebug.php b/web/ajax/modals/filterdebug.php index f3a961874..d3ffaaf01 100644 --- a/web/ajax/modals/filterdebug.php +++ b/web/ajax/modals/filterdebug.php @@ -11,13 +11,20 @@ No filter id specified.'; - } else { - $filter = new ZM\Filter($_REQUEST['fid']); + + $filter = null; + if ($fid) { + $filter = new ZM\Filter($fid); if (!$filter->Id()) { echo '
Filter not found for id '.$_REQUEST['fid'].'
'; } + } else { + $filter = new ZM\Filter(); + if ( isset($_REQUEST['filter'])) { + $filter->set($_REQUEST['filter']); + } else { + echo '
No filter id or contents specified.
'; + } } ?>
diff --git a/web/skins/classic/views/report_event_audit.php b/web/skins/classic/views/report_event_audit.php index be53c87b0..fa2a07004 100644 --- a/web/skins/classic/views/report_event_audit.php +++ b/web/skins/classic/views/report_event_audit.php @@ -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'=>$maxTime, 'cnj'=>'and', 'cbr'=>'1')); 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']) ) ) { # this should be redundant 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) ) { $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) ) { $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)))); } ?>