web-base/Core/Documents/Info.class.php

32 lines
898 B
PHP
Raw Normal View History

2022-06-01 12:28:50 +02:00
<?php
2022-11-18 18:06:46 +01:00
namespace Core\Documents;
2022-06-01 12:28:50 +02:00
2022-11-18 18:06:46 +01:00
use Core\Elements\EmptyHead;
use Core\Elements\HtmlDocument;
use Core\Elements\SimpleBody;
2022-11-30 16:42:24 +01:00
use Core\Objects\DatabaseEntity\Group;
2022-11-18 18:06:46 +01:00
use Core\Objects\Router\Router;
2022-06-01 12:28:50 +02:00
class Info extends HtmlDocument {
public function __construct(Router $router) {
parent::__construct($router, EmptyHead::class, InfoBody::class);
2022-08-20 22:17:17 +02:00
$this->searchable = false;
2022-06-01 12:28:50 +02:00
}
}
class InfoBody extends SimpleBody {
protected function getContent(): string {
2022-11-30 16:42:24 +01:00
$user = $this->getContext()->getUser();
2022-11-20 17:13:53 +01:00
if ($user && $user->hasGroup(Group::ADMIN)) {
2024-04-23 20:14:32 +02:00
ob_start();
2022-06-01 12:28:50 +02:00
phpinfo();
2024-04-23 20:14:32 +02:00
$content = ob_get_contents();
ob_end_clean();
return $content;
2022-06-01 12:28:50 +02:00
} else {
$message = "You are not logged in or do not have the proper privileges to access this page.";
return $this->getDocument()->getRouter()->returnStatusCode(403, [ "message" => $message] );
}
}
}