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 23KB

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