From bb53ba90c6d4d40cfea9efb1ff29c5aed3f4832a Mon Sep 17 00:00:00 2001 From: stan Date: Tue, 24 Sep 2002 09:53:59 +0000 Subject: [PATCH] Added default Zone when adding Monitor. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@57 e3e1d417-86f3-4887-817a-d78f3d33393f --- web/zm.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/web/zm.php b/web/zm.php index c186ecdd8..cc513e7a3 100644 --- a/web/zm.php +++ b/web/zm.php @@ -276,7 +276,7 @@ if ( $action ) } elseif ( $action == "monitor" && isset( $mid ) ) { - if ( $zid > 0 ) + if ( $mid > 0 ) { $result = mysql_query( "select * from Monitors where Id = '$mid'" ); if ( !$result ) @@ -303,19 +303,31 @@ if ( $action ) if ( $mid > 0 ) { $sql = "update Monitors set ".implode( ", ", $changes )." where MonitorId = '$mid'"; + $result = mysql_query( $sql ); + if ( !$result ) + die( mysql_error() ); + if ( $new_name != $monitor[Name] ) + { + exec( escape_shell_command( "mv ".EVENTS_PATH."/$monitor[Name] ".EVENTS_PATH."/$new_name" ) ); + } } else { $sql = "insert into Monitors set ".implode( ", ", $changes ); + $result = mysql_query( $sql ); + if ( !$result ) + die( mysql_error() ); + $mid = mysql_insert_id(); + $sql = "insert into Zones set MonitorId = $mid, Name = 'All', Type = 'Active' Units = 'Percent' LoX = 0 LoY = 0 HiX = 100 HiY = 100 AlarmRGB = 0xff0000 AlarmThreshold = 25 MinAlarmPixels = 3 MaxAlarmPixels = 75 FilterX = 3 FilterY = 3 MinFilterPixels = 3 MaxFilterPixels = 75 MinBlobPixels = 2 MaxBlobPixels = 0 MinBlobs = 1 MaxBlobs = 0"; + $result = mysql_query( $sql ); + if ( !$result ) + die( mysql_error() ); $view = 'none'; } - $result = mysql_query( $sql ); + $result = mysql_query( "select * from Monitors where Id = '$mid'" ); if ( !$result ) die( mysql_error() ); - if ( $new_name != $monitor[Name] ) - { - exec( escape_shell_command( "mv ".EVENTS_PATH."/$monitor[Name] ".EVENTS_PATH."/$new_name" ) ); - } + $monitor = mysql_fetch_assoc( $result ); controlDaemons( $monitor[Device] ); $refresh_parent = true; }