Skip to content

Commit 21206c4

Browse files
committed
- Added the readonly attribute to tabs.
- Clients that are not resellers can not change the basic web settings anymore.
1 parent f1b9899 commit 21206c4

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

interface/lib/classes/tform.inc.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,14 @@ function getCurrentTab() {
10241024
return $_SESSION["s"]["form"]["tab"];
10251025
}
10261026

1027+
function isReadonlyTab($tab) {
1028+
if(isset($this->formDef['tabs'][$tab]['readonly']) && $this->formDef['tabs'][$tab]['readonly'] == true) {
1029+
return true;
1030+
} else {
1031+
return false;
1032+
}
1033+
}
1034+
10271035

10281036
// translation function for forms, tries the form wordbook first and if this fails, it tries the global wordbook
10291037
function lng($msg) {

interface/lib/classes/tform_actions.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ function onUpdate() {
168168

169169
function onUpdateSave($sql) {
170170
global $app;
171-
if(!empty($sql)) {
171+
if(!empty($sql) && !$app->tform->isReadonlyTab($app->tform->getCurrentTab())) {
172172
$app->db->query($sql);
173173
if($app->db->errorMessage != '') die($app->db->errorMessage);
174174
}

interface/web/sites/form/web_domain.tform.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,19 @@
5050
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
5151
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
5252

53+
// Clients may not change the website basic settings if they are not resellers
54+
if($app->auth->has_clients($_SESSION['s']['user']['userid']) || $app->auth->is_admin()) {
55+
$web_domain_edit_readonly = false;
56+
} else {
57+
$web_domain_edit_readonly = true;
58+
}
59+
60+
5361
$form["tabs"]['domain'] = array (
5462
'title' => "Domain",
5563
'width' => 100,
5664
'template' => "templates/web_domain_edit.htm",
65+
'readonly' => $web_domain_edit_readonly,
5766
'fields' => array (
5867
##################################
5968
# Begin Datatable fields
@@ -188,6 +197,7 @@
188197
'title' => "Redirect",
189198
'width' => 100,
190199
'template' => "templates/web_domain_redirect.htm",
200+
'readonly' => false,
191201
'fields' => array (
192202
##################################
193203
# Begin Datatable fields
@@ -216,6 +226,7 @@
216226
'title' => "SSL",
217227
'width' => 100,
218228
'template' => "templates/web_domain_ssl.htm",
229+
'readonly' => false,
219230
'fields' => array (
220231
##################################
221232
# Begin Datatable fields
@@ -302,6 +313,7 @@
302313
'title' => "Options",
303314
'width' => 100,
304315
'template' => "templates/web_domain_advanced.htm",
316+
'readonly' => false,
305317
'fields' => array (
306318
##################################
307319
# Begin Datatable fields

0 commit comments

Comments
 (0)