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
$router->any('/', 'Log');
$router->any('/log', 'Log');
$router->any('/login', 'Login');
$router->any('/logout', 'Logout');
$router->any('/automation', 'Automation');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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