From 2bbc4c7761a6d0e97cc8f22bccbea94835fcbc7d Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Fri, 28 Aug 2009 06:55:06 -0400
Subject: [PATCH] Add the website user and group also to the passwd and group files in chroot enviroment.

---
 interface/lib/classes/custom_datasource.inc.php |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/interface/lib/classes/custom_datasource.inc.php b/interface/lib/classes/custom_datasource.inc.php
index 298e997..52cd8b7 100644
--- a/interface/lib/classes/custom_datasource.inc.php
+++ b/interface/lib/classes/custom_datasource.inc.php
@@ -40,6 +40,56 @@
 		}
 		return $records_new;
 	}
+	
+	function dns_servers($field, $record) {
+		global $app, $conf;
+		
+		if($_SESSION["s"]["user"]["typ"] == 'user') {
+			// Get the limits of the client
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+			$client = $app->db->queryOneRecord("SELECT default_dnsserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+			$sql = "SELECT server_id,server_name FROM server WHERE server_id = ".$client['default_dnsserver'];
+		} else {
+			$sql = "SELECT server_id,server_name FROM server WHERE dns_server = 1 ORDER BY server_name";
+		}
+		$records = $app->db->queryAllRecords($sql);
+		$records_new = array();
+		if(is_array($records)) {
+			foreach($records as $rec) {
+				$key = $rec['server_id'];
+				$records_new[$key] = $rec['server_name'];
+			}
+		}
+		return $records_new;
+	}
+	
+	
+	function client_servers($field, $record) {
+		global $app, $conf;
+		
+		$server_type = $field['name'];
+		
+		if($_SESSION["s"]["user"]["typ"] == 'user') {
+			// Get the limits of the client
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+			$sql = "SELECT $server_type as server_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id";
+			$client = $app->db->queryOneRecord($sql);
+			$sql = "SELECT server_id,server_name FROM server WHERE server_id = ".$client['server_id'];
+		} else {
+			$sql = "SELECT server_id,server_name FROM server WHERE dns_server = 1 ORDER BY server_name";
+		}
+		$records = $app->db->queryAllRecords($sql);
+		$records_new = array();
+		if(is_array($records)) {
+			foreach($records as $rec) {
+				$key = $rec['server_id'];
+				$records_new[$key] = $rec['server_name'];
+			}
+		}
+		return $records_new;
+	}
+	
+	
 
 }
 

--
Gitblit v1.9.1