Kristan Kenney 5 лет назад
Родитель
Сommit
1a2805f6de
4 измененных файлов с 14 добавлено и 6 удалено
  1. 3 0
      bin/v-change-user-theme
  2. 4 2
      web/edit/user/index.php
  3. 3 0
      web/inc/main.php
  4. 4 4
      web/templates/header.html

+ 3 - 0
bin/v-change-user-theme

@@ -42,6 +42,9 @@ check_hestia_demo_mode
 #                       Action                             #
 #----------------------------------------------------------#
 
+if [ -z $THEME ]; then
+    add_object_key "user" 'USER' "$user" 'THEME' 'LANGUAGE'
+fi
 update_user_value "$user" '$THEME' "$theme"
 
 $BIN/v-log-action "$user" "Info" "System" "User theme changed (User: $user, Theme: $theme)."

+ 4 - 2
web/edit/user/index.php

@@ -237,10 +237,12 @@ if (!empty($_POST['save'])) {
         if ($_POST['v_user_theme'] != $_SESSION['userTheme']) {
             exec (HESTIA_CMD."v-change-user-theme ".escapeshellarg($v_username)." ".escapeshellarg($_POST['v_user_theme']), $output, $return_var);
             check_return_code($return_var,$output);
-            unset($_SESSION['userTheme']);
             unset($output);
             $v_user_theme = $_POST['v_user_theme'];
-            $_SESSION['userTheme'] = $v_user_theme;
+            if ($_SESSION['user'] === $v_username) {
+                unset($_SESSION['userTheme']);
+                $_SESSION['userTheme'] = $v_user_theme;
+            }
         }
     }
 

+ 3 - 0
web/inc/main.php

@@ -158,6 +158,9 @@ function top_panel($user, $TAB) {
     $panel = json_decode(implode('', $output), true);
     unset($output);
 
+    unset($_SESSION['userTheme']);
+    $_SESSION['userTheme'] = $panel[$user]['THEME'];
+
     // Set home location URLs
     if (($_SESSION['userContext'] === 'admin') && (!isset($_SESSION['look']))) {
         // Display users list for administrators unless they are impersonating a user account

+ 4 - 4
web/templates/header.html

@@ -6,14 +6,14 @@
   <title><?php echo $_SERVER['HTTP_HOST']; ?> - <?=_($TAB)?> - <?=_('Hestia Control Panel');?></title>
   <!-- Load base system theme-->
   <link type="text/css" rel="stylesheet" href="/css/themes/default.min.css?<?=JS_LATEST_UPDATE?>" rel="preload" />
-  <? if ($_SESSION['userTheme']) {
+  <? if (!empty($_SESSION['userTheme'])) {
         $selected_theme = $_SESSION['userTheme']; 
      } else {
-        $seleced_theme = $_SESSION['THEME'];
+        $selected_theme = $_SESSION['THEME'];
      } 
   ?>
   <!-- Load custom theme -->
-  <? if (($_SESSION['THEME'] !== 'default') || ($_SESSION['userTheme'] !== 'default')) {?>
+  <? if ($selectedTheme !== 'default') {?>
     <!-- Load HestiaCP-shipped themes (minified, updated/overwritten with updates) - ($HESTIA/web/css/themes/*.min.css) -->
     <link type="text/css" rel="stylesheet" href="/css/themes/<?php echo $selected_theme; ?>.min.css?<?php echo rand(); ?>" rel="preload" />
     <!-- Load custom theme files ($HESTIA/web/css/themes/custom/*.css) -->
@@ -37,7 +37,7 @@
 </head>
 <body class="body-<?=strtolower($TAB)?> lang-<?=$_SESSION['language']?>">
     <?php if (($_SESSION['DEBUG_MODE']) == "true" ) {?>
-    <div style="font-size:12px !important; padding:12px;position:sticky;top:0;z-index:3000;background-color:">
+    <div style="font-size:12px !important; padding:12px;position:sticky;top:0;z-index:3000;background-color:#fff;">
         <?php
             echo "<h3>Server Variables</h3>";
             foreach ($_SERVER as $key=>$val)