Skip to content

Commit 800da87

Browse files
author
Kristan Kenney
committed
Add POLICY_USER_CHANGE_THEME
1 parent 9213e9f commit 800da87

File tree

8 files changed

+40
-3
lines changed

8 files changed

+40
-3
lines changed

bin/v-change-sys-config-value

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ check_ckey=$(grep "^$key='" $HESTIA/conf/hestia.conf)
4545
if [ -z "$check_ckey" ]; then
4646
echo "$key='$value'" >> $HESTIA/conf/hestia.conf
4747
else
48-
sed -i "s|$key=.*|$key='$value'|g" $HESTIA/conf/hestia.conf
48+
sed -i "s|^$key=.*|$key='$value'|g" $HESTIA/conf/hestia.conf
4949
fi
5050

5151
# Sort configuration file in alphabetical order on change

bin/v-list-sys-config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ json_list() {
7979
"POLICY_SYSTEM_HIDE_ADMIN": "'$POLICY_SYSTEM_HIDE_ADMIN'",
8080
"POLICY_USER_EDIT_DETAILS": "'$POLICY_USER_EDIT_DETAILS'",
8181
"POLICY_USER_DELETE_LOGS": "'$POLICY_USER_DELETE_LOGS'",
82-
"POLICY_USER_VIEW_LOGS": "'$POLICY_USER_VIEW_LOGS'"
82+
"POLICY_USER_VIEW_LOGS": "'$POLICY_USER_VIEW_LOGS'",
83+
"POLICY_USER_CHANGE_THEME": "'$POLICY_USER_CHANGE_THEME'"
8384
}
8485
}'
8586
}

web/edit/server/index.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,17 @@
739739
}
740740
}
741741

742+
// Change POLICY_USER_CHANGE_THEME
743+
if (empty($_SESSION['error_msg'])) {
744+
if ($_POST['v_policy_user_change_theme'] != $_SESSION['POLICY_USER_CHANGE_THEME']) {
745+
exec (HESTIA_CMD."v-change-sys-config-value POLICY_USER_CHANGE_THEME ".escapeshellarg($_POST['v_policy_user_change_theme']), $output, $return_var);
746+
check_return_code($return_var,$output);
747+
unset($output);
748+
if (empty($_SESSION['error_msg'])) $v_enforce_subdomain_ownership = $_POST['v_policy_user_change_theme'];
749+
$v_security_adv = 'yes';
750+
}
751+
}
752+
742753
// Change POLICY_SYSTEM_HIDE_ADMIN
743754
if (empty($_SESSION['error_msg'])) {
744755
if ($_POST['v_policy_system_hide_admin'] != $_SESSION['POLICY_SYSTEM_HIDE_ADMIN']) {

web/inc/main.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ function top_panel($user, $TAB) {
161161
if (isset($panel[$user]['THEME'])) {
162162
$_SESSION['userTheme'] = $panel[$user]['THEME'];
163163
}
164+
165+
if ($_SESSION['POLICY_USER_CHANGE_THEME'] === 'no') {
166+
unset($_SESSION['userTheme']);
167+
}
164168

165169
// Set home location URLs
166170
if (($_SESSION['userContext'] === 'admin') && (!isset($_SESSION['look']))) {

web/login/index.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ function authenticate_user($user, $password, $twofa = ''){
174174

175175
$_SESSION['userContext'] = $data[$user]['ROLE'];
176176
$_SESSION['userTheme'] = $data[$user]['THEME'];
177-
177+
if ($_SESSION['POLICY_USER_CHANGE_THEME'] === 'no') {
178+
unset($_SESSION['userTheme']);
179+
}
180+
178181
// Define session user
179182
$_SESSION['user'] = key($data);
180183
$v_user = $_SESSION['user'];

web/templates/admin/edit_server.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,20 @@
10981098
<br><br>
10991099
</td>
11001100
</tr>
1101+
<tr>
1102+
<td class="vst-text input-label">
1103+
<?php print _('Allow users to change user interface theme');?>
1104+
</td>
1105+
</tr>
1106+
<tr>
1107+
<td>
1108+
<select class="vst-list" name="v_policy_user_change_theme">
1109+
<option value='yes' <?php if($_SESSION['POLICY_USER_CHANGE_THEME'] !== 'no') echo 'selected' ?>><?php print _('yes'); ?></option>
1110+
<option value='no' <?php if($_SESSION['POLICY_USER_CHANGE_THEME'] == 'no') echo 'selected' ?>><?php print _('no'); ?></option>
1111+
</select>
1112+
<br><br>
1113+
</td>
1114+
</tr>
11011115
<tr>
11021116
<td class="vst-text input-label">
11031117
<?php print _('Inactive session timeout');?> (<?php print _('Minutes');?>)

web/templates/admin/edit_user.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
</tr>
179179
<? } ?>
180180
<? } ?>
181+
<? if ($_SESSION['POLICY_USER_CHANGE_THEME'] !== 'no') {?>
181182
<tr>
182183
<td class="vst-text input-label">
183184
<?php print _('Theme') ?>
@@ -201,6 +202,7 @@
201202
</select>
202203
</td>
203204
</tr>
205+
<?}?>
204206
<tr>
205207
<td class="vst-text input-label">
206208
<?php print _('Package');?>

web/templates/user/edit_user.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
</select>
144144
</td>
145145
</tr>
146+
<? if ($_SESSION['POLICY_USER_CHANGE_THEME'] !== 'no') {?>
146147
<tr>
147148
<td class="vst-text input-label">
148149
<?php print _('Theme') ?>
@@ -166,6 +167,7 @@
166167
</select>
167168
</td>
168169
</tr>
170+
<?}?>
169171
<tr>
170172
<td class="vst-text input-label">
171173
<?php print _('Default Name Servers');?>

0 commit comments

Comments
 (0)