From 67fbfc013d3a2a7757894d9fe0ef7b5311d25a40 Mon Sep 17 00:00:00 2001 From: vogelor <vogelor@ispconfig3> Date: Fri, 12 Dec 2008 09:53:19 -0500 Subject: [PATCH] it is not possible to change the server after a record is insert --- interface/web/sites/database_edit.php | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php index d9b0181..b537c68 100644 --- a/interface/web/sites/database_edit.php +++ b/interface/web/sites/database_edit.php @@ -188,7 +188,23 @@ parent::onSubmit(); } - + + function onBeforeUpdate() { + global $app, $conf; + + //* Check if the server has been changed + // We do this only for the admin or reseller users, as normal clients can not change the server ID anyway + if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) { + $rec = $app->db->queryOneRecord("SELECT server_id from web_database WHERE database_id = ".$this->id); + if($rec['server_id'] != $this->dataRecord["server_id"]) { + //* Add a error message and switch back to old server + $app->tform->errorMessage .= $app->lng('The Server can not be changed.'); + $this->dataRecord["server_id"] = $rec['server_id']; + } + unset($rec); + } + } + function onUpdate() { global $app, $conf; -- Gitblit v1.9.1