Gazelle/sections/torrents/peerlist.php

69 lines
1.9 KiB
PHP
Raw Normal View History

2013-07-10 00:08:53 +00:00
<?php
2013-05-01 08:00:16 +00:00
if (!isset($_GET['torrentid']) || !is_number($_GET['torrentid'])) {
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("
2013-05-29 08:00:51 +00:00
SELECT
SQL_CALC_FOUND_ROWS
2013-05-01 08:00:16 +00:00
xu.uid,
t.Size,
xu.active,
xu.connectable,
xu.uploaded,
xu.remaining,
xu.useragent
2012-03-28 08:00:20 +00:00
FROM xbt_files_users AS xu
2013-07-10 00:08:53 +00:00
LEFT JOIN users_main AS um ON um.ID = xu.uid
JOIN torrents AS t ON t.ID = xu.fid
WHERE xu.fid = '$TorrentID'
AND um.Visible = '1'
2012-11-10 08:00:08 +00:00
ORDER BY xu.uid = '$LoggedUser[ID]' DESC, xu.uploaded DESC
2012-03-28 08:00:20 +00:00
LIMIT $Limit");
2013-07-10 00:08:53 +00:00
$DB->query('SELECT FOUND_ROWS()');
2012-03-28 08:00:20 +00:00
list($NumResults) = $DB->next_record();
$DB->set_query_id($Result);
?>
2012-10-14 08:00:20 +00:00
<h4>Peer List</h4>
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_peers', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?>
<table>
<tr class="colhead_dark" style="font-weight: bold;">
<td>User</td>
<td>Active</td>
<td>Connectable</td>
2013-08-28 23:08:41 +00:00
<td class="number_column">Up</td>
<td class="number_column">%</td>
2012-03-28 08:00:20 +00:00
<td>Client</td>
</tr>
<?
2013-05-01 08:00:16 +00:00
while (list($PeerUserID, $Size, $Active, $Connectable, $Uploaded, $Remaining, $UserAgent) = $DB->next_record()) {
2012-03-28 08:00:20 +00:00
?>
<tr>
2012-10-11 08:00:15 +00:00
<td><?=Users::format_username($PeerUserID, false, false, false)?></td>
2013-08-28 23:08:41 +00:00
<td><?=($Active) ? '<span style="color: green;">Yes</span>' : '<span style="color: red;">No</span>' ?></td>
2013-05-01 08:00:16 +00:00
<td><?= ($Connectable) ? '<span style="color: green;">Yes</span>' : '<span style="color: red;">No</span>' ?></td>
2013-08-28 23:08:41 +00:00
<td class="number_column"><?=Format::get_size($Uploaded) ?></td>
<td class="number_column"><?=number_format(($Size - $Remaining) / $Size * 100, 2)?></td>
2012-03-28 08:00:20 +00:00
<td><?=display_str($UserAgent)?></td>
</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_peers', $_GET['torrentid'], $NumResults, $Page)?></div>
<? } ?>