function calc_service_items($service_id) { $service = get_service($service_id); $ci =& get_instance(); //total $ci->db->where('status', 1); $ci->db->where('service_id', $service_id); $ci->db->select_sum('total'); $total = $ci->db->get('tec_service_items')->row_array(); //tax $ci->db->where('status', 1); $ci->db->where('service_id', $service_id); $ci->db->select_sum('tax'); $tax = $ci->db->get('tec_service_items')->row_array(); //sub_total $ci->db->where('status', 1); $ci->db->where('service_id', $service_id); $ci->db->select_sum('sub_total'); $sub_total = $ci->db->get('tec_service_items')->row_array(); $sub_total['sub_total'] = $service['workmanship'] + $sub_total['sub_total']; // cost $ci->db->where('status', '1'); $ci->db->select_sum('cost_price'); $ci->db->where('service_id', $service_id); $cost = $ci->db->get('tec_service_items')->row_array(); $cost = $cost['cost_price'] + $service['expenses']; $ci->db->where('id', $service_id); $ci->db->update('tec_services', array('total' => $total['total'], 'tax' => $tax['tax'], 'grand_total' => $sub_total['sub_total'], 'balance' => $sub_total['sub_total'] - $service['payment'], 'cost' => $cost, 'profit' => $sub_total['sub_total'] - $cost)); }
function get_vm_interface($service_id) { $vm = get_vm($service_id); $service = get_service($service_id); $network = new ONAPP_VirtualMachine_NetworkInterface(); $onapp_config = get_onapp_config($service['serverid']); $network->auth($onapp_config["adress"], $onapp_config['username'], $onapp_config['password']); $network->_virtual_machine_id = $vm->_id; $networks = $network->getList(); foreach ($networks as $net) { if ($net->_primary == true) { $result = $net; } } $result->auth($onapp_config["adress"], $onapp_config['username'], $onapp_config['password']); return $result; }
$options = array('bucket' => 'phpsdk1349849394', 'object' => 'picture', 'directory' => 'D:\\alidata\\www\\logs\\aliyun.com\\oss'); $response = $obj->batch_upload_file($options); } /*%**************************************************************************************************************%*/ // 签名url 相关 //生成签名url,主要用户私有权限下的访问控制 function get_sign_url($obj) { $bucket = 'phpsdk1349849394'; $object = 'netbeans-7.1.2-ml-cpp-linux.sh'; $timeout = 3600; $response = $obj->get_sign_url($bucket, $object, $timeout); var_dump($response); } /*%**************************************************************************************************************%*/ // 结果 相关 //格式化返回结果 function _format($response) { echo '<pre>'; echo '|-----------------------Start---------------------------------------------------------------------------------------------------' . "\n"; echo '|-Status:' . $response->status . "\n"; echo '|-Body:' . "\n"; echo $response->body . "\n"; echo "|-Header:\n"; print_r($response->header); echo '-----------------------End-----------------------------------------------------------------------------------------------------' . "\n\n"; } get_service($oss_sdk_service); get_object_meta($oss_sdk_service); delete_object($oss_sdk_service);
function onapp_ClientArea($params) { global $_LANG; if (!file_exists(ONAPP_WRAPPER_INIT)) { return sprintf("%s ", $_LANG['onapponmaintenance']); } $service = get_service($params['serviceid']); if (!is_null($service["vmid"])) { return '<a href="' . ONAPP_FILE_NAME . '?page=productdetails&id=' . $params['serviceid'] . '">' . $_LANG["onappvmsettings"] . '</a>'; } else { return '<a href="' . ONAPP_FILE_NAME . '?page=productdetails&id=' . $params['serviceid'] . '">' . $_LANG["onappvmcreate"] . '</a>'; } }
/** * Action delete backup */ function _action_backup_delete($id, $backupid) { if (is_null($backupid)) { return array('error' => 'Backup ID not set'); } $vm = get_vm($id); $service = get_service($id); $onapp_config = get_onapp_config($service['serverid']); $backup = new ONAPP_VirtualMachine_Backup(); $backup->_id = $backupid; $user = get_onapp_client($id); $backup->auth($onapp_config["adress"], $user["email"], $user["password"]); $backup->delete(); if (!is_null($backup->error)) { return array('error' => is_array($backup->error) ? "Can't create Backup<br/>\n " . implode('.<br>', $backup->error) : "Can't create Backup'" . $backup->error); } else { return true; } }
require_once dirname(__FILE__) . '/lib.php'; session_start(); $user_id = $_SESSION["uid"]; $vm_id = $_GET["id"]; // Check VM access $sql = sprintf("SELECT \n service_id \n FROM \n tblonappservices \n LEFT JOIN tblhosting ON tblhosting.id = service_id \n WHERE \n userid = '%s' \n AND vm_id = '%s';", stripcslashes($user_id), stripcslashes($vm_id)); $sql_result = getSQLResult($sql); if (!isset($sql_result["service_id"])) { die("Access denied to this Console"); } else { $service_id = $sql_result["service_id"]; } unset($sql); unset($sql_result); // Load VM server id $service = get_service($service_id); $onapp_config = get_onapp_config($service['serverid']); $user = get_onapp_client($service_id); if (!$onapp_config) { die("Can't found active OnApp server #" . addslashes($server_id) . " in Data Base"); } // Load VM $vm = new OnApp_VirtualMachine(); $vm->auth($onapp_config["adress"], $user["email"], $user["password"]); $vm->_id = $vm_id; $vm->load(); // Load console $console = new ONAPP_Console(); $console->auth($onapp_config["adress"], $user["email"], $user["password"]); $console->load($vm_id); $url = ($onapp_config["hostname"] ? $onapp_config["hostname"] : $onapp_config["adress"]) . "/console_remote/" . $console->_obj->_remote_key;
if (!empty($args['method'])) { $method = $args['method']; unset($args['method']); log_msg('debug', 'json: method is ' . quot($method)); log_msg('debug', 'json: arguments are ' . var_dump_inl($args)); log_msg('debug', 'json: base url is ' . quot(base_url())); } else { // this can also be caused by an upload exceeding the limits // set in php.ini $err = response('Required argument "method" missing', 400); echo json_encode($err); log_msg('warn', 'json: ' . $err['#data']); die; } load_modules($method); if (!($m = get_service($method))) { $err = response('Unknown method ' . quot($method), 400); echo json_encode($err); log_msg('warn', 'json: ' . $err['#data']); die; } // check authentication if (isset($m['auth']) && $m['auth']) { if (!is_auth()) { prompt_auth(true); } } if (isset($m['cross-origin']) && $m['cross-origin']) { // output cross-origin header if requested header('Access-Controll-Allow-Origin: *'); } else {
$varQuery = ""; foreach ($_POST["varr"] as $varr) { $fileName = get_filename($productt, $varr, $expp, $model, $timee, $regionn, $freqq, $myAggPath, $dailyPath, $aggvar); $localPath = get_localPath($productt, $Files, $model, $expp); $varLongName = get_varLongName($varr, $productt); $varQuery .= "&data-path={$localPath}/{$fileName}&variable={$varLongName}&variable-name={$varr}"; } if ($domainn != "fulldomain") { $csvString = get_csv($varQuery, $pointLat, $pointLong); $html .= "<a href='{$csvString}' target='_blank'><input type='button' class='btn btn-large ptn-primary pull-right' value='Get CSV of All Variables' name='submit' onclick='' /></a><br><br>"; } foreach ($_POST["varr"] as $varr) { $urlPath = get_urlPath($productt, $Files); $urlDir = get_urlDir($productt, $varr, $model, $expp, $freqq, $aggvar, $myAggPath, $dailyPath, $monthlyPath); $fileName = get_filename($productt, $varr, $expp, $model, $timee, $regionn, $freqq, $myAggPath, $dailyPath, $aggvar); $service = get_service($productt, $Files); $querystring = get_querystring($productt, $varr, $domainn, $NELat, $SWLat, $SWLong, $NELong, $pointLat, $pointLong, $extensionn); $localPath = get_localPath($productt, $Files, $model, $expp); if ($freqq == 'daily') { $opendapPath = $opendapdailyPath; } elseif ($freqq == 'monthly') { $opendapPath = $opendapmonthlyPath; } $varLongName = get_varLongName($varr, $productt); $varQuery = "&data-path={$localPath}/{$fileName}&variable={$varLongName}&variable-name={$varr}"; $html .= varRow($urlPath, $urlDir, $fileName, $service, $querystring, $varr, $productt, $domainn, $pointLat, $pointLong, $localPath, $opendapPath, $varQuery); $html .= "<br>"; } //var $html .= "</td></tr>"; }
} elseif ($op == 'deleteservice') { $serid = intval($_POST['serid']); $_SGLOBAL['db']->query("DELETE FROM " . tname('apps') . " WHERE id={$serid}"); echo 200; return; } elseif ($op == 'upservice') { $serid = intval($_POST['serid']); $setarr = array('applypass' => 3); updatetable('apps', $setarr, array('id' => $serid)); echo 200; return; } elseif ($op == 'downservice') { $serid = intval($_POST['serid']); $setarr = array('applypass' => 4); updatetable('apps', $setarr, array('id' => $serid)); echo 200; return; } elseif ($op == 'editservice') { $serid = intval($_GET['serid']); $service = get_service($serid); if ($service['iauth_type'] == "") { include_once template("dev_service_edit_weblink"); } elseif ($service['iauth_type'] == "WSC") { include_once template("dev_service_edit_iauth"); } elseif ($service['iauth_type'] == "UAC") { include_once template("dev_service_edit_mobile"); } elseif ($service['iauth_type'] == "RP") { include_once template("dev_service_edit_resource"); } return; }