From dbec714af82bd591345d8da464bb869ae15b54f9 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Fri, 4 Nov 2022 12:39:10 +0100 Subject: [PATCH] fix traffic display in dashboards Signed-off-by: Michael Kaufmann --- admin_index.php | 2 +- customer_index.php | 2 +- lib/Froxlor/UI/Callbacks/ProgressBar.php | 2 +- lib/formfields/admin/customer/formfield.customer_edit.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin_index.php b/admin_index.php index 8038c7fb..2a079400 100644 --- a/admin_index.php +++ b/admin_index.php @@ -101,7 +101,7 @@ if ($page == 'overview') { $userinfo['traffic_bytes'] = ($userinfo['traffic'] > -1) ? $userinfo['traffic'] * 1024 : -1; $overview['traffic_bytes'] = $overview['traffic_assigned'] * 1024; - $overview['traffic_bytes_used'] = $overview['traffic_used'] * 1024; + $overview['traffic_bytes_used'] = $overview['traffic_used']; $number_domains_stmt = Database::prepare(" SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "` diff --git a/customer_index.php b/customer_index.php index 9ec5f27c..1ffd1cc5 100644 --- a/customer_index.php +++ b/customer_index.php @@ -109,7 +109,7 @@ if ($page == 'overview') { // get everything in bytes for the percentage calculation on the dashboard $userinfo['diskspace_bytes'] = ($userinfo['diskspace'] > -1) ? $userinfo['diskspace'] * 1024 : -1; $userinfo['traffic_bytes'] = ($userinfo['traffic'] > -1) ? $userinfo['traffic'] * 1024 : -1; - $userinfo['traffic_bytes_used'] = $userinfo['traffic_used'] * 1024; + $userinfo['traffic_bytes_used'] = $userinfo['traffic_used']; if ($usages) { $userinfo['diskspace_bytes_used'] = $usages['webspace'] * 1024; diff --git a/lib/Froxlor/UI/Callbacks/ProgressBar.php b/lib/Froxlor/UI/Callbacks/ProgressBar.php index f1c216c3..40e0215f 100644 --- a/lib/Froxlor/UI/Callbacks/ProgressBar.php +++ b/lib/Froxlor/UI/Callbacks/ProgressBar.php @@ -89,6 +89,6 @@ class ProgressBar */ public static function traffic(array $attributes): array { - return self::pbData('traffic', $attributes['fields'], 1024, (int)Settings::Get('system.report_trafficmax')); + return self::pbData('traffic', $attributes['fields'], 1, (int)Settings::Get('system.report_trafficmax')); } } diff --git a/lib/formfields/admin/customer/formfield.customer_edit.php b/lib/formfields/admin/customer/formfield.customer_edit.php index ce51f7f6..6c4088f3 100644 --- a/lib/formfields/admin/customer/formfield.customer_edit.php +++ b/lib/formfields/admin/customer/formfield.customer_edit.php @@ -51,7 +51,7 @@ return [ 'label' => lng('admin.stdsubdomain_add') . '?', 'type' => 'checkbox', 'value' => '1', - 'checked' => $result['standardsubdomain'] + 'checked' => (bool)$result['standardsubdomain'] ], 'deactivated' => [ 'label' => lng('admin.deactivated_user'),