From 738c3d47f74d8a117175452aac2cd662b0e3b95b Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Mon, 10 Feb 2014 09:14:49 -0500
Subject: [PATCH] Merge remote-tracking branch 'origin/stable-3.0.5'
---
interface/lib/classes/remoting.inc.php | 73 ++++++++++++++++++++----------------
1 files changed, 40 insertions(+), 33 deletions(-)
diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index 268b257..cbe693f 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -184,33 +184,7 @@
return $app->db->affectedRows() == 1;
}
- //* 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)
{
@@ -505,17 +479,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