SiDoMan/pages/dashboard.php

40 lines
1.3 KiB
PHP
Raw Permalink Normal View History

2020-10-23 12:16:07 +00:00
<?php
if(isset($_SESSION['LOGIN']))
{
if($_SESSION['LOGIN'] == 'true')
{
$dockerClient = new Docker();
$allContainers = $dockerClient->getAllContainers();
2020-10-24 15:13:00 +00:00
$currentContainer = NULL;
2020-10-23 12:16:07 +00:00
foreach($allContainers as $thisContainer)
{
2020-10-23 20:45:35 +00:00
if($thisContainer['Id'] == $_SESSION['CONTAINER'] || $_SESSION['CONTAINER'] == ltrim($thisContainer['Names']['0'], '/'))
2020-10-24 15:13:00 +00:00
$currentContainer = $thisContainer;
2020-10-23 12:16:07 +00:00
}
2020-10-24 15:13:00 +00:00
if($currentContainer == NULL)
2020-10-23 21:47:52 +00:00
{
2020-10-23 12:16:07 +00:00
die("unknown container");
2020-10-23 21:47:52 +00:00
}
2020-10-23 20:58:16 +00:00
2020-10-23 20:46:35 +00:00
$logOutput = $dockerClient->getContainerLogs($_SESSION['CONTAINER']);
2020-10-23 19:07:43 +00:00
2020-10-23 12:16:07 +00:00
$HTML = new HTML();
2020-10-24 15:13:00 +00:00
$HTML->setHTMLTitle(ltrim($currentContainer['Names']['0'], '/'));
2020-10-23 12:16:07 +00:00
$HTML->importHTML("style/default/dashboard.html");
2020-10-23 12:18:53 +00:00
2020-10-24 15:13:00 +00:00
$HTML->ReplaceLayoutInhalt("%%ContainerName%%", trim(ltrim($currentContainer['Names']['0'], '/')));
2020-10-23 19:39:01 +00:00
$HTML->ReplaceLayoutInhalt("%%ContainerLogOutput%%", html_entity_decode(clean($logOutput)));
2020-10-24 15:13:00 +00:00
$HTML->ReplaceLayoutInhalt("%%STATUS%%", html_entity_decode($currentContainer['Status']));
2020-10-25 12:02:46 +00:00
$HTML->ReplaceLayoutInhalt("%%APIKey%%", trim($currentContainer['Labels']['remotepass']));
2020-10-23 12:18:53 +00:00
2020-10-23 12:16:07 +00:00
$HTML->build();
echo $HTML->ausgabe();
}else{
die("Login is not valid!");
}
}else{
die("Access denied!");
}
?>