'; return false; } foreach ((array)$monitor_ids as $monitor_id) { $monitor_id = validCardinal($monitor_id); if (!$monitor_id) { $error_message .= 'Invalid monitor id.
'; continue; } $monitor = ZM\Monitor::find_one(array('Id'=>$monitor_id)); if (!$monitor) { $error_message .= 'Monitor '.validHtmlStr($monitor_id).' not found.
'; continue; } if (!$monitor->canEdit()) { $error_message .= 'You do not have permission to restart monitor '.validHtmlStr($monitor->Name()).'.
'; continue; } // A WebSite monitor has no capture daemon: zmc would start and die on the monitor type. if ($monitor->Type() == 'WebSite') continue; $monitor->zmcControl('restart'); ZM\AuditAction('restart', 'monitor', $monitor->Id(), 'Name: '.$monitor->Name()); } return true; } if ($action == 'restart') { if (!canEdit('Monitors')) { ZM\Warning('No permission to restart monitors'); $error_message .= 'You do not have permission to restart monitors.
'; } else if (!isset($_REQUEST['markMids'])) { $error_message .= 'No monitors selected to restart.
'; } else { restartMonitors((array)$_REQUEST['markMids']); } } if ($action == 'delete') { if (!canEdit('Monitors')) { ZM\Warning('No permission to delete monitors'); return; } if (isset($_REQUEST['markMids'])) { require_once('includes/Monitor.php'); foreach ($_REQUEST['markMids'] as $markMid) { if (canEdit('Monitors', $markMid)) { $monitor = ZM\Monitor::find_one(['Id'=>$markMid]); if ($monitor) { if ($monitor->delete()) { ZM\AuditAction('delete', 'monitor', $markMid, 'Name: '.$monitor->Name()); } else { // Do not record an audit entry for a delete that did not happen. $error_message .= 'Error deleting monitor '.$markMid.': '. $monitor->get_last_error().'
'; } } } else { $error_message .= 'You do not have permission to delete monitor '.$markMid.'
'; } // end if canedit this monitor } // end foreach monitor in MarkMid } // markMids is set and we aren't limited to specific monitors } // end if action == Delete ?>