Skip to content

Commit 2ebc330

Browse files
author
Till Brehm
committed
Implemented: FS#2837 - New functions for the API
1 parent b80a703 commit 2ebc330

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

interface/lib/classes/remote.d/server.inc.php

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,74 @@ public function server_ip_delete($session_id, $ip_id)
9191
$affected_rows = $this->deleteQuery('../admin/form/server_ip.tform.php', $ip_id);
9292
return $affected_rows;
9393
}
94+
95+
/**
96+
Gets the server configuration
97+
@param int session id
98+
@param int server id
99+
@param string section of the config field in the server table. Could be 'web', 'dns', 'mail', 'dns', 'cron', etc
100+
@author Julio Montoya <gugli100@gmail.com> BeezNest 2010
101+
*/
102+
103+
104+
public function server_get($session_id, $server_id, $section ='') {
105+
global $app;
106+
if(!$this->checkPerm($session_id, 'server_get')) {
107+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
108+
return false;
109+
}
110+
if (!empty($session_id) && !empty($server_id)) {
111+
$app->uses('remoting_lib , getconf');
112+
$section_config = $app->getconf->get_server_config($server_id, $section);
113+
return $section_config;
114+
} else {
115+
return false;
116+
}
117+
}
118+
119+
/**
120+
Gets the server_id by server_name
121+
@param int session_id
122+
@param int server_name
123+
@author Sascha Bay <info@space2place.de> TheCry 2013
124+
*/
125+
public function server_get_serverid_by_name($session_id, $server_name)
126+
{
127+
global $app;
128+
if(!$this->checkPerm($session_id, 'server_get')) {
129+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
130+
return false;
131+
}
132+
if (!empty($session_id) && !empty($server_name)) {
133+
$sql = "SELECT server_id FROM server WHERE server_name = '$server_name' LIMIT 1 ";
134+
$all = $app->db->queryAllRecords($sql);
135+
return $all;
136+
} else {
137+
return false;
138+
}
139+
}
140+
141+
/**
142+
Gets the functions of a server by server_id
143+
@param int session_id
144+
@param int server_id
145+
@author Sascha Bay <info@space2place.de> TheCry 2013
146+
*/
147+
public function server_get_functions($session_id, $server_id)
148+
{
149+
global $app;
150+
if(!$this->checkPerm($session_id, 'server_get')) {
151+
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
152+
return false;
153+
}
154+
if (!empty($session_id) && !empty($server_id)) {
155+
$sql = "SELECT mail_server, web_server, dns_server, file_server, db_server, vserver_server, proxy_server, firewall_server FROM server WHERE server_id = '$server_id' LIMIT 1 ";
156+
$all = $app->db->queryAllRecords($sql);
157+
return $all;
158+
} else {
159+
return false;
160+
}
161+
}
94162

95163
}
96164

0 commit comments

Comments
 (0)