diff --git a/web/includes/actions.php b/web/includes/actions.php index de0861fe0..48082a585 100644 --- a/web/includes/actions.php +++ b/web/includes/actions.php @@ -554,7 +554,8 @@ if ( canEdit('Monitors') ) { $maxSeq = dbFetchOne('SELECT MAX(Sequence) AS MaxSequence FROM Monitors', 'MaxSequence'); $changes[] = 'Sequence = '.($maxSeq+1); - if ( dbQuery('INSERT INTO Monitors SET '.implode(', ', $changes)) ) { + $sql = 'INSERT INTO Monitors SET '.implode(', ', $changes); + if ( dbQuery($sql) ) { $mid = dbInsertId(); $zoneArea = $_REQUEST['newMonitor']['Width'] * $_REQUEST['newMonitor']['Height']; 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) ) ); @@ -566,6 +567,7 @@ if ( canEdit('Monitors') ) { } else { Error('Error saving new Monitor.'); + $error_message = dbError($sql); return; } } else { diff --git a/web/index.php b/web/index.php index addddce06..cbda1096a 100644 --- a/web/index.php +++ b/web/index.php @@ -170,6 +170,7 @@ if ( !is_writable(ZM_DIR_EVENTS) || !is_writable(ZM_DIR_IMAGES) ) { } # Globals +$error_message = null; $redirect = null; $view = null; if ( isset($_REQUEST['view']) ) diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index 7847e37c7..8fd9e2a8e 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -208,6 +208,23 @@ echo output_link_if_exists( array( + +'; + global $error_message; + if ( $error_message ) { + echo '
'.$error_message.'
'; + } +} // end function getBodyTopHTML + function getNavBarHTML($reload = null) { # Provide a facility to turn off the headers if you put headers=0 into the url if ( isset($_REQUEST['navbar']) and $_REQUEST['navbar']=='0' ) @@ -235,11 +252,6 @@ function getNavBarHTML($reload = null) { $running = daemonCheck(); $status = $running?translate('Running'):translate('Stopped'); ?> -