Id() ) { ZM\Error("Monitor not found with Id=$mid"); return; } $newFunction = validStr($_REQUEST['newFunction']); # Because we use a checkbox, it won't get passed in the request. So not being in _REQUEST means 0 $newEnabled = ( !isset($_REQUEST['newEnabled']) or $_REQUEST['newEnabled'] != '1' ) ? '0' : '1'; $oldFunction = $monitor->Function(); $oldEnabled = $monitor->Enabled(); if ( $newFunction != $oldFunction || $newEnabled != $oldEnabled ) { $monitor->save(array('Function'=>$newFunction, 'Enabled'=>$newEnabled)); if ( daemonCheck() && ($monitor->Type() != 'WebSite') ) { $monitor->zmaControl('stop'); $monitor->zmcControl(($newFunction != 'None') ? 'restart' : 'stop'); if ( $newFunction != 'None' && $newFunction != 'NoDect' ) $monitor->zmaControl('start'); } } else { ZM\Logger::Debug('No change to function, not doing anything.'); } } // end if action $view = 'console'; ?>