Files
ops-Gazelle/sections/ajax/add_log.php
2025-08-27 16:44:44 +02:00

27 lines
608 B
PHP

<?php
/** @phpstan-var \Gazelle\User $Viewer */
declare(strict_types=1);
namespace Gazelle;
$torrent = new Manager\Torrent()->findById((int)($_GET['id'] ?? 0));
if (is_null($torrent)) {
json_error('bad parameters');
}
if ($torrent->uploaderId() != $Viewer->id && !$Viewer->permitted('admin_add_log')) {
json_error('Not your upload.');
}
if (empty($_FILES) || empty($_FILES['logfiles'])) {
json_error('no log files uploaded');
}
echo new Json\AddLog(
$torrent,
$Viewer,
new Manager\TorrentLog(),
new LogfileSummary($_FILES['logfiles']),
)
->setVersion(1)
->response();