:]]'";
}
}
if (!empty($TagWhere)) {
if ($_GET['anyall'] === 'any') {
$Where[] = '('.implode(' OR ', $TagWhere).')';
} else {
$Where[] = '('.implode(' AND ', $TagWhere).')';
}
}
}
if ($_GET['category']) {
if (in_array($_GET['category'], $Categories)) {
$Where[] = "g.CategoryID = '".(array_search($_GET['category'], $Categories)+1)."'";
}
}
} else {
// Error out on invalid requests (before caching)
if (isset($_GET['details'])) {
if (in_array($_GET['details'], array('day', 'week', 'overall', 'snatched', 'data', 'seeded', 'month', 'year'))) {
$Details = $_GET['details'];
} else {
error(404);
}
} else {
$Details = 'all';
}
// Defaults to 10 (duh)
$Limit = (isset($_GET['limit']) ? intval($_GET['limit']) : 10);
$Limit = (in_array($Limit, array(10, 100, 250)) ? $Limit : 10);
}
$Filtered = !empty($Where);
View::show_header("Top $Limit Torrents", 'browse');
?>
$DisableFreeTorrentTop10));
}
}
// Modify the Where query
if ($DisableFreeTorrentTop10) {
$Where[] = "t.FreeTorrent='0'";
}
// The link should say the opposite of the current setting
$FreeleechToggleName = ($DisableFreeTorrentTop10 ? 'show' : 'hide');
$FreeleechToggleQuery = Format::get_url(array('freeleech', 'groups'));
if (!empty($FreeleechToggleQuery)) {
$FreeleechToggleQuery .= '&';
}
$FreeleechToggleQuery .= 'freeleech=' . $FreeleechToggleName;
$GroupByToggleName = ((isset($_GET['groups']) && $_GET['groups'] === 'show') ? 'hide' : 'show');
$GroupByToggleQuery = Format::get_url(array('freeleech', 'groups'));
if (!empty($GroupByToggleQuery)) {
$GroupByToggleQuery .= '&';
}
$GroupByToggleQuery .= 'groups=' . $GroupByToggleName;
$GroupBySum = '';
$GroupBy = '';
if (isset($_GET['groups']) && $_GET['groups'] === 'show') {
$GroupBy = ' GROUP BY g.ID ';
$GroupBySum = md5($GroupBy);
} ?>
get_value('top10tor_day_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsActiveLastDay === false) {
if ($Cache->get_query_lock('top10')) {
$DayAgo = time_minus(86400);
$Query = $BaseQuery.' WHERE t.Seeders>0 AND ';
if (!empty($Where)) {
$Query .= $Where.' AND ';
}
$Query .= "
t.Time>'$DayAgo'
$GroupBy
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveLastDay = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_day_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastDay, 3600 * 2);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveLastDay = false;
}
}
generate_torrent_table('Most Active Torrents Uploaded in the Past Day', 'day', $TopTorrentsActiveLastDay, $Limit);
}
if ($Details === 'all' || $Details === 'week') {
$TopTorrentsActiveLastWeek = $Cache->get_value('top10tor_week_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsActiveLastWeek === false) {
if ($Cache->get_query_lock('top10')) {
$WeekAgo = time_minus(604800);
$Query = $BaseQuery.' WHERE ';
if (!empty($Where)) {
$Query .= $Where.' AND ';
}
$Query .= "
t.Time>'$WeekAgo'
$GroupBy
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveLastWeek = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_week_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastWeek, 3600 * 6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveLastWeek = false;
}
}
generate_torrent_table('Most Active Torrents Uploaded in the Past Week', 'week', $TopTorrentsActiveLastWeek, $Limit);
}
if ($Details === 'all' || $Details === 'month') {
$TopTorrentsActiveLastMonth = $Cache->get_value('top10tor_month_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsActiveLastMonth === false) {
if ($Cache->get_query_lock('top10')) {
$Query = $BaseQuery.' WHERE ';
if (!empty($Where)) {
$Query .= $Where.' AND ';
}
$Query .= "
t.Time > NOW() - INTERVAL 1 MONTH
$GroupBy
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveLastMonth = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_month_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastMonth, 3600 * 6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveLastMonth = false;
}
}
generate_torrent_table('Most Active Torrents Uploaded in the Past Month', 'month', $TopTorrentsActiveLastMonth, $Limit);
}
if ($Details === 'all' || $Details === 'year') {
$TopTorrentsActiveLastYear = $Cache->get_value('top10tor_year_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsActiveLastYear === false) {
if ($Cache->get_query_lock('top10')) {
// IMPORTANT NOTE - we use WHERE t.Seeders>200 in order to speed up this query. You should remove it!
$Query = $BaseQuery.' WHERE ';
if ($Details === 'all' && !$Filtered) {
// $Query .= 't.Seeders>=200 AND ';
if (!empty($Where)) {
$Query .= $Where.' AND ';
}
} elseif (!empty($Where)) {
$Query .= $Where.' AND ';
}
$Query .= "
t.Time > NOW() - INTERVAL 1 YEAR
$GroupBy
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveLastYear = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_year_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastYear, 3600 * 6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveLastYear = false;
}
}
generate_torrent_table('Most Active Torrents Uploaded in the Past Year', 'year', $TopTorrentsActiveLastYear, $Limit);
}
if ($Details === 'all' || $Details === 'overall') {
$TopTorrentsActiveAllTime = $Cache->get_value('top10tor_overall_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsActiveAllTime === false) {
if ($Cache->get_query_lock('top10')) {
// IMPORTANT NOTE - we use WHERE t.Seeders>500 in order to speed up this query. You should remove it!
$Query = $BaseQuery;
if ($Details === 'all' && !$Filtered) {
//$Query .= "t.Seeders>=500 ";
if (!empty($Where)) {
$Query .= ' WHERE '.$Where;
}
} elseif (!empty($Where)) {
$Query .= ' WHERE '.$Where;
}
$Query .= "
$GroupBy
ORDER BY (t.Seeders + t.Leechers) DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsActiveAllTime = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_overall_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveAllTime, 3600 * 6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveAllTime = false;
}
}
generate_torrent_table('Most Active Torrents of All Time', 'overall', $TopTorrentsActiveAllTime, $Limit);
}
if (($Details === 'all' || $Details === 'snatched') && !$Filtered) {
$TopTorrentsSnatched = $Cache->get_value('top10tor_snatched_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsSnatched === false) {
if ($Cache->get_query_lock('top10')) {
$Query = $BaseQuery;
if (!empty($Where)) {
$Query .= ' WHERE '.$Where;
}
$Query .= "
$GroupBy
ORDER BY t.Snatched DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsSnatched = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_snatched_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsSnatched, 3600 * 6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsSnatched = false;
}
}
generate_torrent_table('Most Snatched Torrents', 'snatched', $TopTorrentsSnatched, $Limit);
}
if (($Details === 'all' || $Details === 'data') && !$Filtered) {
$TopTorrentsTransferred = $Cache->get_value('top10tor_data_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsTransferred === false) {
if ($Cache->get_query_lock('top10')) {
// IMPORTANT NOTE - we use WHERE t.Snatched>100 in order to speed up this query. You should remove it!
$Query = $BaseQuery;
if ($Details === 'all') {
//$Query .= " WHERE t.Snatched>=100 ";
if (!empty($Where)) {
$Query .= ' WHERE '.$Where;
}
}
$Query .= "
$GroupBy
ORDER BY Data DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsTransferred = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_data_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsTransferred, 3600 * 6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsTransferred = false;
}
}
generate_torrent_table('Most Data Transferred Torrents', 'data', $TopTorrentsTransferred, $Limit);
}
if (($Details === 'all' || $Details === 'seeded') && !$Filtered) {
$TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum.$GroupBySum);
if ($TopTorrentsSeeded === false) {
if ($Cache->get_query_lock('top10')) {
$Query = $BaseQuery;
if (!empty($Where)) {
$Query .= ' WHERE '.$Where;
}
$Query .= "
$GroupBy
ORDER BY t.Seeders DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsSeeded = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_seeded_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsSeeded, 3600 * 6);
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsSeeded = false;
}
}
generate_torrent_table('Best Seeded Torrents', 'seeded', $TopTorrentsSeeded, $Limit);
}
?>
|
|
Name |
Size |
Data |
↻
|
↑
|
↓
|
Peers |
Server is busy processing another top list request. Please try again in a minute
|
Found no torrents matching the criteria
|
$Name";
// Append extra info to torrent title
$ExtraInfo = '';
$AddExtra = ' | '; # breaking
if (empty($GroupBy)) {
# Year
if ($Year) {
$Label = '
📅 ';
$DisplayName .= $Label."$Year";
}
# Studio
if ($Studio) {
$DisplayName .= " 📍 $Studio";
}
# Authors
if ($Artists) {
# Emoji in classes/astists.class.php
$Label = ' '; # breaking
$DisplayName .= $Label.Artists::display_artists($Artists[$GroupID], true, true);
}
# Catalogue Number
if ($CatalogueNumber) {
$Label = ' 🔑 ';
$DisplayName .= $Label."$CatalogueNumber";
}
/*
if ($Year > 0) {
$ExtraInfo .= $Year;
}
*/
/*
if ($Media) {
$ExtraInfo .= " / $Media";
}
*/
/*
if ($IsSnatched) {
$ExtraInfo .= ' / ';
$ExtraInfo .= Format::torrent_label('Snatched!', 'bold');
}
*/
/*
if ($ExtraInfo !== '') {
$ExtraInfo = "
$ExtraInfo";
}
*/
}
$TorrentTags = new Tags($TagsList);
// Get report info, use the cache if available. If not, add to it
$Reported = false;
$Reports = Torrents::get_reports($TorrentID);
if (count($Reports) > 0) {
$Reported = true;
}
// Print row?>
=$Rank?> |
|
|
=Format::get_size($Size)?>
|
=Format::get_size($Data)?>
|
=number_format((double)$Snatched)?>
|
=number_format((double)$Seeders)?>
|
=number_format((double)$Leechers)?>
|
=number_format($Seeders + $Leechers)?>
|