Few Fixes

This commit is contained in:
Václav Španinger 2020-07-28 15:51:40 +02:00
parent 7df378d794
commit ceca8fc057
5 changed files with 11 additions and 8 deletions

View File

@ -4,6 +4,10 @@ $router = new Router();
$router->setDefault(function(){ $router->setDefault(function(){
echo $_GET['url'].': 404'; echo $_GET['url'].': 404';
$logManager = new LogManager();
$logManager->setLevel(LOGLEVEL);
$logManager->write("[ROUTER]" . $_GET['url'] . "not found", LogRecordTypes::WARNING);
unset($logManager);
}); });
//Pages //Pages

View File

@ -79,7 +79,7 @@ class EndpointsApi extends ApiController{
foreach ($deviceLogs as $log) { foreach ($deviceLogs as $log) {
$logManager = new LogManager('../logs/devices/'. date("Y-m-d").'.log'); $logManager = new LogManager('../logs/devices/'. date("Y-m-d").'.log');
$logManager->setLevel(LOGLEVEL); $logManager->setLevel(LOGLEVEL);
$logManager->write("[Device Log Msg] Device_ID " . $deviceId . "->" . $log, LogRecordType::ERROR); $logManager->write("[Device Log Msg] Device_ID " . $deviceId . "->" . $log, LogRecordTypes::ERROR);
unset($logManager); unset($logManager);
} }
} }

View File

@ -30,6 +30,8 @@ class GoogleHomeApi{
break; break;
} }
unset($apiLogManager);
} }
static function autorize(){ static function autorize(){
@ -38,12 +40,12 @@ class GoogleHomeApi{
$apiLogManager = new LogManager('../logs/google-home/'. date("Y-m-d").'.log'); $apiLogManager = new LogManager('../logs/google-home/'. date("Y-m-d").'.log');
$apiLogManager->setLevel(LOGLEVEL); $apiLogManager->setLevel(LOGLEVEL);
$apiLogManager->write("[API] request body\n" . json_encode($obj, JSON_PRETTY_PRINT), LogRecordTypes::INFO); $apiLogManager->write("[API] request body\n" . json_encode($obj, JSON_PRETTY_PRINT), LogRecordTypes::INFO);
$apiLogManager->write("[API] GET body\n" . json_encode($_GET, JSON_PRETTY_PRINT), LogRecordTypes::INFO); $apiLogManager->write("[API] GET body\n" . json_encode($_GET, JSON_PRETTY_PRINT), LogRecordTypes::INFO);
unset($apiLogManager)
$get = [ $get = [
"access_token"=>"2222255888", "access_token"=>"2222255888", //TODO: FIX
"token_type"=>"Bearer", "token_type"=>"Bearer",
"state"=>$_GET["state"], "state"=>$_GET["state"],
]; ];

View File

@ -37,9 +37,6 @@ class Server extends Template
$template->prepare('ip', $_SERVER['SERVER_ADDR']); $template->prepare('ip', $_SERVER['SERVER_ADDR']);
$template->prepare('name', $_SERVER['SERVER_NAME']); $template->prepare('name', $_SERVER['SERVER_NAME']);
echo $_SERVER['SERVER_NAME'];
$template->prepare('CPU', sys_getloadavg()[0]); $template->prepare('CPU', sys_getloadavg()[0]);
$template->prepare('ramFree', $this->getSystemMemInfo()["MemFree"]); $template->prepare('ramFree', $this->getSystemMemInfo()["MemFree"]);
$template->prepare('ramTotal', $this->getSystemMemInfo()["MemTotal"]); $template->prepare('ramTotal', $this->getSystemMemInfo()["MemTotal"]);

View File

@ -34,11 +34,11 @@
<hr> <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>
<label>RAM Usage: </label><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(" ", $RAMTOTAL)[0] - explode(" ", $RAMFREE)[0];?>" max="<?php echo explode(" ", $RAMTOTAL)[0];?>"> <?php echo $RAMFREE;?> </progress></br>
<hr> <hr>
<label>DISK TOTAL: <?php echo $DISKTOTAL;?> bytes</label></br> <label>DISK TOTAL: <?php echo $DISKTOTAL;?> bytes</label></br>
<label>DISK FREE: <?php echo $DISKFREE;?> 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> <label>DISK Usage: </label><progress value="<?php echo explode(" ", $DISKTOTAL)[0] - explode(" ", $DISKFREE)[0];?>" max="<?php echo explode(" ", $DISKTOTAL)[0];?>"> <?php echo $DISKFREE;?> </progress></br>
<hr> <hr>
</div> </div>
</div> </div>