BioTorrents.de’s version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

torrents.php 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. <?php
  2. $Where = [];
  3. if (!empty($_GET['advanced']) && check_perms('site_advanced_top10')) {
  4. $Details = 'all';
  5. $Limit = 10;
  6. if ($_GET['tags']) {
  7. $TagWhere = [];
  8. $Tags = explode(',', str_replace('.', '_', trim($_GET['tags'])));
  9. foreach ($Tags as $Tag) {
  10. $Tag = preg_replace('/[^a-z0-9_]/', '', $Tag);
  11. if ($Tag != '') {
  12. $TagWhere[] = "g.TagList REGEXP '[[:<:]]".db_string($Tag)."[[:>:]]'";
  13. }
  14. }
  15. if (!empty($TagWhere)) {
  16. if ($_GET['anyall'] == 'any') {
  17. $Where[] = '('.implode(' OR ', $TagWhere).')';
  18. } else {
  19. $Where[] = '('.implode(' AND ', $TagWhere).')';
  20. }
  21. }
  22. }
  23. if ($_GET['category']) {
  24. if (in_array($_GET['category'], $Categories)) {
  25. $Where[] = "g.CategoryID = '".(array_search($_GET['category'], $Categories)+1)."'";
  26. }
  27. }
  28. } else {
  29. // Error out on invalid requests (before caching)
  30. if (isset($_GET['details'])) {
  31. if (in_array($_GET['details'], array('day', 'week', 'overall', 'snatched', 'data', 'seeded', 'month', 'year'))) {
  32. $Details = $_GET['details'];
  33. } else {
  34. error(404);
  35. }
  36. } else {
  37. $Details = 'all';
  38. }
  39. // Defaults to 10 (duh)
  40. $Limit = (isset($_GET['limit']) ? intval($_GET['limit']) : 10);
  41. $Limit = (in_array($Limit, array(10, 100, 250)) ? $Limit : 10);
  42. }
  43. $Filtered = !empty($Where);
  44. View::show_header("Top $Limit Torrents", 'browse');
  45. ?>
  46. <div class="thin">
  47. <div class="header">
  48. <h2>Top <?=$Limit?> Torrents</h2>
  49. <?php Top10View::render_linkbox("torrents"); ?>
  50. </div>
  51. <?php
  52. if (check_perms('site_advanced_top10')) {
  53. ?>
  54. <div class="box pad">
  55. <form class="search_form" name="torrents" action="" method="get">
  56. <input type="hidden" name="advanced" value="1" />
  57. <table cellpadding="6" cellspacing="1" border="0" class="layout" width="100%">
  58. <tr id="tagfilter">
  59. <td class="label">Tags (comma-separated)</td>
  60. <td class="ft_taglist">
  61. <input type="text" name="tags" id="tags" size="75" value="<?php if (!empty($_GET['tags'])) {
  62. echo display_str($_GET['tags']);
  63. } ?>"<?php Users::has_autocomplete_enabled('other'); ?> />&nbsp;
  64. <input type="radio" id="rdoAll" name="anyall" value="all"<?=((!isset($_GET['anyall'])||$_GET['anyall']!='any')?' checked="checked"':'')?> /><label for="rdoAll"> All</label>&nbsp;&nbsp;
  65. <input type="radio" id="rdoAny" name="anyall" value="any"<?=((!isset($_GET['anyall'])||$_GET['anyall']=='any')?' checked="checked"':'')?> /><label for="rdoAny"> Any</label>
  66. </td>
  67. </tr>
  68. <tr>
  69. <td class="label">Category</td>
  70. <td>
  71. <select name="category" style="width: auto;" class="ft_format">
  72. <option value="">Any</option>
  73. <?php foreach ($Categories as $CategoryName) { ?>
  74. <option value="<?=display_str($CategoryName)?>"<?=(($CategoryName==($_GET['category']??false))?'selected="selected"':'')?>><?=display_str($CategoryName)?></option>
  75. <?php } ?>
  76. </select>
  77. </td>
  78. </tr>
  79. <tr>
  80. <td colspan="2" class="center">
  81. <input type="submit" value="Search" />
  82. </td>
  83. </tr>
  84. </table>
  85. </form>
  86. </div>
  87. <?php
  88. }
  89. // Default setting to have them shown
  90. $DisableFreeTorrentTop10 = (isset($LoggedUser['DisableFreeTorrentTop10']) ? $LoggedUser['DisableFreeTorrentTop10'] : 0);
  91. // Did they just toggle it?
  92. if (isset($_GET['freeleech'])) {
  93. // what did they choose?
  94. $NewPref = (($_GET['freeleech'] == 'hide') ? 1 : 0);
  95. // Pref id different
  96. if ($NewPref != $DisableFreeTorrentTop10) {
  97. $DisableFreeTorrentTop10 = $NewPref;
  98. Users::update_site_options($LoggedUser['ID'], array('DisableFreeTorrentTop10' => $DisableFreeTorrentTop10));
  99. }
  100. }
  101. // Modify the Where query
  102. if ($DisableFreeTorrentTop10) {
  103. $Where[] = "t.FreeTorrent='0'";
  104. }
  105. // The link should say the opposite of the current setting
  106. $FreeleechToggleName = ($DisableFreeTorrentTop10 ? 'show' : 'hide');
  107. $FreeleechToggleQuery = Format::get_url(array('freeleech', 'groups'));
  108. if (!empty($FreeleechToggleQuery)) {
  109. $FreeleechToggleQuery .= '&amp;';
  110. }
  111. $FreeleechToggleQuery .= 'freeleech=' . $FreeleechToggleName;
  112. $GroupByToggleName = ((isset($_GET['groups']) && $_GET['groups'] == 'show') ? 'hide' : 'show');
  113. $GroupByToggleQuery = Format::get_url(array('freeleech', 'groups'));
  114. if (!empty($GroupByToggleQuery)) {
  115. $GroupByToggleQuery .= '&amp;';
  116. }
  117. $GroupByToggleQuery .= 'groups=' . $GroupByToggleName;
  118. $GroupBySum = '';
  119. $GroupBy = '';
  120. if (isset($_GET['groups']) && $_GET['groups'] == 'show') {
  121. $GroupBy = ' GROUP BY g.ID ';
  122. $GroupBySum = md5($GroupBy);
  123. }
  124. ?>
  125. <div style="text-align: right;" class="linkbox">
  126. <a href="top10.php?<?=$FreeleechToggleQuery?>" class="brackets"><?=ucfirst($FreeleechToggleName)?> freeleech in Top 10</a>
  127. <?php if (check_perms('users_mod')) { ?>
  128. <a href="top10.php?<?=$GroupByToggleQuery?>" class="brackets"><?=ucfirst($GroupByToggleName)?> top groups</a>
  129. <?php } ?>
  130. </div>
  131. <?php
  132. if (!empty($Where)) {
  133. $Where = '('.implode(' AND ', $Where).')';
  134. $WhereSum = md5($Where);
  135. } else {
  136. $WhereSum = '';
  137. }
  138. $BaseQuery = '
  139. SELECT
  140. t.ID,
  141. g.ID,
  142. g.Name,
  143. g.NameRJ,
  144. g.NameJP,
  145. g.CategoryID,
  146. g.WikiImage,
  147. g.TagList,
  148. t.Media,
  149. g.Year,
  150. t.Snatched,
  151. t.Seeders,
  152. t.Leechers,
  153. ((t.Size * t.Snatched) + (t.Size * 0.5 * t.Leechers)) AS Data,
  154. t.Size
  155. FROM torrents AS t
  156. LEFT JOIN torrents_group AS g ON g.ID = t.GroupID';
  157. if ($Details == 'all' || $Details == 'day') {
  158. $TopTorrentsActiveLastDay = $Cache->get_value('top10tor_day_'.$Limit.$WhereSum.$GroupBySum);
  159. if ($TopTorrentsActiveLastDay === false) {
  160. if ($Cache->get_query_lock('top10')) {
  161. $DayAgo = time_minus(86400);
  162. $Query = $BaseQuery.' WHERE t.Seeders>0 AND ';
  163. if (!empty($Where)) {
  164. $Query .= $Where.' AND ';
  165. }
  166. $Query .= "
  167. t.Time>'$DayAgo'
  168. $GroupBy
  169. ORDER BY (t.Seeders + t.Leechers) DESC
  170. LIMIT $Limit;";
  171. $DB->query($Query);
  172. $TopTorrentsActiveLastDay = $DB->to_array(false, MYSQLI_NUM);
  173. $Cache->cache_value('top10tor_day_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastDay, 3600 * 2);
  174. $Cache->clear_query_lock('top10');
  175. } else {
  176. $TopTorrentsActiveLastDay = false;
  177. }
  178. }
  179. generate_torrent_table('Most Active Torrents Uploaded in the Past Day', 'day', $TopTorrentsActiveLastDay, $Limit);
  180. }
  181. if ($Details == 'all' || $Details == 'week') {
  182. $TopTorrentsActiveLastWeek = $Cache->get_value('top10tor_week_'.$Limit.$WhereSum.$GroupBySum);
  183. if ($TopTorrentsActiveLastWeek === false) {
  184. if ($Cache->get_query_lock('top10')) {
  185. $WeekAgo = time_minus(604800);
  186. $Query = $BaseQuery.' WHERE ';
  187. if (!empty($Where)) {
  188. $Query .= $Where.' AND ';
  189. }
  190. $Query .= "
  191. t.Time>'$WeekAgo'
  192. $GroupBy
  193. ORDER BY (t.Seeders + t.Leechers) DESC
  194. LIMIT $Limit;";
  195. $DB->query($Query);
  196. $TopTorrentsActiveLastWeek = $DB->to_array(false, MYSQLI_NUM);
  197. $Cache->cache_value('top10tor_week_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastWeek, 3600 * 6);
  198. $Cache->clear_query_lock('top10');
  199. } else {
  200. $TopTorrentsActiveLastWeek = false;
  201. }
  202. }
  203. generate_torrent_table('Most Active Torrents Uploaded in the Past Week', 'week', $TopTorrentsActiveLastWeek, $Limit);
  204. }
  205. if ($Details == 'all' || $Details == 'month') {
  206. $TopTorrentsActiveLastMonth = $Cache->get_value('top10tor_month_'.$Limit.$WhereSum.$GroupBySum);
  207. if ($TopTorrentsActiveLastMonth === false) {
  208. if ($Cache->get_query_lock('top10')) {
  209. $Query = $BaseQuery.' WHERE ';
  210. if (!empty($Where)) {
  211. $Query .= $Where.' AND ';
  212. }
  213. $Query .= "
  214. t.Time > NOW() - INTERVAL 1 MONTH
  215. $GroupBy
  216. ORDER BY (t.Seeders + t.Leechers) DESC
  217. LIMIT $Limit;";
  218. $DB->query($Query);
  219. $TopTorrentsActiveLastMonth = $DB->to_array(false, MYSQLI_NUM);
  220. $Cache->cache_value('top10tor_month_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastMonth, 3600 * 6);
  221. $Cache->clear_query_lock('top10');
  222. } else {
  223. $TopTorrentsActiveLastMonth = false;
  224. }
  225. }
  226. generate_torrent_table('Most Active Torrents Uploaded in the Past Month', 'month', $TopTorrentsActiveLastMonth, $Limit);
  227. }
  228. if ($Details == 'all' || $Details == 'year') {
  229. $TopTorrentsActiveLastYear = $Cache->get_value('top10tor_year_'.$Limit.$WhereSum.$GroupBySum);
  230. if ($TopTorrentsActiveLastYear === false) {
  231. if ($Cache->get_query_lock('top10')) {
  232. // IMPORTANT NOTE - we use WHERE t.Seeders>200 in order to speed up this query. You should remove it!
  233. $Query = $BaseQuery.' WHERE ';
  234. if ($Details == 'all' && !$Filtered) {
  235. // $Query .= 't.Seeders>=200 AND ';
  236. if (!empty($Where)) {
  237. $Query .= $Where.' AND ';
  238. }
  239. } elseif (!empty($Where)) {
  240. $Query .= $Where.' AND ';
  241. }
  242. $Query .= "
  243. t.Time > NOW() - INTERVAL 1 YEAR
  244. $GroupBy
  245. ORDER BY (t.Seeders + t.Leechers) DESC
  246. LIMIT $Limit;";
  247. $DB->query($Query);
  248. $TopTorrentsActiveLastYear = $DB->to_array(false, MYSQLI_NUM);
  249. $Cache->cache_value('top10tor_year_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastYear, 3600 * 6);
  250. $Cache->clear_query_lock('top10');
  251. } else {
  252. $TopTorrentsActiveLastYear = false;
  253. }
  254. }
  255. generate_torrent_table('Most Active Torrents Uploaded in the Past Year', 'year', $TopTorrentsActiveLastYear, $Limit);
  256. }
  257. if ($Details == 'all' || $Details == 'overall') {
  258. $TopTorrentsActiveAllTime = $Cache->get_value('top10tor_overall_'.$Limit.$WhereSum.$GroupBySum);
  259. if ($TopTorrentsActiveAllTime === false) {
  260. if ($Cache->get_query_lock('top10')) {
  261. // IMPORTANT NOTE - we use WHERE t.Seeders>500 in order to speed up this query. You should remove it!
  262. $Query = $BaseQuery;
  263. if ($Details=='all' && !$Filtered) {
  264. //$Query .= "t.Seeders>=500 ";
  265. if (!empty($Where)) {
  266. $Query .= ' WHERE '.$Where;
  267. }
  268. } elseif (!empty($Where)) {
  269. $Query .= ' WHERE '.$Where;
  270. }
  271. $Query .= "
  272. $GroupBy
  273. ORDER BY (t.Seeders + t.Leechers) DESC
  274. LIMIT $Limit;";
  275. $DB->query($Query);
  276. $TopTorrentsActiveAllTime = $DB->to_array(false, MYSQLI_NUM);
  277. $Cache->cache_value('top10tor_overall_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveAllTime, 3600 * 6);
  278. $Cache->clear_query_lock('top10');
  279. } else {
  280. $TopTorrentsActiveAllTime = false;
  281. }
  282. }
  283. generate_torrent_table('Most Active Torrents of All Time', 'overall', $TopTorrentsActiveAllTime, $Limit);
  284. }
  285. if (($Details == 'all' || $Details == 'snatched') && !$Filtered) {
  286. $TopTorrentsSnatched = $Cache->get_value('top10tor_snatched_'.$Limit.$WhereSum.$GroupBySum);
  287. if ($TopTorrentsSnatched === false) {
  288. if ($Cache->get_query_lock('top10')) {
  289. $Query = $BaseQuery;
  290. if (!empty($Where)) {
  291. $Query .= ' WHERE '.$Where;
  292. }
  293. $Query .= "
  294. $GroupBy
  295. ORDER BY t.Snatched DESC
  296. LIMIT $Limit;";
  297. $DB->query($Query);
  298. $TopTorrentsSnatched = $DB->to_array(false, MYSQLI_NUM);
  299. $Cache->cache_value('top10tor_snatched_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsSnatched, 3600 * 6);
  300. $Cache->clear_query_lock('top10');
  301. } else {
  302. $TopTorrentsSnatched = false;
  303. }
  304. }
  305. generate_torrent_table('Most Snatched Torrents', 'snatched', $TopTorrentsSnatched, $Limit);
  306. }
  307. if (($Details == 'all' || $Details == 'data') && !$Filtered) {
  308. $TopTorrentsTransferred = $Cache->get_value('top10tor_data_'.$Limit.$WhereSum.$GroupBySum);
  309. if ($TopTorrentsTransferred === false) {
  310. if ($Cache->get_query_lock('top10')) {
  311. // IMPORTANT NOTE - we use WHERE t.Snatched>100 in order to speed up this query. You should remove it!
  312. $Query = $BaseQuery;
  313. if ($Details=='all') {
  314. //$Query .= " WHERE t.Snatched>=100 ";
  315. if (!empty($Where)) {
  316. $Query .= ' WHERE '.$Where;
  317. }
  318. }
  319. $Query .= "
  320. $GroupBy
  321. ORDER BY Data DESC
  322. LIMIT $Limit;";
  323. $DB->query($Query);
  324. $TopTorrentsTransferred = $DB->to_array(false, MYSQLI_NUM);
  325. $Cache->cache_value('top10tor_data_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsTransferred, 3600 * 6);
  326. $Cache->clear_query_lock('top10');
  327. } else {
  328. $TopTorrentsTransferred = false;
  329. }
  330. }
  331. generate_torrent_table('Most Data Transferred Torrents', 'data', $TopTorrentsTransferred, $Limit);
  332. }
  333. if (($Details == 'all' || $Details == 'seeded') && !$Filtered) {
  334. $TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum.$GroupBySum);
  335. if ($TopTorrentsSeeded === false) {
  336. if ($Cache->get_query_lock('top10')) {
  337. $Query = $BaseQuery;
  338. if (!empty($Where)) {
  339. $Query .= ' WHERE '.$Where;
  340. }
  341. $Query .= "
  342. $GroupBy
  343. ORDER BY t.Seeders DESC
  344. LIMIT $Limit;";
  345. $DB->query($Query);
  346. $TopTorrentsSeeded = $DB->to_array(false, MYSQLI_NUM);
  347. $Cache->cache_value('top10tor_seeded_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsSeeded, 3600 * 6);
  348. $Cache->clear_query_lock('top10');
  349. } else {
  350. $TopTorrentsSeeded = false;
  351. }
  352. }
  353. generate_torrent_table('Best Seeded Torrents', 'seeded', $TopTorrentsSeeded, $Limit);
  354. }
  355. ?>
  356. </div>
  357. <?php
  358. View::show_footer();
  359. // Generate a table based on data from most recent query to $DB
  360. function generate_torrent_table($Caption, $Tag, $Details, $Limit)
  361. {
  362. global $LoggedUser, $Categories, $ReleaseTypes, $GroupBy; ?>
  363. <h3>Top <?="$Limit $Caption"?>
  364. <?php if (empty($_GET['advanced'])) { ?>
  365. <small class="top10_quantity_links">
  366. <?php
  367. switch ($Limit) {
  368. case 100: ?>
  369. - <a href="top10.php?details=<?=$Tag?>" class="brackets">Top 10</a>
  370. - <span class="brackets">Top 100</span>
  371. - <a href="top10.php?type=torrents&amp;limit=250&amp;details=<?=$Tag?>" class="brackets">Top 250</a>
  372. <?php break;
  373. case 250: ?>
  374. - <a href="top10.php?details=<?=$Tag?>" class="brackets">Top 10</a>
  375. - <a href="top10.php?type=torrents&amp;limit=100&amp;details=<?=$Tag?>" class="brackets">Top 100</a>
  376. - <span class="brackets">Top 250</span>
  377. <?php break;
  378. default: ?>
  379. - <span class="brackets">Top 10</span>
  380. - <a href="top10.php?type=torrents&amp;limit=100&amp;details=<?=$Tag?>" class="brackets">Top 100</a>
  381. - <a href="top10.php?type=torrents&amp;limit=250&amp;details=<?=$Tag?>" class="brackets">Top 250</a>
  382. <?php } ?>
  383. </small>
  384. <?php } ?>
  385. </h3>
  386. <table class="torrent_table cats numbering border">
  387. <tr class="colhead">
  388. <td class="center" style="width: 15px;"></td>
  389. <td class="cats_col"></td>
  390. <td>Name</td>
  391. <td style="text-align: right;">Size</td>
  392. <td style="text-align: right;">Data</td>
  393. <td style="text-align: right;" class="sign snatches"><svg width="15" height="15" fill="white" class="tooltip" alt="Snatches" title="Snatches" viewBox="3 0 88 98"><path d="M20 20 A43 43,0,1,0,77 23 L90 10 L55 10 L55 45 L68 32 A30.27 30.27,0,1,1,28 29"></path></svg></td>
  394. <td style="text-align: right;" class="sign seeders"><svg width="11" height="15" fill="white" class="tooltip" alt="Seeders" title="Seeders"><polygon points="0,7 5.5,0 11,7 8,7 8,15 3,15 3,7"></polygon></svg></td>
  395. <td style="text-align: right;" class="sign leechers"><svg width="11" height="15" fill="white" class="tooltip" alt="Leechers" title="Leechers"><polygon points="0,8 5.5,15 11,8 8,8 8,0 3,0 3,8"></polygon></svg></td>
  396. <td style="text-align: right;">Peers</td>
  397. </tr>
  398. <?php
  399. // Server is already processing a top10 query. Starting another one will make things slow
  400. if ($Details === false) {
  401. ?>
  402. <tr class="row">
  403. <td colspan="9" class="center">
  404. Server is busy processing another top list request. Please try again in a minute.
  405. </td>
  406. </tr>
  407. </table><br />
  408. <?php
  409. return;
  410. }
  411. // iIn the unlikely event that query finds 0 rows...
  412. if (empty($Details)) {
  413. ?>
  414. <tr class="row">
  415. <td colspan="9" class="center">
  416. Found no torrents matching the criteria.
  417. </td>
  418. </tr>
  419. </table><br />
  420. <?php
  421. return;
  422. }
  423. $Rank = 0;
  424. foreach ($Details as $Detail) {
  425. $GroupIDs[] = $Detail[1];
  426. }
  427. $Artists = Artists::get_artists($GroupIDs);
  428. foreach ($Details as $Detail) {
  429. list($TorrentID, $GroupID, $GroupName, $GroupNameRJ, $GroupNameJP, $GroupCategoryID, $WikiImage, $TagsList,
  430. $Media, $Year, $Snatched, $Seeders, $Leechers, $Data, $Size) = $Detail;
  431. $IsBookmarked = Bookmarks::has_bookmarked('torrent', $GroupID);
  432. $IsSnatched = Torrents::has_snatched($TorrentID);
  433. $Rank++;
  434. // Generate torrent's title
  435. $DisplayName = '';
  436. if (!empty($Artists[$GroupID])) {
  437. $DisplayName = Artists::display_artists($Artists[$GroupID], true, true);
  438. }
  439. $DisplayName .= "<a href=\"torrents.php?id=$GroupID&amp;torrentid=$TorrentID\" ";
  440. if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
  441. $DisplayName .= 'data-cover="'.ImageTools::process($WikiImage, 'thumb').'" ';
  442. }
  443. $Name = empty($GroupName) ? (empty($GroupNameRJ) ? $GroupNameJP : $GroupNameRJ) : $GroupName;
  444. $DisplayName .= "dir=\"ltr\">$Name</a>";
  445. // Append extra info to torrent title
  446. $ExtraInfo = '';
  447. $AddExtra = '';
  448. if (empty($GroupBy)) {
  449. if ($Media) {
  450. $ExtraInfo .= $AddExtra.$Media;
  451. $AddExtra = ' / ';
  452. }
  453. if ($Year > 0) {
  454. $ExtraInfo .= $AddExtra.$Year;
  455. $AddExtra = ' ';
  456. }
  457. if ($IsSnatched) {
  458. if ($GroupCategoryID != 5) {
  459. $ExtraInfo .= ' / ';
  460. }
  461. $ExtraInfo .= Format::torrent_label('Snatched!');
  462. }
  463. if ($ExtraInfo != '') {
  464. $ExtraInfo = "- [$ExtraInfo]";
  465. }
  466. }
  467. $TorrentTags = new Tags($TagsList);
  468. // Get report info, use the cache if available. If not, add to it
  469. $Reported = false;
  470. $Reports = Torrents::get_reports($TorrentID);
  471. if (count($Reports) > 0) {
  472. $Reported = true;
  473. }
  474. // Print row?>
  475. <tr class="torrent row<?=($IsBookmarked ? ' bookmarked' : '') . ($IsSnatched ? ' snatched_torrent' : '')?>">
  476. <td style="padding: 8px; text-align: center;"><strong><?=$Rank?></strong></td>
  477. <td class="center cats_col"><div title="<?=Format::pretty_category($GroupCategoryID)?>" class="tooltip <?=Format::css_category($GroupCategoryID)?>"></div></td>
  478. <td class="big_info">
  479. <div class="group_info clear">
  480. <span><a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download" class="brackets tooltip">DL</a></span>
  481. <?=$DisplayName?> <?=$ExtraInfo?><?php if ($Reported) { ?> - <strong class="torrent_label tl_reported">Reported</strong><?php } ?>
  482. <?php
  483. if ($IsBookmarked) {
  484. ?>
  485. <span class="remove_bookmark float_right">
  486. <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="bookmarklink_torrent_<?=$GroupID?> brackets" onclick="Unbookmark('torrent', <?=$GroupID?>, 'Bookmark'); return false;">Remove bookmark</a>
  487. </span>
  488. <?php
  489. } else { ?>
  490. <span class="add_bookmark float_right">
  491. <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="bookmarklink_torrent_<?=$GroupID?> brackets" onclick="Bookmark('torrent', <?=$GroupID?>, 'Remove bookmark'); return false;">Bookmark</a>
  492. </span>
  493. <?php } ?>
  494. <div class="tags"><?=$TorrentTags->format()?></div>
  495. </div>
  496. </td>
  497. <td class="number_column nobr"><?=Format::get_size($Size)?></td>
  498. <td class="number_column nobr"><?=Format::get_size($Data)?></td>
  499. <td class="number_column"><?=number_format((double)$Snatched)?></td>
  500. <td class="number_column"><?=number_format((double)$Seeders)?></td>
  501. <td class="number_column"><?=number_format((double)$Leechers)?></td>
  502. <td class="number_column"><?=number_format($Seeders + $Leechers)?></td>
  503. </tr>
  504. <?php
  505. } // foreach ($Details as $Detail)
  506. ?>
  507. </table><br />
  508. <?php
  509. }
  510. ?>