From 9e247aebcd7065a7e697dd72a3cff63b10ee206c Mon Sep 17 00:00:00 2001
From: Florian Schaal <florian@schaal-24.de>
Date: Fri, 21 Aug 2015 10:16:47 -0400
Subject: [PATCH] FS#2532 - Add possibility to rename databases
---
interface/web/sites/database_edit.php | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php
index 2d051d1..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"]);
@@ -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