mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-17 03:04:47 -05:00
25 lines
523 B
PHP
25 lines
523 B
PHP
<?php
|
|
/** @phpstan-var \Gazelle\User $Viewer */
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Gazelle;
|
|
|
|
if (!$Viewer->permitted('site_moderate_forums')) {
|
|
Error403::error();
|
|
}
|
|
authorize();
|
|
|
|
$thread = new Manager\ForumThread()->findById((int)($_POST['threadid'] ?? 0));
|
|
if (is_null($thread)) {
|
|
Error404::error();
|
|
}
|
|
$body = trim($_POST['body'] ?? '');
|
|
if (!strlen($body)) {
|
|
Error400::error("Thread note cannot be empty");
|
|
}
|
|
|
|
$thread->addThreadNote($Viewer, $body);
|
|
|
|
header("Location: {$thread->location()}#thread_notes");
|