From f4f981d8f98e4f74a8d69d05a31ab63e188ea808 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Sun, 15 Nov 2015 08:00:17 -0500
Subject: [PATCH] Added missing delimiter settings in reseller form file.

---
 interface/web/sites/database_edit.php |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php
index 7319e9a..e64a03f 100644
--- a/interface/web/sites/database_edit.php
+++ b/interface/web/sites/database_edit.php
@@ -154,7 +154,8 @@
 
 		if($this->id > 0) {
 			//* we are editing a existing record
-			$app->tpl->setVar("edit_disabled", 1);
+			$edit_disabled = @($_SESSION["s"]["user"]["typ"] == 'admin')? 0 : 1; //* admin can change the database-name
+			$app->tpl->setVar("edit_disabled", $edit_disabled);
 			$app->tpl->setVar("server_id_value", $this->dataRecord["server_id"]);
 			$app->tpl->setVar("database_charset_value", $this->dataRecord["database_charset"]);
 			$app->tpl->setVar("limit_database_quota", $this->dataRecord["database_quota"]);
@@ -174,7 +175,7 @@
 		if($_SESSION["s"]["user"]["typ"] != 'admin') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			$client = $app->db->queryOneRecord("SELECT db_servers, limit_database, limit_database_quota, parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.groupid = ", $client_group_id);
+			$client = $app->db->queryOneRecord("SELECT db_servers, limit_database, limit_database_quota, parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.groupid = ?", $client_group_id);
 
 			// When the record is updated
 			if($this->id > 0) {
@@ -300,8 +301,11 @@
 		$dbname_prefix = $app->tools_sites->getPrefix($old_record['database_name_prefix'], $dbname_prefix);
 		$this->dataRecord['database_name_prefix'] = $dbname_prefix;
 
-		if($old_record["database_name"] != $dbname_prefix . $this->dataRecord["database_name"]) {
-			$app->tform->errorMessage .= $app->tform->wordbook["database_name_change_txt"].'<br />';
+		//* Only admin can change the database name
+		if ($_SESSION["s"]["user"]["typ"] != 'admin') {
+			if($old_record["database_name"] != $dbname_prefix . $this->dataRecord["database_name"]) {
+				$app->tform->errorMessage .= $app->tform->wordbook["database_name_change_txt"].'<br />';
+			}
 		}
 		if($old_record["database_charset"] != $this->dataRecord["database_charset"]) {
 			$app->tform->errorMessage .= $app->tform->wordbook["database_charset_change_txt"].'<br />';

--
Gitblit v1.9.1