From 77cc4a99b15f4639b56c29a1207dc04b459c5d54 Mon Sep 17 00:00:00 2001 From: Marius Cramer <m.cramer@pixcept.de> Date: Fri, 19 Dec 2014 12:18:11 -0500 Subject: [PATCH] - re-added jquery ui --- interface/lib/classes/remoting.inc.php | 84 ++++++++++++++++++++++++----------------- 1 files changed, 49 insertions(+), 35 deletions(-) diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php index 268b257..f42d22b 100644 --- a/interface/lib/classes/remoting.inc.php +++ b/interface/lib/classes/remoting.inc.php @@ -180,37 +180,14 @@ $session_id = $app->db->quote($session_id); $sql = "DELETE FROM remote_session WHERE remote_session = '$session_id'"; - $app->db->query($sql); - return $app->db->affectedRows() == 1; + if($app->db->query($sql) != false) { + return true; + } else { + return false; + } } - //* Add mail domain - public function mail_user_add($session_id, $client_id, $params){ - global $app; - - if (!$this->checkPerm($session_id, 'mail_user_add')){ - $this->server->fault('permission_denied','You do not have the permissions to access this function.'); - return false; - } - - //* Check if mail domain exists - $email_parts = explode('@',$params['email']); - $tmp = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = '".$app->db->quote($email_parts[1])."'"); - if($tmp['domain'] != $email_parts[1]) { - $this->server->fault('mail_domain_does_not_exist','Mail domain - '.$email_parts[1].' - does not exist.'); - return false; - } - - //* Set a few params to non empty values that will be overwritten by mail_plugin - if (!isset($params['uid'])) $params['uid'] = 999989999; - if (!isset($params['gid'])) $params['gid'] = 999989999; - - $affected_rows = $this->insertQuery('../mail/form/mail_user.tform.php', $client_id, $params); - return $affected_rows; - } - //** protected functions ----------------------------------------------------------------------------------- - protected function klientadd($formdef_file, $reseller_id, $params) { @@ -363,6 +340,10 @@ //* Load the form definition $app->remoting_lib->loadFormDef($formdef_file); + + //* get old record and merge with params, so only new values have to be set in $params + $old_rec = $app->remoting_lib->getDataRecord($primary_id); + $params = $app->functions->array_merge($old_rec,$params); //* Get the SQL query $sql = $app->remoting_lib->getSQL($params, 'UPDATE', $primary_id); @@ -505,17 +486,50 @@ } } - // needed from inside the remoting plugins - public function server_get($session_id, $server_id, $section ='') { + public function server_get($session_id, $server_id = null, $section ='') { global $app; if(!$this->checkPerm($session_id, 'server_get')) { - throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - if (!empty($session_id) && !empty($server_id)) { - $app->uses('remoting_lib , getconf'); - $section_config = $app->getconf->get_server_config($server_id, $section); - return $section_config; + if (!empty($session_id)) { + if(!empty($server_id)) { + $app->uses('remoting_lib , getconf'); + $section_config = $app->getconf->get_server_config($server_id, $section); + return $section_config; + } else { + $servers = array(); + $sql = "SELECT server_id FROM server WHERE 1"; + $all = $app->db->queryAllRecords($sql); + foreach($all as $s) { + $servers[$s['server_id']] = $app->getconf->get_server_config($s['server_id'], $section); + } + unset($all); + unset($s); + return $servers; + } + } else { + return false; + } + } + + /** + Gets a list of all servers + @param int session_id + @param int server_name + @author Marius Cramer <m.cramer@pixcept.de> 2014 + */ + public function server_get_all($session_id) + { + global $app; + if(!$this->checkPerm($session_id, 'server_get')) { + $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); + return false; + } + if (!empty($session_id)) { + $sql = "SELECT server_id, server_name FROM server WHERE 1"; + $servers = $app->db->queryAllRecords($sql); + return $servers; } else { return false; } -- Gitblit v1.9.1