Skip to content

Commit c161eac

Browse files
committed
- Fixed a bug in lng() function.
- Added a function to the remote api to get all virtual machines of a client.
1 parent 320e4e8 commit c161eac

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

interface/lib/app.inc.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ public function error($msg, $next_link = '', $stop = true, $priority = 1) {
162162

163163
/** Translates strings in current language */
164164
public function lng($text) {
165+
global $conf;
165166
if($this->_language_inc != 1) {
166167
$language = (isset($_SESSION['s']['language']))?$_SESSION['s']['language']:$conf['language'];
167168
//* loading global Wordbook

interface/lib/classes/remoting.inc.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@ protected function klientadd($formdef_file, $reseller_id, $params)
21272127
if(isset($params['template_master']) and $params['template_master'] > 0)
21282128
{
21292129
$template=$app->db->queryOneRecord("SELECT * FROM client_template WHERE template_id=".intval($params['template_master']));
2130-
$params=array_merge($params,$template);
2130+
if(is_array($template)) $params=array_merge($params,$template);
21312131
}
21322132

21332133
//* Get the SQL query
@@ -2793,6 +2793,26 @@ public function openvz_vm_get($session_id, $vm_id)
27932793
return $app->remoting_lib->getDataRecord($vm_id);
27942794
}
27952795

2796+
//* Get OpenVZ list
2797+
public function openvz_vm_get_by_client($session_id, $client_id)
2798+
{
2799+
global $app;
2800+
2801+
if(!$this->checkPerm($session_id, 'vm_openvz')) {
2802+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
2803+
return false;
2804+
}
2805+
2806+
if (!empty($client_id)) {
2807+
$client_id = intval($client_id);
2808+
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id");
2809+
$sql = "SELECT * FROM openvz_vm WHERE sys_groupid = ".intval($tmp['groupid']);
2810+
$result = $app->db->queryAllRecords($sql);
2811+
return $result;
2812+
}
2813+
return false;
2814+
}
2815+
27962816
//* Add a openvz vm record
27972817
public function openvz_vm_add($session_id, $client_id, $params)
27982818
{

0 commit comments

Comments
 (0)