canDownload($sUserInfo); if($dCanDownload !== '') { http_response_code(403); switch($dCanDownload) { case 'inactive': die('This download is inactive.'); case 'private': die('You must be logged in for this download.'); case 'pending': die('This download is pending approval.'); default: die($dCanDownload); } } if(isset($_GET['action'])) { if(empty($_GET['boob']) || !hash_equals($sVerification, (string)filter_input(INPUT_GET, 'boob'))) { header('Location: /info.php?id=' . $dTorrentInfo->getId()); exit; } switch(filter_input(INPUT_GET, 'action')) { case 'recalculate-info-hash': if($sUserInfo->canRecalculateInfoHash()) { $builder = SeriaTorrentBuilder::import($dTorrentInfo); $dTorrentInfo->setHash($builder->calculateInfoHash()); $dTorrentInfo->update(); } header('Location: /info.php?id=' . $dTorrentInfo->getId()); exit; case 'approve': if($sUserInfo->canApproveTorrents()) { $dTorrentInfo->approve(); $dTorrentInfo->update(); } header('Location: /info.php?id=' . $dTorrentInfo->getId()); exit; case 'deny': if($sUserInfo->canApproveTorrents()) $dTorrentInfo->nuke(); header('Location: /pending.php'); exit; } } $tPageTitle = $dTorrentInfo->getName(); require_once __DIR__ . '/_header.php'; echo '
'; echo '
'; echo '

' . htmlspecialchars($dTorrentInfo->getName()) . '

'; echo ''; echo '
'; echo '
'; echo ''; if($sUserInfo->canApproveTorrents() && $dTorrentInfo->isApproved()) { echo '
'; echo '
Approved on
'; echo '
'; echo '
'; } echo '
'; echo '
Total size
'; echo '
' . byte_symbol($dTorrentInfo->getSize()) . ' (' . number_format($dTorrentInfo->getSize()) . ' bytes)
'; echo '
'; echo '
'; echo '
Uploading
'; echo '
' . number_format($dTorrentInfo->getCompletePeers()) . '
'; echo '
'; echo '
'; echo '
Downloading
'; echo '
' . number_format($dTorrentInfo->getIncompletePeers()) . '
'; echo '
'; if($dTorrentInfo->isPrivate()) { echo '
'; echo '
Visibility
'; echo '
Private
'; echo '
'; } echo '
'; if($dTorrentInfo->hasUser()) { try { $dUserInfo = SeriaUser::byId($pdo, $dTorrentInfo->getUserId()); echo '
'; echo '
Submitted by
'; echo '
'; echo ''; echo '
'; } catch(SeriaUserNotFoundException $ex) {} } if(!$dTorrentInfo->isApproved() && $sUserInfo->canApproveTorrents()) { echo '
'; echo '
This torrent is pending approval.
'; echo 'APPROVE'; echo 'DENY'; echo '
'; } $dComment = $dTorrentInfo->getComment(); if(!empty($dComment)) { echo '
'; echo '
Description
'; echo '
';
    echo htmlspecialchars($dComment);
    echo '
'; echo '
'; } echo '
'; require_once __DIR__ . '/_footer.php';