Skip to content

Commit ec09b18

Browse files
committed
Disallow server changes for existing records in mail_domain_edit.php
1 parent 71a87cf commit ec09b18

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

interface/web/mail/mail_domain_edit.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,24 @@ function onAfterInsert() {
176176
} // endif spamfilter policy
177177
}
178178

179+
function onBeforeUpdate() {
180+
global $app, $conf;
181+
182+
//* Check if the server has been changed
183+
// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
184+
if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
185+
$rec = $app->db->queryOneRecord("SELECT server_id from mail_domain WHERE domain_id = ".$this->id);
186+
if($rec['server_id'] != $this->dataRecord["server_id"]) {
187+
//* Add a error message and switch back to old server
188+
$app->tform->errorMessage .= $app->lng('The Server can not be changed.');
189+
$this->dataRecord["server_id"] = $rec['server_id'];
190+
}
191+
unset($rec);
192+
}
193+
}
194+
195+
196+
179197
function onAfterUpdate() {
180198
global $app, $conf;
181199

0 commit comments

Comments
 (0)