Namespace and ClassPath rewrites
This commit is contained in:
28
Core/Documents/Info.class.php
Normal file
28
Core/Documents/Info.class.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Documents;
|
||||
|
||||
use Core\Elements\EmptyHead;
|
||||
use Core\Elements\HtmlDocument;
|
||||
use Core\Elements\SimpleBody;
|
||||
use Core\Objects\Router\Router;
|
||||
|
||||
class Info extends HtmlDocument {
|
||||
public function __construct(Router $router) {
|
||||
parent::__construct($router, EmptyHead::class, InfoBody::class);
|
||||
$this->searchable = false;
|
||||
}
|
||||
}
|
||||
|
||||
class InfoBody extends SimpleBody {
|
||||
protected function getContent(): string {
|
||||
$user = $this->getDocument()->getUser();
|
||||
if ($user && $user->hasGroup(USER_GROUP_ADMIN)) {
|
||||
phpinfo();
|
||||
return "";
|
||||
} 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] );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user