From 0608b6cb22c404a48989e96e844b5b40833f8574 Mon Sep 17 00:00:00 2001 From: glaszig Date: Sun, 18 Aug 2019 23:29:46 +0100 Subject: [PATCH] use template for system page --- includes/system.php | 120 ++----------------------------------------- templates/system.php | 114 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 116 deletions(-) create mode 100644 templates/system.php diff --git a/includes/system.php b/includes/system.php index 5615c1a9..a6de2a21 100755 --- a/includes/system.php +++ b/includes/system.php @@ -1,6 +1,7 @@ 'Türkçe' ); - require_once "lib/system.php"; - $system = new System(); - - $hostname = $system->hostname(); - $uptime = $system->uptime(); - $cores = $system->processorCount(); - - // mem used - $memused = $system->usedMemory(); - $memused_status = "primary"; - if ($memused > 90) { - $memused_status = "danger"; - } elseif ($memused > 75) { - $memused_status = "warning"; - } elseif ($memused > 0) { - $memused_status = "success"; - } - - // cpu load - $cpuload = $system->systemLoadPercentage(); - if ($cpuload > 90) { - $cpuload_status = "danger"; - } elseif ($cpuload > 75) { - $cpuload_status = "warning"; - } elseif ($cpuload > 0) { - $cpuload_status = "success"; - } - - if (isset($_POST['system_reboot'])) { - $status->addMessage("System Rebooting Now!", "warning", false); - $result = shell_exec("sudo /sbin/reboot"); - } - if (isset($_POST['system_shutdown'])) { - $status->addMessage("System Shutting Down Now!", "warning", false); - $result = shell_exec("sudo /sbin/shutdown -h now"); - } - - ?> -
-
-
-
-
- showMessages(); ?> -
- - - -
-
-
-
-

-

-

-


-
-
-
% -
-
-
-
-
% -
-
- - - - " /> - " /> - " onclick="document.location.reload(true)" /> - -
-
-
- -
-

-
-
- - -
-
- " /> - " onclick="document.location.reload(true)" /> -
- -
-
-
- -
-
-
- -
- - -
- -
-
-
- hostname(); +$uptime = $system->uptime(); +$cores = $system->processorCount(); + +// mem used +$memused = $system->usedMemory(); +$memused_status = "primary"; +if ($memused > 90) { + $memused_status = "danger"; +} elseif ($memused > 75) { + $memused_status = "warning"; +} elseif ($memused > 0) { + $memused_status = "success"; +} + +// cpu load +$cpuload = $system->systemLoadPercentage(); +if ($cpuload > 90) { + $cpuload_status = "danger"; +} elseif ($cpuload > 75) { + $cpuload_status = "warning"; +} elseif ($cpuload > 0) { + $cpuload_status = "success"; +} + +if (isset($_POST['system_reboot'])) { + $status->addMessage("System Rebooting Now!", "warning", false); + $result = shell_exec("sudo /sbin/reboot"); +} +if (isset($_POST['system_shutdown'])) { + $status->addMessage("System Shutting Down Now!", "warning", false); + $result = shell_exec("sudo /sbin/shutdown -h now"); +} + +?> +
+
+
+
+
+showMessages(); ?> +
+ + + +
+
+
+
+

+

+

+


+
+
+
% +
+
+
+
+
% +
+
+ + + + " /> + " /> + " onclick="document.location.reload(true)" /> + +
+
+
+ +
+

+
+
+ + +
+
+ " /> + " onclick="document.location.reload(true)" /> +
+ +
+
+
+ +
+
+
+ +
+ + +
+ +
+
+