From cc65688b3da3e16729a1f73dd50fd975bd1ff741 Mon Sep 17 00:00:00 2001
From: hellkat <hellkat@ispconfig3>
Date: Tue, 26 Mar 2013 00:43:51 -0400
Subject: [PATCH]     Merged revisions 3845-3876 and 3879-3918 from stable branch.

---
 interface/web/sites/ajax_get_json.php |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/interface/web/sites/ajax_get_json.php b/interface/web/sites/ajax_get_json.php
index f7bbc71..ba9a32e 100644
--- a/interface/web/sites/ajax_get_json.php
+++ b/interface/web/sites/ajax_get_json.php
@@ -130,23 +130,21 @@
 	}
     
     if($type == 'getdatabaseusers') {
-		$json = '{';
-        
+        $json = '{}';
+		
 		$sql = "SELECT sys_groupid FROM web_domain WHERE domain_id = $web_id";
         $group = $app->db->queryOneRecord($sql);
         if($group) {
             $sql = "SELECT database_user_id, database_user FROM web_database_user WHERE sys_groupid = '" . $group['sys_groupid'] . "'";
             $records = $app->db->queryAllRecords($sql);
             
+			$tmp_array = array();
             foreach($records as $record) {
-                $json .= '"'.$record['database_user_id'].'": "'.$record['database_user'].'",';
+				$tmp_array[$record['database_user_id']] = $record['database_user'];
             }
-            unset($records);
-            unset($group);
+			$json = $app->functions->json_encode($tmp_array);
+            unset($records, $group, $tmp_array);
         }
-        
-        if(substr($json,-1) == ',') $json = substr($json,0,-1);
-		$json .= '}';
     }
 	
 	if($type == 'get_use_combobox'){

--
Gitblit v1.9.1