cleanup redundant code and spacing

This commit is contained in:
Isaac Connor 2019-02-11 16:29:19 -05:00
parent 3871c28089
commit 5a924ab176
1 changed files with 5 additions and 10 deletions

View File

@ -78,16 +78,12 @@ if ( empty($_REQUEST['path']) ) {
}
if ( $_REQUEST['fid'] == 'objdetect' ) {
$Event = new Event($_REQUEST['eid']);
$path = $Event->Path().'/objdetect.jpg';
unset($Event); # we don't want event object related processing later for this case
if ( !file_exists($path)) {
$path = $Event->Path().'/objdetect.jpg';
if ( !file_exists($path)) {
header('HTTP/1.0 404 Not Found');
Fatal("File ".$path." does not exist. Please make sure store_frame_in_zm is enabled in the object detection config");
Fatal("File $path does not exist. Please make sure store_frame_in_zm is enabled in the object detection config");
}
}
else if ( $_REQUEST['fid'] == 'alarm' ) {
} else if ( $_REQUEST['fid'] == 'alarm' ) {
# look for first alarmed frame
$Frame = Frame::find_one(array('EventId'=>$_REQUEST['eid'], 'Type'=>'Alarm'),
array('order'=>'FrameId ASC'));
@ -107,8 +103,7 @@ if ( empty($_REQUEST['path']) ) {
} else {
$path = $Event->Path().'/alarm.jpg';
}
}
else if ( $_REQUEST['fid'] == 'snapshot' ) {
} else if ( $_REQUEST['fid'] == 'snapshot' ) {
$Frame = Frame::find_one(array('EventId'=>$_REQUEST['eid'], 'Score'=>$Event->MaxScore()));
if ( !$Frame )
$Frame = Frame::find_one(array('EventId'=>$_REQUEST['eid']));