Gazelle/sections/torrents/snatchlist.php

68 lines
1.4 KiB
PHP
Raw Normal View History

2012-03-28 08:00:20 +00:00
<?
2013-05-01 08:00:16 +00:00
if (!isset($_GET['torrentid']) || !is_number($_GET['torrentid']) || !check_perms('site_view_torrent_snatchlist')) {
error(404);
}
2012-03-28 08:00:20 +00:00
$TorrentID = $_GET['torrentid'];
2013-05-01 08:00:16 +00:00
if (!empty($_GET['page']) && is_number($_GET['page'])) {
2012-03-28 08:00:20 +00:00
$Page = $_GET['page'];
2013-05-01 08:00:16 +00:00
$Limit = (string)(($Page - 1) * 100) .', 100';
2012-03-28 08:00:20 +00:00
} else {
$Page = 1;
$Limit = 100;
}
2013-05-01 08:00:16 +00:00
$Result = $DB->query("
SELECT SQL_CALC_FOUND_ROWS
xs.uid,
xs.tstamp
FROM xbt_snatched AS xs
WHERE xs.fid='$TorrentID'
ORDER BY xs.tstamp DESC
LIMIT $Limit");
2012-03-28 08:00:20 +00:00
$Results = $DB->to_array('uid', MYSQLI_ASSOC);
$DB->query("SELECT FOUND_ROWS()");
list($NumResults) = $DB->next_record();
?>
2012-10-14 08:00:20 +00:00
<h4 title="List of users that have reported a snatch to the tracker">List of Snatchers</h4>
2012-03-28 08:00:20 +00:00
2013-05-01 08:00:16 +00:00
<? if ($NumResults > 100) { ?>
2012-03-28 08:00:20 +00:00
<div class="linkbox"><?=js_pages('show_snatches', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?>
<table>
<tr class="colhead_dark" style="font-weight: bold;">
<td>User</td>
<td>Time</td>
2013-02-22 08:00:24 +00:00
2012-03-28 08:00:20 +00:00
<td>User</td>
<td>Time</td>
</tr>
<tr>
<?
$i = 0;
2013-05-01 08:00:16 +00:00
foreach ($Results as $ID=>$Data) {
2012-03-28 08:00:20 +00:00
list($SnatcherID, $Timestamp) = array_values($Data);
2013-02-22 08:00:24 +00:00
2013-05-01 08:00:16 +00:00
if ($i % 2 == 0 && $i > 0) {
2013-02-22 08:00:24 +00:00
?>
2012-03-28 08:00:20 +00:00
</tr>
2013-02-22 08:00:24 +00:00
<tr>
2012-03-28 08:00:20 +00:00
<?
}
2013-02-22 08:00:24 +00:00
?>
2012-10-11 08:00:15 +00:00
<td><?=Users::format_username($SnatcherID, true, true, true, true)?></td>
2012-03-28 08:00:20 +00:00
<td><?=time_diff($Timestamp)?></td>
<?
$i++;
}
?>
</tr>
</table>
2013-05-01 08:00:16 +00:00
<? if ($NumResults > 100) { ?>
2012-03-28 08:00:20 +00:00
<div class="linkbox"><?=js_pages('show_snatches', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?>