"><?php echo number_format($Torrent['Seeders']); ?> </td> <td class="number_column"><?php echo number_format($Torrent['Leechers']); ?> </td> </tr> <?php } } else { //if (count($Torrents) > 1 || $GroupCategoryID == 1) // Viewing a type that does not require grouping list($TorrentID, $Torrent) = each($Torrents); $Torrent['IsSnatched'] = Torrents::has_snatched($TorrentID); $DisplayName = $Number . ' - <a href="torrents.php?id=' . $GroupID . '" class="tooltip" title="View torrent group" dir="ltr">' . $GroupName . '</a>'; if ($Torrent['IsSnatched']) { $DisplayName .= ' ' . Format::torrent_label('Snatched!'); } if ($Torrent['FreeTorrent'] == '1') { $DisplayName .= ' ' . Format::torrent_label('Freeleech!'); } elseif ($Torrent['FreeTorrent'] == '2') { $DisplayName .= ' ' . Format::torrent_label('Neutral leech!'); } elseif (Torrents::has_token($TorrentID)) { $DisplayName .= ' ' . Format::torrent_label('Personal freeleech!'); } $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : ''; ?> <tr class="torrent torrent_row<?php echo $SnatchedTorrentClass . $SnatchedGroupClass;
function generate_torrent_table($Caption, $Tag, $Details, $Limit) { global $LoggedUser, $Categories, $ReleaseTypes, $GroupBy; ?> <h3>Top <?php echo "{$Limit} {$Caption}"; if (empty($_GET['advanced'])) { ?> <small class="top10_quantity_links"> <?php switch ($Limit) { case 100: ?> - <a href="top10.php?details=<?php echo $Tag; ?> " class="brackets">Top 10</a> - <span class="brackets">Top 100</span> - <a href="top10.php?type=torrents&limit=250&details=<?php echo $Tag; ?> " class="brackets">Top 250</a> <?php break; case 250: ?> - <a href="top10.php?details=<?php echo $Tag; ?> " class="brackets">Top 10</a> - <a href="top10.php?type=torrents&limit=100&details=<?php echo $Tag; ?> " class="brackets">Top 100</a> - <span class="brackets">Top 250</span> <?php break; default: ?> - <span class="brackets">Top 10</span> - <a href="top10.php?type=torrents&limit=100&details=<?php echo $Tag; ?> " class="brackets">Top 100</a> - <a href="top10.php?type=torrents&limit=250&details=<?php echo $Tag; ?> " class="brackets">Top 250</a> <?php } ?> </small> <?php } ?> </h3> <table class="torrent_table cats numbering border"> <tr class="colhead"> <td class="center" style="width: 15px;"></td> <td class="cats_col"></td> <td>Name</td> <td style="text-align: right;">Size</td> <td style="text-align: right;">Data</td> <td style="text-align: right;" class="sign snatches"><img src="static/styles/<?php echo $LoggedUser['StyleName']; ?> /images/snatched.png" alt="Snatches" title="Snatches" class="tooltip" /></td> <td style="text-align: right;" class="sign seeders"><img src="static/styles/<?php echo $LoggedUser['StyleName']; ?> /images/seeders.png" alt="Seeders" title="Seeders" class="tooltip" /></td> <td style="text-align: right;" class="sign leechers"><img src="static/styles/<?php echo $LoggedUser['StyleName']; ?> /images/leechers.png" alt="Leechers" title="Leechers" class="tooltip" /></td> <td style="text-align: right;">Peers</td> </tr> <?php // 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"> Server is busy processing another top list request. Please try again in a minute. </td> </tr> </table><br /> <?php return; } // in the unlikely event that query finds 0 rows... if (empty($Details)) { ?> <tr class="rowb"> <td colspan="9" class="center"> Found no torrents matching the criteria. </td> </tr> </table><br /> <?php return; } $Rank = 0; foreach ($Details as $Detail) { $GroupIDs[] = $Detail[1]; } $Artists = Artists::get_artists($GroupIDs); foreach ($Details as $Detail) { list($TorrentID, $GroupID, $GroupName, $GroupCategoryID, $WikiImage, $TagsList, $Format, $Encoding, $Media, $Scene, $HasLog, $HasCue, $LogScore, $Year, $GroupYear, $RemasterTitle, $Snatched, $Seeders, $Leechers, $Data, $ReleaseType, $Size) = $Detail; $IsBookmarked = Bookmarks::has_bookmarked('torrent', $GroupID); $IsSnatched = Torrents::has_snatched($TorrentID); // highlight every other row $Rank++; $Highlight = $Rank % 2 ? 'a' : 'b'; // generate torrent's title $DisplayName = ''; if (!empty($Artists[$GroupID])) { $DisplayName = Artists::display_artists($Artists[$GroupID], true, true); } $DisplayName .= "<a href=\"torrents.php?id={$GroupID}&torrentid={$TorrentID}\" class=\"tooltip\" title=\"View torrent\" dir=\"ltr\">{$GroupName}</a>"; if ($GroupCategoryID == 1 && $GroupYear > 0) { $DisplayName .= " [{$GroupYear}]"; } if ($GroupCategoryID == 1 && $ReleaseType > 0) { $DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']'; } // append extra info to torrent title $ExtraInfo = ''; $AddExtra = ''; if (empty($GroupBy)) { if ($Format) { $ExtraInfo .= $Format; $AddExtra = ' / '; } if ($Encoding) { $ExtraInfo .= $AddExtra . $Encoding; $AddExtra = ' / '; } // "FLAC / Lossless / Log (100%) / Cue / CD"; 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; } if ($IsSnatched) { if ($GroupCategoryID == 1) { $ExtraInfo .= ' / '; } $ExtraInfo .= Format::torrent_label('Snatched!'); } 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 ?> <tr class="torrent row<?php echo $Highlight . ($IsBookmarked ? ' bookmarked' : '') . ($IsSnatched ? ' snatched_torrent' : ''); ?> "> <td style="padding: 8px; text-align: center;"><strong><?php echo $Rank; ?> </strong></td> <td class="center cats_col"><div title="<?php echo $TorrentTags->title(); ?> " class="tooltip <?php echo Format::css_category($GroupCategoryID); ?> <?php echo $TorrentTags->css_name(); ?> "></div></td> <td class="big_info"> <?php if ($LoggedUser['CoverArt']) { ?> <div class="group_image float_left clear"> <?php ImageTools::cover_thumb($WikiImage, $GroupCategoryID); ?> </div> <?php } ?> <div class="group_info clear"> <span><a href="torrents.php?action=download&id=<?php echo $TorrentID; ?> &authkey=<?php echo $LoggedUser['AuthKey']; ?> &torrent_pass=<?php echo $LoggedUser['torrent_pass']; ?> " title="Download" class="brackets tooltip">DL</a></span> <strong><?php echo $DisplayName; ?> </strong> <?php echo $ExtraInfo; if ($Reported) { ?> - <strong class="torrent_label tl_reported">Reported</strong><?php } if ($IsBookmarked) { ?> <span class="remove_bookmark float_right"> <a href="#" id="bookmarklink_torrent_<?php echo $GroupID; ?> " class="bookmarklink_torrent_<?php echo $GroupID; ?> brackets" onclick="Unbookmark('torrent', <?php echo $GroupID; ?> , 'Bookmark'); return false;">Remove bookmark</a> </span> <?php } else { ?> <span class="add_bookmark float_right"> <a href="#" id="bookmarklink_torrent_<?php echo $GroupID; ?> " class="bookmarklink_torrent_<?php echo $GroupID; ?> brackets" onclick="Bookmark('torrent', <?php echo $GroupID; ?> , 'Remove bookmark'); return false;">Bookmark</a> </span> <?php } ?> <div class="tags"><?php echo $TorrentTags->format(); ?> </div> </div> </td> <td class="number_column nobr"><?php echo Format::get_size($Size); ?> </td> <td class="number_column nobr"><?php echo Format::get_size($Data); ?> </td> <td class="number_column"><?php echo number_format((double) $Snatched); ?> </td> <td class="number_column"><?php echo number_format((double) $Seeders); ?> </td> <td class="number_column"><?php echo number_format((double) $Leechers); ?> </td> <td class="number_column"><?php echo number_format($Seeders + $Leechers); ?> </td> </tr> <?php } //foreach ($Details as $Detail) ?> </table><br /> <?php }