seria/public/pending.php
2022-07-03 23:44:11 +00:00

55 lines
1.3 KiB
PHP

<?php
require_once __DIR__ . '/../seria.php';
if(!$sUserInfo->isLoggedIn()) {
http_response_code(403);
die('You must be logged in to view this page.');
}
if(!$sUserInfo->canApproveTorrents()) {
http_response_code(403);
die('You are not allowed to view this page.');
}
$tPageTitle = 'Pending Torrents';
$pPageUrl = '/pending.php?';
$pStartAt = -1;
$pTake = 20;
if(isset($_GET['start']))
$pStartAt = (int)filter_input(INPUT_GET, 'start', FILTER_SANITIZE_NUMBER_INT);
$pTorrents = SeriaTorrent::all($pdo, false, false, null, $pStartAt, $pTake);
require_once __DIR__ . '/_header.php';
echo '<div class="downloads">';
echo '<div class="downloads-header">Pending Torrents</div>';
echo '<div class="downloads-listing">';
$pShowMore = false;
$pLastId = 0;
if(empty($pTorrents)) {
echo '<div class="downloads-nothing">There are no pending torrents!</div>';
} else {
foreach($pTorrents as $torrent) {
echo $torrent->toHTML($sUserInfo, 'downloads-item', true, $sVerification);
$pLastId = $torrent->getId();
}
$pShowMore = count($pTorrents) === $pTake;
}
echo '</div>';
if($pShowMore)
echo '<div class="downloads-more"><a href="' . $pPageUrl . 'start=' . $pLastId . '">View more</a></div>';
echo '</div>';
require_once __DIR__ . '/_footer.php';