public function associateDrives($whmcsDrives, $agentInfo, $serverID) { $result = array("status" => "warning", "msg" => "No agent or agent is stopped"); if ($agentInfo && isset($agentInfo['drives'])) { $agentId = $agentInfo['agentId']; $monDrives = $agentInfo['drives']; $whmcs_drives = null; if ($whmcsDrives) { $whmcs_drives = array(); for ($i = 0; $i < count($whmcsDrives); $i++) { $mon = MonitisHelper::in_array($monDrives, 'id', $whmcsDrives[$i]['monitor_id']); if ($mon) { $whmcs_drives[] = $whmcsDrives[$i]; } else { monitisSqlHelper::altQuery('DELETE FROM ' . MONITIS_INTERNAL_TABLE . ' WHERE monitor_id=' . $whmcsDrives[$i]['monitor_id']); } } } $ids = array(); for ($i = 0; $i < count($monDrives); $i++) { $drive = $monDrives[$i]; if (isset($drive['id'])) { if (!$whmcs_drives || !MonitisHelper::in_array($whmcs_drives, 'monitor_id', $drive['id'])) { $ids[] = $drive['id']; } } } $cnt = count($ids); if ($ids && $cnt > 0) { for ($i = 0; $i < $cnt; $i++) { $monitorID = $ids[$i]; $pubKey = MonitisApi::monitorPublicKey(array('moduleType' => 'drive', 'monitorId' => $monitorID)); $values = array('server_id' => $serverID, 'available' => MonitisConf::$settings['drive']['available'], 'agent_id' => $agentId, 'monitor_id' => $monitorID, 'monitor_type' => 'drive', 'client_id' => MONITIS_CLIENT_ID, "publickey" => $pubKey); insert_query('mod_monitis_int_monitors', $values); } $result["status"] = 'ok'; $result["msg"] = 'Add ' . $cnt . ' drive(s)'; } else { $result["status"] = 'warning'; $result["msg"] = 'No drive monitor for add'; } } return $result; }
static function unlinkMonitorsByServersId($server_id) { monitisSqlHelper::altQuery('DELETE FROM mod_monitis_int_monitors WHERE server_id=' . $server_id); monitisSqlHelper::altQuery('DELETE FROM mod_monitis_ext_monitors WHERE server_id=' . $server_id); monitisSqlHelper::altQuery('DELETE FROM mod_monitis_product_monitor WHERE server_id=' . $server_id); }
public function deactivateProducts($ids) { return monitisSqlHelper::altQuery('DELETE FROM mod_monitis_product WHERE product_id in (' . $ids . ')'); }
<?php $limit = MONITIS_LOG_PAGE_LIMIT; define('MONITIS_LOG_EXPAND', false); if ($_POST['clean']) { monitisSqlHelper::altQuery('DELETE FROM ' . MONITIS_LOG_TABLE); } $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $start = isset($_REQUEST['start']) ? intval($_REQUEST['start']) : 0; $list = monitisSqlHelper::pageQuery('SELECT SQL_CALC_FOUND_ROWS * FROM ' . MONITIS_LOG_TABLE . ' ORDER BY `id` DESC LIMIT ' . $start . ', ' . $limit); $start = ($page - 1) * $limit; $total = $list[0]['total']; $pages = intval($total / $limit); if ($total % $limit) { $pages++; } ?> <style type="text/css"> .datatable th, .datatable td{ word-wrap:break-word; } </style> <script type="text/javascript"> $(document).ready(function(){ // $(".description").tabs( ); }); </script> <form method="post" action="" id="serversListId"> <table width="100%" border="0" cellpadding="3" cellspacing="0">
break; case 'addon': $vars = array('id' => $_POST['addonserviceid'], 'addonserviceid' => $_POST['addonserviceid'], 'serviceid' => $_POST['serviceid'], 'userid' => $_POST['userid'], 'addonid' => $_POST['addonid']); monitisAddonHookHandler($vars, $hook); break; case 'multiple': $type = $_POST["producttype"]; if ($type == 'addon') { $resp = MonitisHookClass::applyCreateAddonMonitor($_POST['addonserviceid'], $_POST['serviceid'], $_POST['userid']); } else { $resp = MonitisHookClass::applyCreateConfigOptionMonitor($_POST['option_id'], $_POST['productid'], $_POST['serviceid']); } break; } } elseif ($action == 'clean') { monitisSqlHelper::altQuery('DELETE FROM ' . MONITIS_HOOK_REPORT_TABLE); } } $list = monitisSqlHelper::query('SELECT * FROM ' . MONITIS_HOOK_REPORT_TABLE . ' ORDER BY `date` DESC'); ?> <div style="text-align: left;padding: 0px 0px 5px;"> <form method="post" action=""> <input type="submit" value="Clean" name="act" class="btn" /> </form> </div> <table class="datatable" width="100%" border="0" cellspacing="1" cellpadding="3" style="text-align: left;"> <tr> <th>Date</th> <th>Title</th> <th>Client</th> <th>Product type</th>
static function unlinkUser($userid) { monitisSqlHelper::altQuery('DELETE FROM ' . MONITIS_USER_TABLE . ' WHERE user_id=' . $userid); return array('status' => 'ok'); }
private function unlinkedPings() { $extShots = $this->allPings; for ($i = 0; $i < count($this->whmcsExt); $i++) { $info = MonitisHelper::in_array($extShots, 'id', $this->whmcsExt[$i]['monitor_id']); if (!$info) { $srv = MonitisHelper::in_array($this->whmcsAllServers, 'id', $this->whmcsExt[$i]['server_id']); $this->result[] = array('server' => $srv['name'], 'action' => 'unlink', 'monitor' => $this->whmcsExt[$i]); monitisSqlHelper::altQuery('DELETE FROM ' . MONITIS_EXTERNAL_TABLE . ' WHERE monitor_id=' . $this->whmcsExt[$i]['monitor_id']); } } }
private function unlinkedPings() { $extShots = $this->pingsStatus; for ($i = 0; $i < count($this->whmcsExt); $i++) { $info = MonitisHelper::in_array($extShots, 'id', $this->whmcsExt[$i]['monitor_id']); if (!$info && @$extShots['status'] != 'error' && @$extShots['code'] != 101) { monitisSqlHelper::altQuery('DELETE FROM ' . MONITIS_EXTERNAL_TABLE . ' WHERE monitor_id=' . $this->whmcsExt[$i]['monitor_id']); } } }
} else { MonitisApp::addError($resp['error']); } monitisSqlHelper::altQuery('DELETE FROM ' . MONITIS_EXTERNAL_TABLE . ' WHERE monitor_id=' . $monitorId); break; case 'cpu': case 'memory': case 'drive': $monitorTypeCodes = array('cpu' => 7, 'memory' => 3, 'drive' => 2); $resp = MonitisApi::deleteInternal($monitorId, $monitorTypeCodes[$monitorType]); if ($resp['status'] == 'ok') { MonitisApp::addMessage('Server/Device monitor successfully removed'); } else { MonitisApp::addError($resp['error']); } monitisSqlHelper::altQuery('DELETE FROM ' . MONITIS_INTERNAL_TABLE . ' WHERE monitor_id=' . $monitorId); if ($monitorType == 'drive') { for ($i = 0; $i < count($serverInfo['agent']['drive']); $i++) { if (isset($serverInfo['agent']['drive'][$i]['id']) && $serverInfo['agent']['drive'][$i]['id'] === $monitorId) { $driveLetter = $serverInfo['agent']['drive'][$i]['letter']; $serverInfo['agent']['drive'][$i] = array(); $serverInfo['agent']['drive'][$i]['driveLetter'] = $driveLetter; break; } } } else { $serverInfo['agent'][$monitorType] = NULL; } break; } break;
public function deactivateAddon($ids) { return monitisSqlHelper::altQuery('DELETE FROM mod_monitis_addon WHERE addon_id in (' . $ids . ')'); }