From c161eacd76162a025655e097e2becbc07a06087c Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Tue, 23 Aug 2011 13:34:11 -0400 Subject: [PATCH] - Fixed a bug in lng() function. - Added a function to the remote api to get all virtual machines of a client. --- interface/lib/classes/remoting.inc.php | 22 +++++++++++++++++++++- interface/lib/app.inc.php | 1 + 2 files changed, 22 insertions(+), 1 deletions(-) diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php index fbe5bd0..0690d5d 100644 --- a/interface/lib/app.inc.php +++ b/interface/lib/app.inc.php @@ -162,6 +162,7 @@ /** Translates strings in current language */ public function lng($text) { + global $conf; if($this->_language_inc != 1) { $language = (isset($_SESSION['s']['language']))?$_SESSION['s']['language']:$conf['language']; //* loading global Wordbook diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php index 2ff7a41..1c97176 100644 --- a/interface/lib/classes/remoting.inc.php +++ b/interface/lib/classes/remoting.inc.php @@ -2127,7 +2127,7 @@ if(isset($params['template_master']) and $params['template_master'] > 0) { $template=$app->db->queryOneRecord("SELECT * FROM client_template WHERE template_id=".intval($params['template_master'])); - $params=array_merge($params,$template); + if(is_array($template)) $params=array_merge($params,$template); } //* Get the SQL query @@ -2793,6 +2793,26 @@ return $app->remoting_lib->getDataRecord($vm_id); } + //* Get OpenVZ list + public function openvz_vm_get_by_client($session_id, $client_id) + { + global $app; + + if(!$this->checkPerm($session_id, 'vm_openvz')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + + if (!empty($client_id)) { + $client_id = intval($client_id); + $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id"); + $sql = "SELECT * FROM openvz_vm WHERE sys_groupid = ".intval($tmp['groupid']); + $result = $app->db->queryAllRecords($sql); + return $result; + } + return false; + } + //* Add a openvz vm record public function openvz_vm_add($session_id, $client_id, $params) { -- Gitblit v1.9.1