diff --git a/frontend/module.vps.overview.php b/frontend/module.vps.overview.php index 36ebbea..8549aaa 100644 --- a/frontend/module.vps.overview.php +++ b/frontend/module.vps.overview.php @@ -29,7 +29,7 @@ if(!empty($router->uParameters[2])) } } -$sPageContents = Templater::InlineRender("vps.overview", $locale->strings, array( +$sVariables = array( 'id' => $sContainer->sId, 'server-location' => $sContainer->sNode->sPhysicalLocation, 'operating-system' => $sContainer->sTemplate->sName, @@ -39,14 +39,50 @@ $sPageContents = Templater::InlineRender("vps.overview", $locale->strings, array 'total-traffic-limit' => "{$sContainer->sTotalTrafficLimit} bytes", 'bandwidth-limit' => "100mbit", 'status' => $sContainer->sStatusText, - 'disk-used' => number_format($sContainer->sDiskUsed / 1024, 2), - 'disk-total' => number_format($sContainer->sDiskTotal / 1024, 2), - 'disk-percentage' => number_format(($sContainer->sDiskUsed / $sContainer->sDiskTotal) * 100, 2), - 'disk-unit' => "GB", - 'ram-used' => $sContainer->sRamUsed, - 'ram-total' => $sContainer->sRamTotal, - 'ram-percentage' => ($sContainer->sRamUsed / $sContainer->sRamTotal) * 100, - 'ram-unit' => "MB" - -)); + 'traffic-used' => number_format(($sContainer->sIncomingTrafficUsed + $sContainer->sOutgoingTrafficUsed) / 1024 / 1024 / 1024, 2), + 'traffic-total' => number_format(($sContainer->sIncomingTrafficLimit + $sContainer->sOutgoingTrafficLimit) / 1024 / 1024 / 1024, 0), + 'traffic-percentage' => number_format(($sContainer->sIncomingTrafficUsed + $sContainer->sOutgoingTrafficUsed) / ($sContainer->sIncomingTrafficLimit + $sContainer->sOutgoingTrafficLimit), 2), + 'traffic-unit' => "GB" +); + +try +{ + $sVariables = array_merge($sVariables, array( + 'disk-used' => number_format($sContainer->sDiskUsed / 1024, 2), + 'disk-total' => number_format($sContainer->sDiskTotal / 1024, 2), + 'disk-percentage' => number_format(($sContainer->sDiskUsed / $sContainer->sDiskTotal) * 100, 2), + 'disk-unit' => "GB" + )); +} +catch (SshExitException $e) +{ + $sVariables = array_merge($sVariables, array( + 'disk-used' => 0, + 'disk-total' => 0, + 'disk-percentage' => 0, + 'disk-unit' => "GB" + )); +} + +try +{ + $sVariables = array_merge($sVariables, array( + 'ram-used' => $sContainer->sRamUsed, + 'ram-total' => $sContainer->sRamTotal, + 'ram-percentage' => ($sContainer->sRamUsed / $sContainer->sRamTotal) * 100, + 'ram-unit' => "MB" + )); +} +catch (SshExitException $e) +{ + $sVariables = array_merge($sVariables, array( + 'ram-used' => 0, + 'ram-total' => 0, + 'ram-percentage' => 0, + 'ram-unit' => "MB" + )); +} + + +$sPageContents = Templater::InlineRender("vps.overview", $locale->strings, $sVariables); ?> diff --git a/frontend/templates/vps.overview.tpl b/frontend/templates/vps.overview.tpl index 1103a51..cbe6f31 100644 --- a/frontend/templates/vps.overview.tpl +++ b/frontend/templates/vps.overview.tpl @@ -19,8 +19,8 @@

Traffic

-
-
80/1000GB
+
+
<%?traffic-used>/<%?traffic-total><%?traffic-unit>
@@ -68,11 +68,11 @@ IPv4 Addresses - 98.142.213.226, 204.12.235.84 + IPv6 Addresses - 2607:f7a0:1:1::24:6 + Guaranteed RAM