From 7146bdd59a7b4e20ec0613ff4bb47f5bbd415b46 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 16 Oct 2019 10:08:30 -0400 Subject: [PATCH] IN order to allow specifying a monitor Id that has been deleted, use monitor->Id instead of mid to test for monitor existence --- web/includes/actions/monitor.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/includes/actions/monitor.php b/web/includes/actions/monitor.php index 53e533035..6a542f825 100644 --- a/web/includes/actions/monitor.php +++ b/web/includes/actions/monitor.php @@ -78,7 +78,7 @@ if ( $action == 'monitor' ) { $restart = false; if ( count($changes) ) { - if ( $mid ) { + if ( $monitor->Id() ) { # If we change anything that changes the shared mem size, zma can complain. So let's stop first. if ( $monitor->Type() != 'WebSite' ) { @@ -203,6 +203,8 @@ if ( $action == 'monitor' ) { dbQuery("INSERT INTO Zones SET MonitorId = ?, Name = 'All', Type = 'Active', Units = 'Percent', NumCoords = 4, Coords = ?, Area=?, AlarmRGB = 0xff0000, CheckMethod = 'Blobs', MinPixelThreshold = 25, MinAlarmPixels=?, MaxAlarmPixels=?, FilterX = 3, FilterY = 3, MinFilterPixels=?, MaxFilterPixels=?, MinBlobPixels=?, MinBlobs = 1", array( $mid, sprintf( "%d,%d %d,%d %d,%d %d,%d", 0, 0, $_REQUEST['newMonitor']['Width']-1, 0, $_REQUEST['newMonitor']['Width']-1, $_REQUEST['newMonitor']['Height']-1, 0, $_REQUEST['newMonitor']['Height']-1 ), $zoneArea, intval(($zoneArea*3)/100), intval(($zoneArea*75)/100), intval(($zoneArea*3)/100), intval(($zoneArea*75)/100), intval(($zoneArea*2)/100) ) ); //$view = 'none'; $Storage = $monitor->Storage(); + + error_reporting(0); mkdir($Storage->Path().'/'.$mid, 0755); $saferName = basename($_REQUEST['newMonitor']['Name']); symlink($mid, $Storage->Path().'/'.$saferName);