diff --git a/whmcs/modules/servers/virtualizor_cloud/novnc/app/ui.js b/whmcs/modules/servers/virtualizor_cloud/novnc/app/ui.js index 4d4e8d9..940e933 100644 --- a/whmcs/modules/servers/virtualizor_cloud/novnc/app/ui.js +++ b/whmcs/modules/servers/virtualizor_cloud/novnc/app/ui.js @@ -6,17 +6,17 @@ * See README.md for usage and integration instructions. */ -import * as Log from '/themes/default/novnc/core/util/logging.js'; -import _, { l10n } from '/themes/default/novnc/app/localization.js'; +import * as Log from '../core/util/logging.js'; +import _, { l10n } from '../app/localization.js'; import { isTouchDevice, isSafari, hasScrollbarGutter, dragThreshold } - from '/themes/default/novnc/core/util/browser.js'; -import { setCapture, getPointerEvent } from '/themes/default/novnc/core/util/events.js'; -import KeyTable from "/themes/default/novnc/core/input/keysym.js"; -import keysyms from "/themes/default/novnc/core/input/keysymdef.js"; -import Keyboard from "/themes/default/novnc/core/input/keyboard.js"; -import RFB from "/themes/default/novnc/core/rfb.js"; -import Display from "/themes/default/novnc/core/display.js"; -import * as WebUtil from "/themes/default/novnc/app/webutil.js"; + from '../core/util/browser.js'; +import { setCapture, getPointerEvent } from '../core/util/events.js'; +import KeyTable from "../core/input/keysym.js"; +import keysyms from "../core/input/keysymdef.js"; +import Keyboard from "../core/input/keyboard.js"; +import RFB from "../core/rfb.js"; +import Display from "../core/display.js"; +import * as WebUtil from "../app/webutil.js"; const PAGE_TITLE = "noVNC"; @@ -62,7 +62,7 @@ const UI = { // Translate the DOM l10n.translateDOM(); - WebUtil.fetchJSON('./themes/default/novnc/package.json') + WebUtil.fetchJSON('./package.json') .then((packageInfo) => { Array.from(document.getElementsByClassName('noVNC_version')).forEach(el => el.innerText = packageInfo.version); }) diff --git a/whmcs/modules/servers/virtualizor_cloud/sdk/enduser.php b/whmcs/modules/servers/virtualizor_cloud/sdk/enduser.php index 62871b4..1278e7f 100644 --- a/whmcs/modules/servers/virtualizor_cloud/sdk/enduser.php +++ b/whmcs/modules/servers/virtualizor_cloud/sdk/enduser.php @@ -120,6 +120,7 @@ function call($path, $post = array(), $cookies = array()){ } else { $url .= '&api=serialize&apikey='.rawurlencode($this->key).'&apipass='.rawurlencode($this->pass); } + $url .= '&skip_callback=whmcs'; // Set the curl parameters. $ch = curl_init(); diff --git a/whmcs/modules/servers/virtualizor_cloud/virtualizor_cloud.php b/whmcs/modules/servers/virtualizor_cloud/virtualizor_cloud.php index 9efcf03..826c365 100644 --- a/whmcs/modules/servers/virtualizor_cloud/virtualizor_cloud.php +++ b/whmcs/modules/servers/virtualizor_cloud/virtualizor_cloud.php @@ -1,6 +1,6 @@ 0){ $post['ipv6_subnet'] = $numips6_subnet; } + + if(!empty($params['configoptions'][v_fn('ips')])){ + $post['num_ips'] = $params['configoptions'][v_fn('ips')]; + } + + if(!empty($params['configoptions'][v_fn('ips_int')])){ + $post['num_ips_int'] = $params['configoptions'][v_fn('ips_int')]; + } + + if(!empty($params['configoptions'][v_fn('ips6')])){ + $post['num_ips6'] = $params['configoptions'][v_fn('ips6')]; + } + + if(!empty($params['configoptions'][v_fn('ips6_subnet')])){ + $post['num_ips6_subnet'] = $params['configoptions'][v_fn('ips6_subnet')]; + } + + if(!empty($params['configoptions']['ippoolid'])){ + $post['ippoolid'] = $params['configoptions']['ippoolid']; + } + + if(!empty($params['configoptions'][v_fn('space')])){ + $post['space'] = $params['configoptions'][v_fn('space')]; + } + + if(!empty($params['configoptions'][v_fn('ram')])){ + $post['ram'] = $params['configoptions'][v_fn('ram')]; + } + + if(!empty($params['configoptions'][v_fn('cores')])){ + $post['cores'] = $params['configoptions'][v_fn('cores')]; + } + + if(!empty($params['configoptions'][v_fn('ctrlpanel')])){ + $post['control_panel'] = $params['configoptions'][v_fn('ctrlpanel')]; + } + + if(!empty($params['configoptions'][v_fn('network_speed')])){ + $post['network_speed'] = $params['configoptions'][v_fn('network_speed')]; + } + + if(!empty($params['configoptions'][v_fn('upload_speed')])){ + $post['upload_speed'] = $params['configoptions'][v_fn('upload_speed')]; + } + + //logActivity('post : '.var_export($post, 1)); $ret = VirtCloud_Curl::call($params["serverip"], $params["serverusername"], $params["serverpassword"], 'index.php?act=create', $post); @@ -1251,7 +1253,7 @@ public static function make_api_call($ip, $pass, $path, $data = array(), $post = $url = 'https://'.$ip.':4085/'.$path; $url .= (strstr($url, '?') ? '' : '?'); - $url .= '&api=serialize&apikey='.rawurlencode($apikey); + $url .= '&api=serialize&apikey='.rawurlencode($apikey).'&skip_callback=whmcs'; // Pass some data if there if(!empty($data)){ @@ -1320,6 +1322,7 @@ public static function make_api_call($ip, $pass, $path, $data = array(), $post = public static function e_make_api_call($ip, $userkey, $pass, $vid, $path, $post = array()){ $v = new Virtualizor_Enduser_Cloud_API($ip, $userkey, $pass); + $path = $path.'&skip_callback=whmcs'; if(!empty($vid)){ $path = $path.'&svs='.$vid; } @@ -1380,7 +1383,7 @@ function virtualizor_cloudUI($params, $url_prefix = 'clientarea.php?action=produ $var['giver'] = $url_prefix.'&id='.$params['serviceid'].'&'; $var['url'] = $url_prefix.'&id='.$params['serviceid'].'&'; $var['copyright'] = 'Virtualizor'; - $var['version'] = '2.2.0'; + $var['version'] = '2.2.1'; $var['logo'] = ''; $var['theme'] = $modules_url.'/virtualizor_cloud/ui/'; $var['theme_path'] = dirname(__FILE__).'/ui/'; @@ -1487,9 +1490,15 @@ function virtualizor_cloudUI($params, $url_prefix = 'clientarea.php?action=produ $data = str_replace('[['.$k.']]', $v, $data); } + $lang = $params['clientsdetails']['language']; + + // Sets the language preferred by the clients + if(!empty($virtualizor_conf['default_language'])){ + $lang = $virtualizor_conf['default_language']; + } // Parse the languages - vload_lang($params['clientsdetails']['language']); + vload_lang($lang); echo vparse_lang($data); die(); @@ -2977,10 +2986,15 @@ function virt_cloud_ips($params){ } function virtualizor_cloud_TestConnection($params){ - - $data = VirtCloud_Curl::call($params["serverip"], $params['serverusername'], $params['serverpassword'], 'index.php?act=listvs'); + + $host = $params["serverip"]; + if(empty($params["serverip"]) && !empty($params['serverhostname'])){ + $host = $params['serverhostname']; + } + + $data = VirtCloud_Curl::call($host, $params['serverusername'], $params['serverpassword'], 'index.php?act=listvs'); - if(empty($data)){ + if(empty($data) || $data['act'] == 'login'){ return array('error' => 'FAILED: Could not connect to Virtualizor. Please make sure that all Ports from 4081 to 4085 are open on your WHMCS Server or please check the server details entered are as displayed on Cloud Panel >> API Credentials'); }else{ return array('success' => true); diff --git a/whmcs/modules/servers/virtualizor_cloud/virtualizor_conf.php b/whmcs/modules/servers/virtualizor_cloud/virtualizor_conf.php index b402c88..6c9ac3c 100644 --- a/whmcs/modules/servers/virtualizor_cloud/virtualizor_conf.php +++ b/whmcs/modules/servers/virtualizor_cloud/virtualizor_conf.php @@ -89,6 +89,10 @@ // Load as per old module $virtualizor_conf['no_virt_plans'] = 0; +// Custom language set by the clients +// Value must be the matched by the individual language folder in the module +$virtualizor_conf['default_language'] = ''; + // Set the alias for VPS $virtualizor_conf['vm_short'] = '';