From 4cd62d78914e7a657f1471cd6d1aa1ad074b526c Mon Sep 17 00:00:00 2001
From: Falko Timme <ft@falkotimme.com>
Date: Sun, 2 Mar 2014 19:05:02 +0100
Subject: [PATCH] - Remoting: added function to get all IP addresses of a
 server.

---
 interface/lib/classes/remoting.inc.php  | 16 +++++++++++++++-
 interface/web/admin/lib/remote.conf.php |  2 +-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index 3fe307deb..9dd5dc7eb 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -331,7 +331,7 @@ class remoting {
 		return $all;
 	}
 
-	//* Get server ips
+	//* Get server ip
 	public function server_ip_get($session_id, $primary_id)
 	{
 		global $app;
@@ -345,6 +345,20 @@ class remoting {
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
 	
+	//* Get all server ips
+	public function server_ip_get_by_server_id($session_id, $server_id)
+	{
+		global $app;
+
+		if(!$this->checkPerm($session_id, 'server_ip_get_by_server_id')) {
+			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
+			return false;
+		}
+		$sql = "SELECT * FROM server_ip WHERE server_id  = $server_id";
+		$all = $app->db->queryAllRecords($sql);
+		return $all;
+	}
+	
 	//* Add a IP address record
 	public function server_ip_add($session_id, $client_id, $params)
 	{
diff --git a/interface/web/admin/lib/remote.conf.php b/interface/web/admin/lib/remote.conf.php
index 37aec7179..834714029 100644
--- a/interface/web/admin/lib/remote.conf.php
+++ b/interface/web/admin/lib/remote.conf.php
@@ -1,6 +1,6 @@
 <?php
 
-$function_list['server_get,get_function_list,client_templates_get_all,server_get_serverid_by_ip,server_ip_get,server_ip_add,server_ip_update,server_ip_delete'] = 'Server functions';
+$function_list['server_get,get_function_list,client_templates_get_all,server_get_serverid_by_ip,server_ip_get,server_ip_get_by_server_id,server_ip_add,server_ip_update,server_ip_delete'] = 'Server functions';
 $function_list['admin_record_permissions'] = 'Record permission changes';
 
 ?>
-- 
GitLab