Просмотр исходного кода

Multiple fixes in UI (#2710)

* Fix: #2705 Do run v-change-sys-php after each save

Only when it was changes: 
DEFAULT_PHP_VERSION return phpx.x vs x.x

* Rename Application ID to Key ID to match Backblaze

* Fix #2707 Not saving rate limit for old accounts 1.5.x pre

* Fix Users menu does not appear

PHP8.1 create warning / errors when variable is not set propperly  causing this check to be not working
Jaap Marcus 3 лет назад
Родитель
Сommit
bf9499a1d0

+ 4 - 0
bin/v-change-mail-account-rate-limit

@@ -24,6 +24,8 @@ source /etc/hestiacp/hestia.conf
 source $HESTIA/func/main.sh
 # shellcheck source=/usr/local/hestia/func/domain.sh
 source $HESTIA/func/domain.sh
+# shellcheck source=/usr/local/hestia/func/syshealth.sh
+source $HESTIA/func/syshealth.sh
 # load config file
 source_conf "$HESTIA/conf/hestia.conf"
 
@@ -82,6 +84,8 @@ if [[ "$rate" = "system" ]]; then
     rate=''
 fi
 
+syshealth_repair_mail_account_config
+
 # Update quota
 update_object_value "mail/$domain" 'ACCOUNT' "$account" '$RATE_LIMIT' "$rate"
 

+ 3 - 1
web/edit/server/index.php

@@ -327,10 +327,12 @@ if (!empty($_POST['save'])) {
         }
 
         if (empty($_SESSION['error_msg'])) {
-            if ($_POST['v_php_default_version'] != DEFAULT_PHP_VERSION) {
+            if ('php-'.$_POST['v_php_default_version'] != DEFAULT_PHP_VERSION) {
                 exec(HESTIA_CMD . "v-change-sys-php " . escapeshellarg($_POST['v_php_default_version']), $output, $return_var);
                 check_return_code($return_var, $output);
                 unset($output);
+                //force reload
+                $require_refresh = true;
             }
         }
     }

+ 2 - 3
web/inc/main.php

@@ -176,7 +176,6 @@ function render_page($user, $TAB, $page)
 
     // Policies controller
     @include_once(dirname(__DIR__) . '/inc/policies.php');
-
     // Body
     include($__template_dir . 'pages/' . $page . '.html');
 
@@ -269,9 +268,9 @@ function top_panel($user, $TAB)
     if (!isset($_SESSION['look'])) {
         $_SESSION['userSortOrder'] = $panel[$user]['PREF_UI_SORT'];
     }
-
+    
     // Set home location URLs
-    if (($_SESSION['userContext'] === 'admin') && (!isset($_SESSION['look']))) {
+    if (($_SESSION['userContext'] === 'admin') && (empty($_SESSION['look']))) {
         // Display users list for administrators unless they are impersonating a user account
         $home_url = '/list/user/';
     } else {

+ 6 - 3
web/list/log/index.php

@@ -1,5 +1,8 @@
 <?php
 
+// Main include
+include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
+
 if (empty($_GET['user'])) {
     $_GET['user'] = '';
 }
@@ -9,9 +12,6 @@ if ($_GET['user'] === 'system') {
     $TAB = 'LOG';
 }
 
-// Main include
-include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
-
 // Redirect non-administrators if they request another user's log
 if (($_SESSION['userContext'] !== 'admin') && (!empty($_GET['user']))) {
     header('location: /login/');
@@ -35,4 +35,7 @@ if (empty($_SESSION['look'])) {
 }
 
 // Render page
+if($user === 'system'){
+    $user = "'".$_SESSION['user']."'";
+}
 render_page($user, $TAB, 'list_log');

+ 1 - 1
web/list/user/index.php

@@ -11,7 +11,7 @@ if ($_SESSION['userContext'] === 'user') {
 }
 
 // Do not show the users list if user is impersonating another user
-if (isset($_SESSION['look'])) {
+if (!empty($_SESSION['look'])) {
     header("Location: /login/");
     exit;
 }

+ 1 - 1
web/templates/includes/panel.html

@@ -98,7 +98,7 @@
 	<div class="l-center">
 		<div class="l-stat">
 			<!-- Users tab -->
-			<?php if (($_SESSION['userContext'] === 'admin') && (!isset($_SESSION['look']))) {?>
+			<?php if (($_SESSION['userContext'] == 'admin') && (empty($_SESSION['look']))) {?>
 				<?php 
 					if (($_SESSION['user'] !== 'admin') && ($_SESSION['POLICY_SYSTEM_HIDE_ADMIN'] === 'yes')) {
 						$user_count = $panel[$user]['U_USERS'] - 1;

+ 1 - 1
web/templates/pages/edit_server.html

@@ -806,7 +806,7 @@
 															</tr>
 															<tr>
 																<td class="vst-text">
-																	<?=_('Application ID');?>
+																	<?=_('Key ID');?>
 																</td>
 															</tr>
 															<tr>