diff --git a/web/includes/actions/monitors.php b/web/includes/actions/monitors.php index 118af1533..c133ac83b 100644 --- a/web/includes/actions/monitors.php +++ b/web/includes/actions/monitors.php @@ -19,24 +19,27 @@ // // Monitor edit actions, monitor id derived, require edit permissions for that monitor -if ( ! canEdit('Monitors') ) { +if (!canEdit('Monitors')) { ZM\Warning("Monitor actions require Monitors Permissions"); return; } -if ( $action == 'save' ) { - foreach ( $_REQUEST['mids'] as $mid ) { +if ($action == 'save') { + foreach ($_REQUEST['mids'] as $mid) { $mid = ValidInt($mid); - if ( ! canEdit('Monitors', $mid) ) { - ZM\Warning("Cannot edit monitor $mid"); + if (!canEdit('Monitors', $mid)) { + ZM\Warning('Cannot edit monitor '.$mid); continue; } $Monitor = new ZM\Monitor($mid); - if ( $Monitor->Type() != 'WebSite' ) { + if ($Monitor->Type() != 'WebSite') { $Monitor->zmcControl('stop'); } - $Monitor->save($_REQUEST['newMonitor']); - if ( $Monitor->Function() != 'None' && $Monitor->Type() != 'WebSite' ) { + if (!$Monitor->save($_REQUEST['newMonitor'])) { + global $error_message; + $error_message .= 'Error saving monitor: ' . $Monitor->get_last_error().'
'; + } + if ($Monitor->Function() != 'None' && $Monitor->Type() != 'WebSite') { $Monitor->zmcControl('start'); } } // end foreach mid