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

28 lines
757 B
PHP
Raw Normal View History

2022-06-01 12:28:50 +02:00
<?php
namespace Documents;
use Elements\EmptyHead;
use Elements\HtmlDocument;
use Elements\SimpleBody;
use Objects\Router\Router;
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 {
$user = $this->getDocument()->getUser();
2022-06-20 19:52:31 +02:00
if ($user && $user->hasGroup(USER_GROUP_ADMIN)) {
2022-06-01 12:28:50 +02:00
phpinfo();
2022-06-14 16:55:53 +02:00
return "";
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] );
}
}
}