Server Fixes

This commit is contained in:
Václav Španinger 2020-07-23 15:16:44 +02:00
parent 0323323bb1
commit 727ed03be7
8 changed files with 25 additions and 21 deletions

View File

@ -7,7 +7,7 @@ $router->setDefault(function(){
}); });
//Pages //Pages
$router->any('/', 'Log'); $router->any('/log', 'Log');
$router->any('/login', 'Login'); $router->any('/login', 'Login');
$router->any('/logout', 'Logout'); $router->any('/logout', 'Logout');
$router->any('/automation', 'Automation'); $router->any('/automation', 'Automation');

View File

@ -4,7 +4,7 @@ class Automation extends Template
function __construct() function __construct()
{ {
$userManager = new UserManager(); $userManager = new UserManager();
global $lang; $langMng = new LanguageManager('en');
if (!$userManager->isLogin()){ if (!$userManager->isLogin()){
header('Location: ' . BASEURL . 'login'); header('Location: ' . BASEURL . 'login');

View File

@ -19,7 +19,7 @@ class Log extends Template
function __construct() function __construct()
{ {
$userManager = new UserManager(); $userManager = new UserManager();
global $lang; $langMng = new LanguageManager('en');
if (!$userManager->isLogin()){ if (!$userManager->isLogin()){
header('Location: ' . BASEURL . 'login'); header('Location: ' . BASEURL . 'login');
@ -48,6 +48,8 @@ class Log extends Template
$template->prepare('UPTIME', shell_exec('uptime -p')); $template->prepare('UPTIME', shell_exec('uptime -p'));
$template->prepare('ramFree', $this->getSystemMemInfo()["MemFree"]); $template->prepare('ramFree', $this->getSystemMemInfo()["MemFree"]);
$template->prepare('ramTotal', $this->getSystemMemInfo()["MemTotal"]); $template->prepare('ramTotal', $this->getSystemMemInfo()["MemTotal"]);
$template->prepare('diskFree', disk_free_space("/"));
$template->prepare('diskTotal', disk_total_space("/")); $template->prepare('diskTotal', disk_total_space("/"));
$template->prepare('serverTime', date('m. d. Y H:i:s - e')); $template->prepare('serverTime', date('m. d. Y H:i:s - e'));

View File

@ -4,7 +4,7 @@ class Login extends Template
function __construct() function __construct()
{ {
$userManager = new UserManager(); $userManager = new UserManager();
global $lang;
if ($userManager->isLogin()){ if ($userManager->isLogin()){
header('Location: ' . BASEURL); header('Location: ' . BASEURL);
@ -13,7 +13,6 @@ class Login extends Template
$template = new Template('login'); $template = new Template('login');
$template->prepare('baseDir', BASEDIR); $template->prepare('baseDir', BASEDIR);
$template->prepare('title', 'Home'); $template->prepare('title', 'Home');
$template->prepare('lang', $lang);

View File

@ -4,14 +4,12 @@ class Oauth extends Template
function __construct() function __construct()
{ {
global $userManager; global $userManager;
global $lang; $langMng = new LanguageManager('en');
$template = new Template('oauth'); $template = new Template('oauth');
$template->prepare('baseDir', BASEDIR); $template->prepare('baseDir', BASEDIR);
$template->prepare('title', 'Simple Home - Oauth'); $template->prepare('title', 'Simple Home - Oauth');
$template->prepare('lang', $lang);
if (isset($_GET['redirect_uri'])) { if (isset($_GET['redirect_uri'])) {
$template->prepare('responseType', $_GET['response_type']); $template->prepare('responseType', $_GET['response_type']);
$template->prepare('redirectUrl', $_GET['redirect_uri']); $template->prepare('redirectUrl', $_GET['redirect_uri']);

View File

@ -5,7 +5,7 @@ class Setting extends Template
{ {
$userManager = new UserManager(); $userManager = new UserManager();
global $lang; $langMng = new LanguageManager('en');
if (!$userManager->isLogin()){ if (!$userManager->isLogin()){
header('Location: ' . BASEURL . 'login'); header('Location: ' . BASEURL . 'login');

View File

@ -22,20 +22,25 @@
</div> </div>
<div class="col-md-9 main-body"> <div class="col-md-9 main-body">
<div class="col-12 col-sm-9 mx-auto mt-4"> <div class="col-12 col-sm-9 mx-auto mt-4">
<label><?php echo $LANGMNG->get('l_logMaxLiveTime') . " " . $LOGTOLIVETIME . " days";?></label></br> <h1><?php echo $LANGMNG->get('t_ServerStats'); ?></h1>
<hr>
<label>CPU: <?php echo $CPU;?></label></br>
<progress value="<?php echo $CPU;?>" max="1"> <?php echo $RAMFREE;?> </progress></br>
<label>UPTIME: <?php echo $UPTIME;?></label></br> <label>UPTIME: <?php echo $UPTIME;?></label></br>
<label>SERVER TIME: <?php echo $SERVERTIME;?></label></br>
<hr>
<label>CPU: <?php echo $CPU;?></label></br>
<label>CPU Usage: </label><progress value="<?php echo $CPU;?>" max="1"> <?php echo $RAMFREE;?> </progress></br>
<hr>
<label>RAM TOTAL: <?php echo $RAMTOTAL;?></label></br> <label>RAM TOTAL: <?php echo $RAMTOTAL;?></label></br>
<label>RAM FREE: <?php echo $RAMFREE;?></label></br> <label>RAM FREE: <?php echo $RAMFREE;?></label></br>
<progress value="<?php echo explode(" ", $RAMFREE)[0];?>" max="<?php echo explode(" ", $RAMTOTAL)[0];?>"> <?php echo $RAMFREE;?> </progress></br> <label>RAM Usage: </label><progress value="<?php echo explode(" ", $RAMFREE)[0];?>" max="<?php echo explode(" ", $RAMTOTAL)[0];?>"> <?php echo $RAMFREE;?> </progress></br>
<hr>
<label>DISKTOTAL: <?php echo $DISKTOTAL;?> bytes available</label></br> <label>DISK TOTAL: <?php echo $DISKTOTAL;?> bytes</label></br>
<label>SERVER TIME: <?php echo $SERVERTIME;?></label></br> <label>DISK FREE: <?php echo $DISKFREE;?> bytes</label></br>
<label>DISK Usage: </label><progress value="<?php echo explode(" ", $DISKFREE)[0];?>" max="<?php echo explode(" ", $DISKTOTAL)[0];?>"> <?php echo $DISKFREE;?> </progress></br>
<hr>
<h1><?php echo $LANGMNG->get('t_Logs'); ?></h1>
<label><?php echo $LANGMNG->get('l_logMaxLiveTime') . " " . $LOGTOLIVETIME . " days";?></label></br>
<form method="post" action=""> <form method="post" action="">
<div class="field"> <div class="field">
<select class="input" name="LogFile"> <select class="input" name="LogFile">
@ -50,7 +55,7 @@
</form> </form>
<?php <?php
if (isset($_POST['LogFile'])) { if (isset($_POST['LogFile'])) {
$file_lines = file('./app/logs/' . $_POST['LogFile']); $file_lines = file('../logs/' . $_POST['LogFile']);
echo '<pre style="overflow: auto;">'; echo '<pre style="overflow: auto;">';
foreach ($file_lines as $line) { foreach ($file_lines as $line) {
echo $line; echo $line;

View File

@ -14,7 +14,7 @@
'fa-bug' =>[ 'fa-bug' =>[
'slug' => 'log', 'slug' => 'log',
'lngKey' => 'log', 'lngKey' => 'log',
'path' => '', 'path' => 'log',
], ],
]; ];
foreach ( $menuItems as $key => $value) { foreach ( $menuItems as $key => $value) {