function productupgrade() { global $_ONAPPVARS, $_LANG; $onapp_config = get_onapp_config($_ONAPPVARS['service']['serverid']); $service = $_ONAPPVARS['service']; $templates = get_templates($service['serverid'], $service["configoption2"]); if (!is_null($_ONAPPVARS['vm']->error)) { $_ONAPPVARS['error'] = is_array($_ONAPPVARS['vm']->error) ? implode(', ', $_ONAPPVARS['vm']->error) : $_ONAPPVARS['vm']->error; clientareaproducts(); } elseif (is_null($_ONAPPVARS['vm']->_id)) { $_ONAPPVARS['error'] = sprintf($_LANG["onappvmnotfoundonserver"], $_ONAPPVARS['service']['vmid'], $onapp_config["adress"]); clientareaproducts(); } else { show_template("onapp/clientareaupgrade", array('templates' => $templates, 'virtualmachine' => $_ONAPPVARS['vm']->_obj, 'service' => $service, 'configoptions' => $service['configoptions'], 'id' => $_ONAPPVARS['id'], 'error' => isset($_ONAPPVARS['error']) ? $_ONAPPVARS['error'] : NULL)); } }
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; }
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 (strpos($url, 'http') === false && strpos($url, 'http') === false) {