} elseif ($action == "delete") { if (isset($_REQUEST['markCids'])) { foreach ($_REQUEST['markCids'] as $markCid) { dbQuery("delete from Controls where Id = ?", array($markCid)); dbQuery("update Monitors set Controllable = 0, ControlId = 0 where ControlId = ?", array($markCid)); $refreshParent = true; } } } } // Monitor edit actions, require a monitor id and edit permissions for that monitor if (!empty($_REQUEST['mid']) && canEdit('Monitors', $_REQUEST['mid'])) { $mid = validInt($_REQUEST['mid']); if ($action == "function") { $monitor = dbFetchOne("SELECT * FROM Monitors WHERE Id=?", NULL, array($mid)); $newFunction = validStr($_REQUEST['newFunction']); $newEnabled = isset($_REQUEST['newEnabled']) and $_REQUEST['newEnabled'] != "1" ? "0" : "1"; $oldFunction = $monitor['Function']; $oldEnabled = $monitor['Enabled']; if ($newFunction != $oldFunction || $newEnabled != $oldEnabled) { dbQuery("update Monitors set Function=?, Enabled=? where Id=?", array($newFunction, $newEnabled, $mid)); $monitor['Function'] = $newFunction; $monitor['Enabled'] = $newEnabled; //if ( $cookies ) session_write_close(); if (daemonCheck()) { $restart = $oldFunction == 'None' || $newFunction == 'None' || $newEnabled != $oldEnabled; zmaControl($monitor, "stop"); zmcControl($monitor, $restart ? "restart" : ""); zmaControl($monitor, "start"); } $refreshParent = true;
if (isset($_REQUEST['markCids'])) { foreach ($_REQUEST['markCids'] as $markCid) { dbQuery("delete from Controls where Id = ?", array($markCid)); dbQuery("update Monitors set Controllable = 0, ControlId = 0 where ControlId = ?", array($markCid)); $refreshParent = true; } } } } // Monitor edit actions, require a monitor id and edit permissions for that monitor if (!empty($_REQUEST['mid']) && canEdit('Monitors', $_REQUEST['mid'])) { $mid = validInt($_REQUEST['mid']); if ($action == "function") { $monitor = dbFetchOne("SELECT * FROM Monitors WHERE Id=?", NULL, array($mid)); $newFunction = validStr($_REQUEST['newFunction']); $newEnabled = validStr($_REQUEST['newEnabled']); if ($newEnabled != "1") { $newEnabled = "0"; } $oldFunction = $monitor['Function']; $oldEnabled = $monitor['Enabled']; if ($newFunction != $oldFunction || $newEnabled != $oldEnabled) { dbQuery("update Monitors set Function=?, Enabled=? where Id=?", array($newFunction, $newEnabled, $mid)); $monitor['Function'] = $newFunction; $monitor['Enabled'] = $newEnabled; //if ( $cookies ) session_write_close(); if (daemonCheck()) { $restart = $oldFunction == 'None' || $newFunction == 'None' || $newEnabled != $oldEnabled; zmaControl($monitor, "stop"); zmcControl($monitor, $restart ? "restart" : ""); zmaControl($monitor, "start");