mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-16 18:04:34 -05:00
27 lines
597 B
PHP
27 lines
597 B
PHP
<?php
|
|
/** @phpstan-var \Gazelle\User $Viewer */
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Gazelle;
|
|
|
|
if (!$Viewer->permittedAny('admin_reports', 'site_moderate_forums')) {
|
|
json_error('forbidden');
|
|
}
|
|
authorize();
|
|
|
|
$report = new Manager\Report()->findById((int)($_POST['reportid'] ?? 0));
|
|
if (is_null($report)) {
|
|
json_error('no report id');
|
|
}
|
|
if (
|
|
!$Viewer->permitted('admin_reports')
|
|
&&
|
|
!in_array($report->subjectType(), ['comment', 'post', 'thread'])
|
|
) {
|
|
json_error('forbidden ' . $report->subjectType());
|
|
}
|
|
$report->resolve($Viewer);
|
|
|
|
echo json_encode(['status' => 'success']);
|