diff --git a/CREDITS.md b/CREDITS.md index 921e4bc..45ff8ce 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -30,6 +30,9 @@ threads I was able to add these very informative graphs. ## Third Party Software +Thanks to the people over at JetBrains for the complementary licenses for PhpStorm which is being used +to develop the portal portion of this project. https://www.jetbrains.com + I would like to thank the developers and contributors to the following projects. Without their hard work and dedication this project would not have been possible. diff --git a/build/portal/html/admin/install.php b/build/portal/html/admin/install.php index a6fb0f8..4224770 100644 --- a/build/portal/html/admin/install.php +++ b/build/portal/html/admin/install.php @@ -220,7 +220,7 @@ EOF; // Add the administrator account. require_once('../classes/account.class.php'); - $account->addAdministrator($name, $email, $login, $password1); + $account->addAdministrator($_POST['name'], $_POST['email'], $_POST['login'], $_POST['password1']); // Mark the installation as complete. $installed = TRUE; diff --git a/build/portal/html/api/system.php b/build/portal/html/api/system.php index 4ea955c..d744305 100644 --- a/build/portal/html/api/system.php +++ b/build/portal/html/api/system.php @@ -28,7 +28,7 @@ // SOFTWARE. // ///////////////////////////////////////////////////////////////////////////////////// - $possibleActions = array("getOsInformation", "getCpuInformation", "getMemoryInformation", "getHddInformation", "getNetworkInformation"); + $possibleActions = array("getOsInformation", "getCpuInformation", "getMemoryInformation", "getHddInformation", "getNetworkInformation", "getUptimeInformation"); if (isset($_GET['action']) && in_array($_GET["action"], $possibleActions)) { switch ($_GET["action"]) { @@ -47,6 +47,9 @@ case "getNetworkInformation": $informationArray = getNetworkInformation(); break; + case "getNetworkInformation": + $informationArray = getUptimeInformation(); + break; } exit(json_encode($informationArray)); } else { @@ -106,14 +109,29 @@ function getHddInformation() { $hddInformation['free'] = round(disk_free_space("/") / 1024 / 1024 / 1024, 2); $hddInformation['total'] = round(disk_total_space("/") / 1024 / 1024/ 1024, 2); - $hddInformation['used'] = $hddInformation['total'] - $stat['hdd_free']; + $hddInformation['used'] = $hddInformation['total'] - $hddInformation['free']; $hddInformation['percent'] = round(sprintf('%.2f',($hddInformation['used'] / $hddInformation['total']) * 100), 2); return $hddInformation; } function getNetworkInformation() { - $networkInformation['rx'] = round(trim(file_get_contents("/sys/class/net/eth0/statistics/rx_bytes")) / 1024 / 1024 / 1024, 2); - $networkInformation['tx'] = round(trim(file_get_contents("/sys/class/net/eth0/statistics/tx_bytes")) / 1024 / 1024 / 1024, 2); + $networkInformation['rx'] = round(trim(file_get_contents("/sys/class/net/eth0/statistics/rx_bytes")) / 125000, 2); + $networkInformation['tx'] = round(trim(file_get_contents("/sys/class/net/eth0/statistics/tx_bytes")) / 125000, 2); return $networkInformation; } + + function getUptimeInformation() { + $procUptime = file('/proc/uptime'); + $uptimeArray = preg_split('/ /', $procUptime); + $uptime['inSeconds'] = trim($uptimeArray[0]); + $uptime['hours'] = floor($uptime['inSeconds'] / 3600); + $uptime['minutes'] = floor(($uptime['inSeconds'] - ($uptime['hours'] * 3600)) / 60); + $uptime['seconds'] = floor($uptime['inSeconds'] % 60); + return $uptime; + + //$idle['inSeconds'] = trim($uptimeArray[1]); + //$idle['hours'] = floor($idle['inSeconds'] / 3600); + //$idle['minutes'] = floor(($idle['inSeconds'] - ($idle['hours'] * 3600)) / 60); + //$idle['seconds'] = floor($idle['inSeconds'] % 60); + } ?> diff --git a/build/portal/html/templates/default/assets/js/system.js b/build/portal/html/templates/default/assets/js/system.js index d29117b..ffcc830 100644 --- a/build/portal/html/templates/default/assets/js/system.js +++ b/build/portal/html/templates/default/assets/js/system.js @@ -9,8 +9,8 @@ $(document).ready(function () { ['Label', 'Value'], ['Memory', 100], ['CPU', 100], - ['Network In', 100] - ['Network Out', 100] + ['Network In (Mbps)', 100] + ['Network Out (Mbps)', 100] ]); var options = { diff --git a/build/portal/html/templates/default/system.tpl b/build/portal/html/templates/default/system.tpl index f9985de..a72b875 100644 --- a/build/portal/html/templates/default/system.tpl +++ b/build/portal/html/templates/default/system.tpl @@ -33,6 +33,9 @@

System Charts

System Information

+ {/area} {area:scripts}