Skip to content

Commit 67fbfc0

Browse files
author
vogelor
committed
it is not possible to change the server after a record is insert
1 parent c95f8cd commit 67fbfc0

13 files changed

+190
-16
lines changed

interface/web/admin/firewall_edit.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,21 @@
4949
$app->load('tform_actions');
5050

5151
class page_action extends tform_actions {
52-
52+
function onBeforeUpdate() {
53+
global $app, $conf;
54+
55+
//* Check if the server has been changed
56+
// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
57+
if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
58+
$rec = $app->db->queryOneRecord("SELECT server_id from firewall WHERE firewall_id = ".$this->id);
59+
if($rec['server_id'] != $this->dataRecord["server_id"]) {
60+
//* Add a error message and switch back to old server
61+
$app->tform->errorMessage .= $app->lng('The Server can not be changed.');
62+
$this->dataRecord["server_id"] = $rec['server_id'];
63+
}
64+
unset($rec);
65+
}
66+
}
5367
}
5468

5569
$page = new page_action;

interface/web/admin/server_ip_edit.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,28 @@
4646

4747
// Loading classes
4848
$app->uses('tpl,tform,tform_actions');
49+
$app->load('tform_actions');
4950

50-
// let tform_actions handle the page
51-
$app->tform_actions->onLoad();
51+
class page_action extends tform_actions {
52+
53+
function onBeforeUpdate() {
54+
global $app, $conf;
55+
56+
//* Check if the server has been changed
57+
// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
58+
if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
59+
$rec = $app->db->queryOneRecord("SELECT server_id from server_ip WHERE server_ip_id = ".$this->id);
60+
if($rec['server_id'] != $this->dataRecord["server_id"]) {
61+
//* Add a error message and switch back to old server
62+
$app->tform->errorMessage .= $app->lng('The Server can not be changed.');
63+
$this->dataRecord["server_id"] = $rec['server_id'];
64+
}
65+
unset($rec);
66+
}
67+
}
68+
}
69+
70+
$page = new page_action;
71+
$page->onLoad();
5272

5373
?>

interface/web/admin/server_ip_list.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
$app->auth->check_module_permissions('admin');
4646

4747
$app->uses('listform_actions');
48+
49+
$app->listform_actions->SQLOrderBy = "ORDER BY server_id, ip_address";
50+
4851
$app->listform_actions->onLoad();
4952

5053

interface/web/mail/lib/module.conf.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
'target' => 'content',
6060
'link' => 'mail/spamfilter_policy_list.php');
6161

62-
$items[] = array( 'title' => 'Server Settings',
63-
'target' => 'content',
64-
'link' => 'mail/spamfilter_config_list.php');
62+
// $items[] = array( 'title' => 'Server Settings',
63+
// 'target' => 'content',
64+
// 'link' => 'mail/spamfilter_config_list.php');
6565
}
6666

6767
$module['nav'][] = array( 'title' => 'Spamfilter',

interface/web/mail/mail_blacklist_edit.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,24 @@ function onShowNew() {
7171

7272
parent::onShowNew();
7373
}
74-
74+
75+
76+
function onBeforeUpdate() {
77+
global $app, $conf;
78+
79+
//* Check if the server has been changed
80+
// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
81+
if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
82+
$rec = $app->db->queryOneRecord("SELECT server_id from mail_access WHERE access_id = ".$this->id);
83+
if($rec['server_id'] != $this->dataRecord["server_id"]) {
84+
//* Add a error message and switch back to old server
85+
$app->tform->errorMessage .= $app->lng('The Server can not be changed.');
86+
$this->dataRecord["server_id"] = $rec['server_id'];
87+
}
88+
unset($rec);
89+
}
90+
}
91+
7592
function onSubmit() {
7693
global $app, $conf;
7794

interface/web/mail/mail_content_filter_edit.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,21 @@
5252
$app->load('tform_actions');
5353

5454
class page_action extends tform_actions {
55-
55+
function onBeforeUpdate() {
56+
global $app, $conf;
57+
58+
//* Check if the server has been changed
59+
// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
60+
if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
61+
$rec = $app->db->queryOneRecord("SELECT server_id from mail_content_filter WHERE content_filter_id = ".$this->id);
62+
if($rec['server_id'] != $this->dataRecord["server_id"]) {
63+
//* Add a error message and switch back to old server
64+
$app->tform->errorMessage .= $app->lng('The Server can not be changed.');
65+
$this->dataRecord["server_id"] = $rec['server_id'];
66+
}
67+
unset($rec);
68+
}
69+
}
5670
}
5771

5872
$page = new page_action;

interface/web/mail/mail_transport_edit.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,23 @@ function onShowEnd() {
110110

111111
parent::onShowEnd();
112112
}
113-
113+
114+
function onBeforeUpdate() {
115+
global $app, $conf;
116+
117+
//* Check if the server has been changed
118+
// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
119+
if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
120+
$rec = $app->db->queryOneRecord("SELECT server_id from mail_transport WHERE transport_id = ".$this->id);
121+
if($rec['server_id'] != $this->dataRecord["server_id"]) {
122+
//* Add a error message and switch back to old server
123+
$app->tform->errorMessage .= $app->lng('The Server can not be changed.');
124+
$this->dataRecord["server_id"] = $rec['server_id'];
125+
}
126+
unset($rec);
127+
}
128+
}
129+
114130
function onSubmit() {
115131
global $app, $conf;
116132

interface/web/mail/mail_whitelist_edit.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,22 @@ function onShowNew() {
7272
parent::onShowNew();
7373
}
7474

75+
function onBeforeUpdate() {
76+
global $app, $conf;
77+
78+
//* Check if the server has been changed
79+
// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
80+
if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
81+
$rec = $app->db->queryOneRecord("SELECT server_id from mail_access WHERE access_id = ".$this->id);
82+
if($rec['server_id'] != $this->dataRecord["server_id"]) {
83+
//* Add a error message and switch back to old server
84+
$app->tform->errorMessage .= $app->lng('The Server can not be changed.');
85+
$this->dataRecord["server_id"] = $rec['server_id'];
86+
}
87+
unset($rec);
88+
}
89+
}
90+
7591
function onSubmit() {
7692
global $app, $conf;
7793

interface/web/mail/spamfilter_blacklist_edit.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,23 @@ function onShowNew() {
7171
parent::onShowNew();
7272
}
7373

74-
function onSubmit() {
74+
function onBeforeUpdate() {
75+
global $app, $conf;
76+
77+
//* Check if the server has been changed
78+
// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
79+
if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
80+
$rec = $app->db->queryOneRecord("SELECT server_id from spamfilter_wblist WHERE id = ".$this->id);
81+
if($rec['server_id'] != $this->dataRecord["server_id"]) {
82+
//* Add a error message and switch back to old server
83+
$app->tform->errorMessage .= $app->lng('The Server can not be changed.');
84+
$this->dataRecord["server_id"] = $rec['server_id'];
85+
}
86+
unset($rec);
87+
}
88+
}
89+
90+
function onSubmit() {
7591
global $app, $conf;
7692

7793
// Check the client limits, if user is not the admin

interface/web/mail/spamfilter_users_edit.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,23 @@ function onShowNew() {
7171
parent::onShowNew();
7272
}
7373

74-
function onSubmit() {
74+
function onBeforeUpdate() {
75+
global $app, $conf;
76+
77+
//* Check if the server has been changed
78+
// We do this only for the admin or reseller users, as normal clients can not change the server ID anyway
79+
if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
80+
$rec = $app->db->queryOneRecord("SELECT server_id from spamfilter_users WHERE id = ".$this->id);
81+
if($rec['server_id'] != $this->dataRecord["server_id"]) {
82+
//* Add a error message and switch back to old server
83+
$app->tform->errorMessage .= $app->lng('The Server can not be changed.');
84+
$this->dataRecord["server_id"] = $rec['server_id'];
85+
}
86+
unset($rec);
87+
}
88+
}
89+
90+
function onSubmit() {
7591
global $app, $conf;
7692

7793
// Check the client limits, if user is not the admin

0 commit comments

Comments
 (0)