mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-16 18:04:34 -05:00
22 lines
499 B
PHP
22 lines
499 B
PHP
<?php
|
|
/** @phpstan-var \Gazelle\User $Viewer */
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Gazelle;
|
|
|
|
$postId = (int)($_GET['post'] ?? 0);
|
|
$pm = new Manager\StaffPM()->findByPostId($postId);
|
|
if (is_null($pm)) {
|
|
Error404::error();
|
|
}
|
|
if (!$pm->visible($Viewer)) {
|
|
Error403::error();
|
|
}
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
echo json_encode([
|
|
'username' => new Manager\User()->findById((int)$pm->postUserId($postId))?->username(),
|
|
'body' => $pm->postBody($postId),
|
|
]);
|