Admin: split action handlers and refresh project docs

This commit is contained in:
2026-02-21 14:25:42 +03:00
parent ccb13f3e38
commit d295afd8ec
6 changed files with 889 additions and 829 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
function adminHandleGetAction(string $action): void
{
if ($action !== 'photo_comments') {
return;
}
$photoId = (int)($_GET['photo_id'] ?? 0);
if ($photoId < 1) {
adminJsonResponse(['ok' => false, 'message' => 'Некорректный photo_id'], 400);
}
$photo = photoById($photoId);
if (!$photo) {
adminJsonResponse(['ok' => false, 'message' => 'Фото не найдено'], 404);
}
adminJsonResponse([
'ok' => true,
'photo' => ['id' => (int)$photo['id'], 'code_name' => (string)$photo['code_name']],
'comments' => commentsByPhoto($photoId),
]);
}