Gazelle/sections/top10/torrents.php

506 lines
18 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
2012-10-27 08:00:09 +00:00
include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked()
2011-10-30 08:00:11 +00:00
$Where = array();
2012-12-01 08:00:18 +00:00
if (!empty($_GET['advanced']) && check_perms('site_advanced_top10')) {
2011-03-28 14:21:28 +00:00
$Details = 'all';
$Limit = 10;
2012-12-01 08:00:18 +00:00
if ($_GET['tags']) {
$TagWhere = array();
2011-03-28 14:21:28 +00:00
$Tags = explode(',', str_replace(".","_",trim($_GET['tags'])));
foreach ($Tags as $Tag) {
$Tag = preg_replace('/[^a-z0-9_]/', '', $Tag);
2012-12-01 08:00:18 +00:00
if ($Tag != '') {
$TagWhere[] = "g.TagList REGEXP '[[:<:]]".db_string($Tag)."[[:>:]]'";
}
}
if (!empty($TagWhere)) {
if ($_GET['anyall'] == 'any') {
$Where[] = '('.implode(' OR ', $TagWhere).')';
} else {
$Where[] = '('.implode(' AND ', $TagWhere).')';
2011-03-28 14:21:28 +00:00
}
}
}
2012-12-01 08:00:18 +00:00
if ($_GET['format']) {
if (in_array($_GET['format'], $Formats)) {
$Where[] = "t.Format='".db_string($_GET['format'])."'";
2011-03-28 14:21:28 +00:00
}
}
2012-12-01 08:00:18 +00:00
2011-03-28 14:21:28 +00:00
} else {
// error out on invalid requests (before caching)
if(isset($_GET['details'])) {
2012-03-16 08:00:25 +00:00
if(in_array($_GET['details'], array('day','week','overall','snatched','data','seeded','month','year'))) {
2011-03-28 14:21:28 +00:00
$Details = $_GET['details'];
} else {
error(404);
}
} else {
$Details = 'all';
}
2013-02-12 08:00:08 +00:00
2011-03-28 14:21:28 +00:00
// defaults to 10 (duh)
$Limit = isset($_GET['limit']) ? intval($_GET['limit']) : 10;
$Limit = in_array($Limit, array(10, 100, 250)) ? $Limit : 10;
}
2011-10-30 08:00:11 +00:00
$Filtered = !empty($Where);
2012-10-11 08:00:15 +00:00
View::show_header('Top '.$Limit.' Torrents');
2011-03-28 14:21:28 +00:00
?>
<div class="thin">
2012-08-19 08:00:19 +00:00
<div class="header">
<h2>Top <?=$Limit?> Torrents</h2>
<div class="linkbox">
2013-01-24 08:00:24 +00:00
<a href="top10.php?type=torrents" class="brackets"><strong>Torrents</strong></a>
<a href="top10.php?type=users" class="brackets">Users</a>
<a href="top10.php?type=tags" class="brackets">Tags</a>
<a href="top10.php?type=votes" class="brackets">Favorites</a>
2012-08-19 08:00:19 +00:00
</div>
2011-03-28 14:21:28 +00:00
</div>
<?
if(check_perms('site_advanced_top10')) {
?>
2012-09-15 08:00:25 +00:00
<form class="search_form" name="torrents" action="" method="get">
<input type="hidden" name="advanced" value="1" />
<table cellpadding="6" cellspacing="1" border="0" class="layout border" width="100%">
2012-11-06 08:00:20 +00:00
<tr id="tagfilter">
2012-09-15 08:00:25 +00:00
<td class="label">Tags (comma-separated):</td>
2012-11-06 08:00:20 +00:00
<td class="ft_taglist">
<input type="text" name="tags" size="75" value="<? if(!empty($_GET['tags'])) { echo display_str($_GET['tags']);} ?>" />&nbsp;
2013-01-15 08:00:37 +00:00
<input type="radio" id="rdoAll" name="anyall" value="all"<?=($_GET['anyall']!='any'?' checked="checked"':'')?> /><label for="rdoAll"> All</label>&nbsp;&nbsp;
<input type="radio" id="rdoAny" name="anyall" value="any"<?=($_GET['anyall']=='any'?' checked="checked"':'')?> /><label for="rdoAny"> Any</label>
2012-10-27 08:00:09 +00:00
</td>
2012-10-28 08:00:19 +00:00
</tr>
2012-09-15 08:00:25 +00:00
<tr>
2012-11-06 08:00:20 +00:00
<td class="label">Format:</td>
2012-09-15 08:00:25 +00:00
<td>
2012-11-06 08:00:20 +00:00
<select name="format" style="width:auto;" class="ft_format">
2012-09-15 08:00:25 +00:00
<option value="">Any</option>
2011-03-28 14:21:28 +00:00
<? foreach ($Formats as $FormatName) { ?>
2012-12-27 08:00:27 +00:00
<option value="<?=display_str($FormatName)?>"<? if(isset($_GET['format']) && $FormatName==$_GET['format']) { ?> selected="selected"<? } ?>><?=display_str($FormatName)?></option>
2012-09-15 08:00:25 +00:00
<? } ?> </select>
</td>
</tr>
<tr>
<td colspan="2" class="center">
<input type="submit" value="Filter torrents" />
</td>
</tr>
2013-02-12 08:00:08 +00:00
</table>
2012-09-15 08:00:25 +00:00
</form>
2011-03-28 14:21:28 +00:00
<?
}
2011-10-30 08:00:11 +00:00
// default setting to have them shown
$DisableFreeTorrentTop10 = (isset($LoggedUser['DisableFreeTorrentTop10']) ? $LoggedUser['DisableFreeTorrentTop10'] : 0);
// did they just toggle it?
if(isset($_GET['freeleech'])) {
// what did they choose?
$NewPref = ($_GET['freeleech'] == 'hide') ? 1 : 0;
// Pref id different
if ($NewPref != $DisableFreeTorrentTop10) {
$DisableFreeTorrentTop10 = $NewPref;
2012-10-11 08:00:15 +00:00
Users::update_site_options($LoggedUser['ID'], array('DisableFreeTorrentTop10' => $DisableFreeTorrentTop10));
2011-10-30 08:00:11 +00:00
}
}
// Modify the Where query
if ($DisableFreeTorrentTop10) {
$Where[] = "t.FreeTorrent='0'";
}
// The link should say the opposite of the current setting
$FreeleechToggleName = ($DisableFreeTorrentTop10 ? 'show' : 'hide');
2012-10-11 08:00:15 +00:00
$FreeleechToggleQuery = Format::get_url(array('freeleech'));
2011-10-30 08:00:11 +00:00
if (!empty($FreeleechToggleQuery))
$FreeleechToggleQuery .= '&amp;';
$FreeleechToggleQuery .= 'freeleech=' . $FreeleechToggleName;
?>
2012-12-27 08:00:27 +00:00
<div style="text-align: right;" class="linkbox">
2013-01-24 08:00:24 +00:00
<a href="top10.php?<?=$FreeleechToggleQuery?>" class="brackets"><?=ucfirst($FreeleechToggleName)?> Freeleech in Top 10</a>
2011-10-30 08:00:11 +00:00
</div>
<?
2012-12-01 08:00:18 +00:00
if (!empty($Where)) {
$Where = '('.implode(' AND ', $Where).')';
$WhereSum = md5($Where);
2012-10-27 08:00:09 +00:00
} else {
2012-12-01 08:00:18 +00:00
$WhereSum = '';
2012-10-27 08:00:09 +00:00
}
2011-03-28 14:21:28 +00:00
$BaseQuery = "SELECT
t.ID,
g.ID,
g.Name,
g.CategoryID,
2013-02-25 21:16:55 +00:00
g.wikiImage,
2011-03-28 14:21:28 +00:00
g.TagList,
t.Format,
t.Encoding,
t.Media,
t.Scene,
t.HasLog,
t.HasCue,
t.LogScore,
t.RemasterYear,
g.Year,
t.RemasterTitle,
t.Snatched,
t.Seeders,
t.Leechers,
2012-02-07 08:00:20 +00:00
((t.Size * t.Snatched) + (t.Size * 0.5 * t.Leechers)) AS Data,
g.ReleaseType
2011-03-28 14:21:28 +00:00
FROM torrents AS t
LEFT JOIN torrents_group AS g ON g.ID = t.GroupID ";
2013-02-12 08:00:08 +00:00
2011-03-28 14:21:28 +00:00
if($Details=='all' || $Details=='day') {
2012-10-09 08:00:17 +00:00
$TopTorrentsActiveLastDay = $Cache->get_value('top10tor_day_'.$Limit.$WhereSum);
if ($TopTorrentsActiveLastDay === false) {
2012-10-11 08:00:15 +00:00
if ($Cache->get_query_lock('top10')) {
2012-10-09 08:00:17 +00:00
$DayAgo = time_minus(86400);
$Query = $BaseQuery.' WHERE t.Seeders>0 AND ';
if (!empty($Where)) { $Query .= $Where.' AND '; }
$Query .= "
t.Time>'$DayAgo'
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,$TopTorrentsActiveLastDay,3600*2);
2012-10-11 08:00:15 +00:00
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveLastDay = false;
2012-10-09 08:00:17 +00:00
}
2011-03-28 14:21:28 +00:00
}
generate_torrent_table('Most Active Torrents Uploaded in the Past Day', 'day', $TopTorrentsActiveLastDay, $Limit);
}
if($Details=='all' || $Details=='week') {
2012-10-09 08:00:17 +00:00
$TopTorrentsActiveLastWeek = $Cache->get_value('top10tor_week_'.$Limit.$WhereSum);
if ($TopTorrentsActiveLastWeek === false) {
2012-10-11 08:00:15 +00:00
if ($Cache->get_query_lock('top10')) {
2012-10-09 08:00:17 +00:00
$WeekAgo = time_minus(604800);
$Query = $BaseQuery.' WHERE ';
if (!empty($Where)) { $Query .= $Where.' AND '; }
$Query .= "
t.Time>'$WeekAgo'
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,$TopTorrentsActiveLastWeek,3600*6);
2012-10-11 08:00:15 +00:00
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveLastWeek = false;
2012-10-09 08:00:17 +00:00
}
2011-03-28 14:21:28 +00:00
}
generate_torrent_table('Most Active Torrents Uploaded in the Past Week', 'week', $TopTorrentsActiveLastWeek, $Limit);
}
2012-03-16 08:00:25 +00:00
if($Details=='all' || $Details=='month') {
2012-10-09 08:00:17 +00:00
$TopTorrentsActiveLastMonth = $Cache->get_value('top10tor_month_'.$Limit.$WhereSum);
if ($TopTorrentsActiveLastMonth === false) {
2012-10-11 08:00:15 +00:00
if ($Cache->get_query_lock('top10')) {
2012-10-09 08:00:17 +00:00
$Query = $BaseQuery.' WHERE ';
if (!empty($Where)) { $Query .= $Where.' AND '; }
$Query .= "
t.Time>'".sqltime()."' - INTERVAL 1 MONTH
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,$TopTorrentsActiveLastMonth,3600*6);
2012-10-11 08:00:15 +00:00
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveLastMonth = false;
2012-10-09 08:00:17 +00:00
}
2012-03-16 08:00:25 +00:00
}
generate_torrent_table('Most Active Torrents Uploaded in the Past Month', 'month', $TopTorrentsActiveLastMonth, $Limit);
}
if($Details=='all' || $Details=='year') {
2012-10-09 08:00:17 +00:00
$TopTorrentsActiveLastYear = $Cache->get_value('top10tor_year_'.$Limit.$WhereSum);
if ($TopTorrentsActiveLastYear === false) {
2012-10-11 08:00:15 +00:00
if ($Cache->get_query_lock('top10')) {
2012-10-09 08:00:17 +00:00
// 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>'".sqltime()."' - INTERVAL 1 YEAR
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,$TopTorrentsActiveLastYear,3600*6);
2012-10-11 08:00:15 +00:00
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveLastYear = false;
2012-03-30 08:00:20 +00:00
}
2012-03-16 08:00:25 +00:00
}
generate_torrent_table('Most Active Torrents Uploaded in the Past Year', 'year', $TopTorrentsActiveLastYear, $Limit);
}
2011-03-28 14:21:28 +00:00
if($Details=='all' || $Details=='overall') {
2012-10-09 08:00:17 +00:00
$TopTorrentsActiveAllTime = $Cache->get_value('top10tor_overall_'.$Limit.$WhereSum);
if ($TopTorrentsActiveAllTime === false) {
2012-10-11 08:00:15 +00:00
if ($Cache->get_query_lock('top10')) {
2012-10-09 08:00:17 +00:00
// 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 .= " WHERE t.Seeders>=500 ";
if (!empty($Where)) { $Query .= ' AND '.$Where; }
}
elseif (!empty($Where)) { $Query .= ' WHERE '.$Where; }
$Query .= "
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,$TopTorrentsActiveAllTime,3600*6);
2012-10-11 08:00:15 +00:00
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsActiveAllTime = false;
2011-10-30 08:00:11 +00:00
}
2011-03-28 14:21:28 +00:00
}
generate_torrent_table('Most Active Torrents of All Time', 'overall', $TopTorrentsActiveAllTime, $Limit);
}
2011-10-30 08:00:11 +00:00
if(($Details=='all' || $Details=='snatched') && !$Filtered) {
2012-10-09 08:00:17 +00:00
$TopTorrentsSnatched = $Cache->get_value('top10tor_snatched_'.$Limit.$WhereSum);
if ($TopTorrentsSnatched === false) {
2012-10-11 08:00:15 +00:00
if ($Cache->get_query_lock('top10')) {
2012-10-09 08:00:17 +00:00
$Query = $BaseQuery;
if (!empty($Where)) { $Query .= ' WHERE '.$Where; }
$Query .= "
ORDER BY t.Snatched DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsSnatched = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_snatched_'.$Limit.$WhereSum,$TopTorrentsSnatched,3600*6);
2012-10-11 08:00:15 +00:00
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsSnatched = false;
2012-10-09 08:00:17 +00:00
}
2011-03-28 14:21:28 +00:00
}
generate_torrent_table('Most Snatched Torrents', 'snatched', $TopTorrentsSnatched, $Limit);
}
2011-10-30 08:00:11 +00:00
if(($Details=='all' || $Details=='data') && !$Filtered) {
2012-10-09 08:00:17 +00:00
$TopTorrentsTransferred = $Cache->get_value('top10tor_data_'.$Limit.$WhereSum);
if ($TopTorrentsTransferred === false) {
2012-10-11 08:00:15 +00:00
if ($Cache->get_query_lock('top10')) {
2012-10-09 08:00:17 +00:00
// 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 .= ' AND '.$Where; }
}
$Query .= "
ORDER BY Data DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsTransferred = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_data_'.$Limit.$WhereSum,$TopTorrentsTransferred,3600*6);
2012-10-11 08:00:15 +00:00
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsTransferred = false;
2011-10-30 08:00:11 +00:00
}
2011-03-28 14:21:28 +00:00
}
generate_torrent_table('Most Data Transferred Torrents', 'data', $TopTorrentsTransferred, $Limit);
}
2011-10-30 08:00:11 +00:00
if(($Details=='all' || $Details=='seeded') && !$Filtered) {
2012-02-07 08:00:20 +00:00
$TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum);
2012-10-09 08:00:17 +00:00
if ($TopTorrentsSeeded === false) {
2012-10-11 08:00:15 +00:00
if ($Cache->get_query_lock('top10')) {
2012-10-09 08:00:17 +00:00
$Query = $BaseQuery;
if (!empty($Where)) { $Query .= ' WHERE '.$Where; }
$Query .= "
ORDER BY t.Seeders DESC
LIMIT $Limit;";
$DB->query($Query);
$TopTorrentsSeeded = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value('top10tor_seeded_'.$Limit.$WhereSum,$TopTorrentsSeeded,3600*6);
2012-10-11 08:00:15 +00:00
$Cache->clear_query_lock('top10');
} else {
$TopTorrentsSeeded = false;
2012-10-09 08:00:17 +00:00
}
2011-03-28 14:21:28 +00:00
}
generate_torrent_table('Best Seeded Torrents', 'seeded', $TopTorrentsSeeded, $Limit);
}
?>
</div>
<?
2012-10-11 08:00:15 +00:00
View::show_footer();
2011-03-28 14:21:28 +00:00
// generate a table based on data from most recent query to $DB
function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
2012-10-28 08:00:19 +00:00
global $LoggedUser,$Categories,$ReleaseTypes;
2011-03-28 14:21:28 +00:00
?>
<h3>Top <?=$Limit.' '.$Caption?>
2013-02-12 08:00:08 +00:00
<? if(empty($_GET['advanced'])){ ?>
<small class="top10_quantity_links">
<?
2012-03-16 08:00:25 +00:00
switch($Limit) {
case 100: ?>
2013-02-09 08:01:01 +00:00
- <a href="top10.php?details=<?=$Tag?>" class="brackets">Top 10</a>
- <span class="brackets">Top 100</span>
- <a href="top10.php?type=torrents&amp;limit=250&amp;details=<?=$Tag?>" class="brackets">Top 250</a>
2012-03-16 08:00:25 +00:00
<? break;
case 250: ?>
2013-02-09 08:01:01 +00:00
- <a href="top10.php?details=<?=$Tag?>" class="brackets">Top 10</a>
- <a href="top10.php?type=torrents&amp;limit=100&amp;details=<?=$Tag?>" class="brackets">Top 100</a>
- <span class="brackets">Top 250</span>
2012-03-16 08:00:25 +00:00
<? break;
default: ?>
2013-02-09 08:01:01 +00:00
- <span class="brackets">Top 10</span>
- <a href="top10.php?type=torrents&amp;limit=100&amp;details=<?=$Tag?>" class="brackets">Top 100</a>
- <a href="top10.php?type=torrents&amp;limit=250&amp;details=<?=$Tag?>" class="brackets">Top 250</a>
2012-03-16 08:00:25 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
</small>
2013-02-12 08:00:08 +00:00
<? } ?>
2011-03-28 14:21:28 +00:00
</h3>
2012-09-01 08:00:24 +00:00
<table class="torrent_table cats numbering border">
2011-03-28 14:21:28 +00:00
<tr class="colhead">
<td class="center" style="width:15px;"></td>
2012-10-04 08:00:22 +00:00
<td class="cats_col"></td>
2011-03-28 14:21:28 +00:00
<td><strong>Name</strong></td>
<td style="text-align:right"><strong>Data</strong></td>
<td style="text-align:right"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/snatched.png" alt="Snatches" title="Snatches" /></td>
<td style="text-align:right"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/seeders.png" alt="Seeders" title="Seeders" /></td>
<td style="text-align:right"><img src="static/styles/<?=$LoggedUser['StyleName']?>/images/leechers.png" alt="Leechers" title="Leechers" /></td>
<td style="text-align:right"><strong>Peers</strong></td>
</tr>
<?
2012-10-09 08:00:17 +00:00
// Server is already processing a top10 query. Starting another one will make things slow
if ($Details === false) {
?>
<tr class="rowb">
<td colspan="9" class="center">
2012-10-11 08:00:15 +00:00
Server is busy processing another top list request. Please try again in a minute.
2012-10-09 08:00:17 +00:00
</td>
</tr>
</table><br />
<?
return;
}
2011-03-28 14:21:28 +00:00
// in the unlikely event that query finds 0 rows...
2012-10-09 08:00:17 +00:00
if (empty($Details)) {
2011-03-28 14:21:28 +00:00
?>
<tr class="rowb">
<td colspan="9" class="center">
Found no torrents matching the criteria
</td>
</tr>
</table><br />
<?
return;
}
$Rank = 0;
2011-10-30 08:00:11 +00:00
foreach ($Details as $Detail) {
$GroupIDs[] = $Detail[1];
}
2012-10-11 08:00:15 +00:00
$Artists = Artists::get_artists($GroupIDs);
2011-03-28 14:21:28 +00:00
foreach ($Details as $Detail) {
2013-02-25 21:16:55 +00:00
list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$WikiImage,$TagsList,
2011-03-28 14:21:28 +00:00
$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
2012-02-07 08:00:20 +00:00
$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data,$ReleaseType) = $Detail;
2011-03-28 14:21:28 +00:00
2012-11-04 08:00:20 +00:00
$IsBookmarked = has_bookmarked('torrent', $GroupID);
$IsSnatched = Torrents::has_snatched($TorrentID);
2011-03-28 14:21:28 +00:00
// highlight every other row
$Rank++;
$Highlight = ($Rank % 2 ? 'a' : 'b');
// generate torrent's title
$DisplayName='';
2013-02-12 08:00:08 +00:00
2011-10-30 08:00:11 +00:00
if(!empty($Artists[$GroupID])) {
2012-10-11 08:00:15 +00:00
$DisplayName = Artists::display_artists($Artists[$GroupID], true, true);
2011-03-28 14:21:28 +00:00
}
2013-02-12 08:00:08 +00:00
2013-03-07 08:00:21 +00:00
$DisplayName.= "<a href=\"torrents.php?id=$GroupID&amp;torrentid=$TorrentID\" title=\"View Torrent\" dir=\"ltr\">$GroupName</a>";
2011-03-28 14:21:28 +00:00
if($GroupCategoryID==1 && $GroupYear>0) {
$DisplayName.= " [$GroupYear]";
}
2012-02-07 08:00:20 +00:00
if($GroupCategoryID==1 && $ReleaseType > 0) {
$DisplayName.= ' ['.$ReleaseTypes[$ReleaseType].']';
}
2012-10-28 08:00:19 +00:00
2011-03-28 14:21:28 +00:00
// append extra info to torrent title
$ExtraInfo='';
$AddExtra='';
if($Format) { $ExtraInfo.=$Format; $AddExtra=' / '; }
if($Encoding) { $ExtraInfo.=$AddExtra.$Encoding; $AddExtra=' / '; }
2012-09-01 08:00:24 +00:00
// "FLAC / Lossless / Log (100%) / Cue / CD";
2011-03-28 14:21:28 +00:00
if($HasLog) { $ExtraInfo.=$AddExtra."Log (".$LogScore."%)"; $AddExtra=' / '; }
if($HasCue) { $ExtraInfo.=$AddExtra."Cue"; $AddExtra=' / '; }
if($Media) { $ExtraInfo.=$AddExtra.$Media; $AddExtra=' / '; }
if($Scene) { $ExtraInfo.=$AddExtra.'Scene'; $AddExtra=' / '; }
if($Year>0) { $ExtraInfo.=$AddExtra.$Year; $AddExtra=' '; }
if($RemasterTitle) { $ExtraInfo.=$AddExtra.$RemasterTitle; }
2013-01-03 08:00:30 +00:00
if($IsSnatched) { if($GroupCategoryID == 1) { $ExtraInfo .= ' / '; } $ExtraInfo.= Format::torrent_label('Snatched!'); }
2011-03-28 14:21:28 +00:00
if($ExtraInfo!='') {
$ExtraInfo = "- [$ExtraInfo]";
}
2012-10-28 08:00:19 +00:00
2013-02-25 21:16:55 +00:00
$TorrentTags = new Tags($TagsList);
2011-03-28 14:21:28 +00:00
// print row
?>
2012-11-04 08:00:20 +00:00
<tr class="torrent row<?=$Highlight . ($IsBookmarked ? ' bookmarked' : '') . ($IsSnatched ? ' snatched_torrent' : '')?>">
2011-03-28 14:21:28 +00:00
<td style="padding:8px;text-align:center;"><strong><?=$Rank?></strong></td>
2013-02-25 21:16:55 +00:00
<td class="center cats_col"><div title="<?=$TorrentTags->title()?>" class="<?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div></td>
<td class="big_info">
<? if ($LoggedUser['CoverArt']) : ?>
<div class="group_image float_left clear">
<? ImageTools::cover_thumb($WikiImage, $GroupCategoryID - 1) ?>
</div>
<? endif; ?>
<div class="group_info clear">
<span>[ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a> ]</span>
<strong><?=$DisplayName?></strong> <?=$ExtraInfo?>
<span class="bookmark" style="float:right;">
2012-10-27 08:00:09 +00:00
<?
2012-11-04 08:00:20 +00:00
if($IsBookmarked) {
2012-10-27 08:00:09 +00:00
?>
2013-02-25 21:16:55 +00:00
<a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="remove_bookmark" title="Remove bookmark" onclick="Unbookmark('torrent',<?=$GroupID?>,'Bookmark');return false;">Unbookmark</a>
2013-01-16 08:00:31 +00:00
<? } else { ?>
2013-02-25 21:16:55 +00:00
<a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="add_bookmark" title="Add bookmark" onclick="Bookmark('torrent',<?=$GroupID?>,'Unbookmark');return false;">Bookmark</a>
2013-01-16 08:00:31 +00:00
<? } ?>
2013-02-25 21:16:55 +00:00
</span>
<div class="tags"><?=$TorrentTags->format()?></div>
2013-02-12 08:00:08 +00:00
2013-02-25 21:16:55 +00:00
</div>
2011-03-28 14:21:28 +00:00
</td>
2012-10-11 08:00:15 +00:00
<td style="text-align:right" class="nobr"><?=Format::get_size($Data)?></td>
2011-03-28 14:21:28 +00:00
<td style="text-align:right"><?=number_format((double) $Snatched)?></td>
<td style="text-align:right"><?=number_format((double) $Seeders)?></td>
<td style="text-align:right"><?=number_format((double) $Leechers)?></td>
<td style="text-align:right"><?=number_format($Seeders+$Leechers)?></td>
</tr>
<?
}
?>
</table><br />
<?
}
2012-10-27 08:00:09 +00:00
?>