1
0
mirror of git://f0xx.org/ac/ac-ms-issues synced 2026-07-29 03:38:42 +03:00
This commit is contained in:
Anton Afanasyeu
2026-06-23 12:29:32 +02:00
commit 892f6e3196
18 changed files with 2134 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/../../src/bootstrap.php';
if (!Auth::user()) {
json_out(['ok' => false, 'error' => 'unauthorized'], 401);
}
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
json_out(['ok' => false, 'error' => 'POST required'], 405);
}
$raw = file_get_contents('php://input');
$data = is_string($raw) && $raw !== '' ? json_decode($raw, true) : $_POST;
$id = (int) ($data['id'] ?? 0);
if ($id <= 0) {
json_out(['ok' => false, 'error' => 'invalid id'], 400);
}
try {
ReportRepository::markViewed($id, (int) Auth::user()['id']);
json_out(['ok' => true, 'id' => $id]);
} catch (Throwable $e) {
error_log('report_viewed: ' . $e->getMessage());
json_out(['ok' => false, 'error' => 'failed'], 500);
}