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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  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.Name,
  153. g.Title2,
  154. g.NameJP,
  155. g.CategoryID,
  156. g.WikiImage,
  157. g.TagList,
  158. t.Media,
  159. g.Year,
  160. g.Studio,
  161. t.Snatched,
  162. t.Seeders,
  163. t.Leechers,
  164. ((t.Size * t.Snatched) + (t.Size * 0.5 * t.Leechers)) AS Data,
  165. t.Size
  166. FROM torrents AS t
  167. LEFT JOIN torrents_group AS g ON g.ID = t.GroupID';
  168. /*
  169. $BaseQuery = '
  170. SELECT
  171. t.ID,
  172. g.ID,
  173. g.Name,
  174. g.Title2,
  175. g.NameJP,
  176. g.CategoryID,
  177. g.WikiImage,
  178. g.TagList,
  179. t.Media,
  180. g.Year,
  181. t.Snatched,
  182. t.Seeders,
  183. t.Leechers,
  184. ((t.Size * t.Snatched) + (t.Size * 0.5 * t.Leechers)) AS Data,
  185. t.Size
  186. FROM torrents AS t
  187. LEFT JOIN torrents_group AS g ON g.ID = t.GroupID';
  188. */
  189. if ($Details === 'all' || $Details === 'day') {
  190. $TopTorrentsActiveLastDay = $Cache->get_value('top10tor_day_'.$Limit.$WhereSum.$GroupBySum);
  191. if ($TopTorrentsActiveLastDay === false) {
  192. if ($Cache->get_query_lock('top10')) {
  193. $DayAgo = time_minus(86400);
  194. $Query = $BaseQuery.' WHERE t.Seeders>0 AND ';
  195. if (!empty($Where)) {
  196. $Query .= $Where.' AND ';
  197. }
  198. $Query .= "
  199. t.Time>'$DayAgo'
  200. $GroupBy
  201. ORDER BY (t.Seeders + t.Leechers) DESC
  202. LIMIT $Limit;";
  203. $DB->query($Query);
  204. $TopTorrentsActiveLastDay = $DB->to_array(false, MYSQLI_NUM);
  205. $Cache->cache_value('top10tor_day_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastDay, 3600 * 2);
  206. $Cache->clear_query_lock('top10');
  207. } else {
  208. $TopTorrentsActiveLastDay = false;
  209. }
  210. }
  211. generate_torrent_table('Most Active Torrents Uploaded in the Past Day', 'day', $TopTorrentsActiveLastDay, $Limit);
  212. }
  213. if ($Details === 'all' || $Details === 'week') {
  214. $TopTorrentsActiveLastWeek = $Cache->get_value('top10tor_week_'.$Limit.$WhereSum.$GroupBySum);
  215. if ($TopTorrentsActiveLastWeek === false) {
  216. if ($Cache->get_query_lock('top10')) {
  217. $WeekAgo = time_minus(604800);
  218. $Query = $BaseQuery.' WHERE ';
  219. if (!empty($Where)) {
  220. $Query .= $Where.' AND ';
  221. }
  222. $Query .= "
  223. t.Time>'$WeekAgo'
  224. $GroupBy
  225. ORDER BY (t.Seeders + t.Leechers) DESC
  226. LIMIT $Limit;";
  227. $DB->query($Query);
  228. $TopTorrentsActiveLastWeek = $DB->to_array(false, MYSQLI_NUM);
  229. $Cache->cache_value('top10tor_week_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastWeek, 3600 * 6);
  230. $Cache->clear_query_lock('top10');
  231. } else {
  232. $TopTorrentsActiveLastWeek = false;
  233. }
  234. }
  235. generate_torrent_table('Most Active Torrents Uploaded in the Past Week', 'week', $TopTorrentsActiveLastWeek, $Limit);
  236. }
  237. if ($Details === 'all' || $Details === 'month') {
  238. $TopTorrentsActiveLastMonth = $Cache->get_value('top10tor_month_'.$Limit.$WhereSum.$GroupBySum);
  239. if ($TopTorrentsActiveLastMonth === false) {
  240. if ($Cache->get_query_lock('top10')) {
  241. $Query = $BaseQuery.' WHERE ';
  242. if (!empty($Where)) {
  243. $Query .= $Where.' AND ';
  244. }
  245. $Query .= "
  246. t.Time > NOW() - INTERVAL 1 MONTH
  247. $GroupBy
  248. ORDER BY (t.Seeders + t.Leechers) DESC
  249. LIMIT $Limit;";
  250. $DB->query($Query);
  251. $TopTorrentsActiveLastMonth = $DB->to_array(false, MYSQLI_NUM);
  252. $Cache->cache_value('top10tor_month_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastMonth, 3600 * 6);
  253. $Cache->clear_query_lock('top10');
  254. } else {
  255. $TopTorrentsActiveLastMonth = false;
  256. }
  257. }
  258. generate_torrent_table('Most Active Torrents Uploaded in the Past Month', 'month', $TopTorrentsActiveLastMonth, $Limit);
  259. }
  260. if ($Details === 'all' || $Details === 'year') {
  261. $TopTorrentsActiveLastYear = $Cache->get_value('top10tor_year_'.$Limit.$WhereSum.$GroupBySum);
  262. if ($TopTorrentsActiveLastYear === false) {
  263. if ($Cache->get_query_lock('top10')) {
  264. // IMPORTANT NOTE - we use WHERE t.Seeders>200 in order to speed up this query. You should remove it!
  265. $Query = $BaseQuery.' WHERE ';
  266. if ($Details === 'all' && !$Filtered) {
  267. // $Query .= 't.Seeders>=200 AND ';
  268. if (!empty($Where)) {
  269. $Query .= $Where.' AND ';
  270. }
  271. } elseif (!empty($Where)) {
  272. $Query .= $Where.' AND ';
  273. }
  274. $Query .= "
  275. t.Time > NOW() - INTERVAL 1 YEAR
  276. $GroupBy
  277. ORDER BY (t.Seeders + t.Leechers) DESC
  278. LIMIT $Limit;";
  279. $DB->query($Query);
  280. $TopTorrentsActiveLastYear = $DB->to_array(false, MYSQLI_NUM);
  281. $Cache->cache_value('top10tor_year_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveLastYear, 3600 * 6);
  282. $Cache->clear_query_lock('top10');
  283. } else {
  284. $TopTorrentsActiveLastYear = false;
  285. }
  286. }
  287. generate_torrent_table('Most Active Torrents Uploaded in the Past Year', 'year', $TopTorrentsActiveLastYear, $Limit);
  288. }
  289. if ($Details === 'all' || $Details === 'overall') {
  290. $TopTorrentsActiveAllTime = $Cache->get_value('top10tor_overall_'.$Limit.$WhereSum.$GroupBySum);
  291. if ($TopTorrentsActiveAllTime === false) {
  292. if ($Cache->get_query_lock('top10')) {
  293. // IMPORTANT NOTE - we use WHERE t.Seeders>500 in order to speed up this query. You should remove it!
  294. $Query = $BaseQuery;
  295. if ($Details === 'all' && !$Filtered) {
  296. //$Query .= "t.Seeders>=500 ";
  297. if (!empty($Where)) {
  298. $Query .= ' WHERE '.$Where;
  299. }
  300. } elseif (!empty($Where)) {
  301. $Query .= ' WHERE '.$Where;
  302. }
  303. $Query .= "
  304. $GroupBy
  305. ORDER BY (t.Seeders + t.Leechers) DESC
  306. LIMIT $Limit;";
  307. $DB->query($Query);
  308. $TopTorrentsActiveAllTime = $DB->to_array(false, MYSQLI_NUM);
  309. $Cache->cache_value('top10tor_overall_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsActiveAllTime, 3600 * 6);
  310. $Cache->clear_query_lock('top10');
  311. } else {
  312. $TopTorrentsActiveAllTime = false;
  313. }
  314. }
  315. generate_torrent_table('Most Active Torrents of All Time', 'overall', $TopTorrentsActiveAllTime, $Limit);
  316. }
  317. if (($Details === 'all' || $Details === 'snatched') && !$Filtered) {
  318. $TopTorrentsSnatched = $Cache->get_value('top10tor_snatched_'.$Limit.$WhereSum.$GroupBySum);
  319. if ($TopTorrentsSnatched === false) {
  320. if ($Cache->get_query_lock('top10')) {
  321. $Query = $BaseQuery;
  322. if (!empty($Where)) {
  323. $Query .= ' WHERE '.$Where;
  324. }
  325. $Query .= "
  326. $GroupBy
  327. ORDER BY t.Snatched DESC
  328. LIMIT $Limit;";
  329. $DB->query($Query);
  330. $TopTorrentsSnatched = $DB->to_array(false, MYSQLI_NUM);
  331. $Cache->cache_value('top10tor_snatched_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsSnatched, 3600 * 6);
  332. $Cache->clear_query_lock('top10');
  333. } else {
  334. $TopTorrentsSnatched = false;
  335. }
  336. }
  337. generate_torrent_table('Most Snatched Torrents', 'snatched', $TopTorrentsSnatched, $Limit);
  338. }
  339. if (($Details === 'all' || $Details === 'data') && !$Filtered) {
  340. $TopTorrentsTransferred = $Cache->get_value('top10tor_data_'.$Limit.$WhereSum.$GroupBySum);
  341. if ($TopTorrentsTransferred === false) {
  342. if ($Cache->get_query_lock('top10')) {
  343. // IMPORTANT NOTE - we use WHERE t.Snatched>100 in order to speed up this query. You should remove it!
  344. $Query = $BaseQuery;
  345. if ($Details === 'all') {
  346. //$Query .= " WHERE t.Snatched>=100 ";
  347. if (!empty($Where)) {
  348. $Query .= ' WHERE '.$Where;
  349. }
  350. }
  351. $Query .= "
  352. $GroupBy
  353. ORDER BY Data DESC
  354. LIMIT $Limit;";
  355. $DB->query($Query);
  356. $TopTorrentsTransferred = $DB->to_array(false, MYSQLI_NUM);
  357. $Cache->cache_value('top10tor_data_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsTransferred, 3600 * 6);
  358. $Cache->clear_query_lock('top10');
  359. } else {
  360. $TopTorrentsTransferred = false;
  361. }
  362. }
  363. generate_torrent_table('Most Data Transferred Torrents', 'data', $TopTorrentsTransferred, $Limit);
  364. }
  365. if (($Details === 'all' || $Details === 'seeded') && !$Filtered) {
  366. $TopTorrentsSeeded = $Cache->get_value('top10tor_seeded_'.$Limit.$WhereSum.$GroupBySum);
  367. if ($TopTorrentsSeeded === false) {
  368. if ($Cache->get_query_lock('top10')) {
  369. $Query = $BaseQuery;
  370. if (!empty($Where)) {
  371. $Query .= ' WHERE '.$Where;
  372. }
  373. $Query .= "
  374. $GroupBy
  375. ORDER BY t.Seeders DESC
  376. LIMIT $Limit;";
  377. $DB->query($Query);
  378. $TopTorrentsSeeded = $DB->to_array(false, MYSQLI_NUM);
  379. $Cache->cache_value('top10tor_seeded_'.$Limit.$WhereSum.$GroupBySum, $TopTorrentsSeeded, 3600 * 6);
  380. $Cache->clear_query_lock('top10');
  381. } else {
  382. $TopTorrentsSeeded = false;
  383. }
  384. }
  385. generate_torrent_table('Best Seeded Torrents', 'seeded', $TopTorrentsSeeded, $Limit);
  386. }
  387. ?>
  388. </div>
  389. <?php
  390. View::show_footer();
  391. // Generate a table based on data from most recent query to $DB
  392. function generate_torrent_table($Caption, $Tag, $Details, $Limit)
  393. {
  394. global $LoggedUser, $Categories, $ReleaseTypes, $GroupBy; ?>
  395. <h3>Top <?="$Limit $Caption"?>
  396. <?php if (empty($_GET['advanced'])) { ?>
  397. <small class="top10_quantity_links">
  398. <?php
  399. switch ($Limit) {
  400. case 100: ?>
  401. &ndash; <a href="top10.php?details=<?=$Tag?>" class="brackets">Top
  402. 10</a>
  403. &ndash; <span class="brackets">Top 100</span>
  404. &ndash; <a href="top10.php?type=torrents&amp;limit=250&amp;details=<?=$Tag?>"
  405. class="brackets">Top 250</a>
  406. <?php break;
  407. case 250: ?>
  408. &ndash; <a href="top10.php?details=<?=$Tag?>" class="brackets">Top
  409. 10</a>
  410. &ndash; <a href="top10.php?type=torrents&amp;limit=100&amp;details=<?=$Tag?>"
  411. class="brackets">Top 100</a>
  412. &ndash; <span class="brackets">Top 250</span>
  413. <?php break;
  414. default: ?>
  415. &ndash; <span class="brackets">Top 10</span>
  416. &ndash; <a href="top10.php?type=torrents&amp;limit=100&amp;details=<?=$Tag?>"
  417. class="brackets">Top 100</a>
  418. &ndash; <a href="top10.php?type=torrents&amp;limit=250&amp;details=<?=$Tag?>"
  419. class="brackets">Top 250</a>
  420. <?php } ?>
  421. </small>
  422. <?php } ?>
  423. </h3>
  424. <table class="torrent_table cats numbering border">
  425. <tr class="colhead">
  426. <td class="center" style="width: 15px;"></td>
  427. <td class="cats_col"></td>
  428. <td>Name</td>
  429. <td style="text-align: right;">Size</td>
  430. <td style="text-align: right;">Data</td>
  431. <td style="text-align: right;" class="sign snatches">
  432. </td>
  433. <td style="text-align: right;" class="sign seeders">
  434. &uarr;
  435. </td>
  436. <td style="text-align: right;" class="sign leechers">
  437. &darr;
  438. </td>
  439. <td style="text-align: right;">Peers</td>
  440. </tr>
  441. <?php
  442. // Server is already processing a top10 query. Starting another one will make things slow
  443. if ($Details === false) {
  444. ?>
  445. <tr class="row">
  446. <td colspan="9" class="center">
  447. Server is busy processing another top list request. Please try again in a minute
  448. </td>
  449. </tr>
  450. </table>
  451. <br />
  452. <?php
  453. return;
  454. }
  455. // In the unlikely event that query finds 0 rows...
  456. if (empty($Details)) { ?>
  457. <tr class="row">
  458. <td colspan="9" class="center">
  459. Found no torrents matching the criteria
  460. </td>
  461. </tr>
  462. </table>
  463. <br />
  464. <?php
  465. return;
  466. }
  467. $Rank = 0;
  468. foreach ($Details as $Detail) {
  469. $GroupIDs[] = $Detail[1];
  470. }
  471. $Artists = Artists::get_artists($GroupIDs);
  472. foreach ($Details as $Detail) {
  473. list($TorrentID, $GroupID, $GroupName, $GroupTitle2, $GroupNameJP, $GroupCategoryID, $WikiImage, $TagsList,
  474. $Media, $Year, $Studio, $Snatched, $Seeders, $Leechers, $Data, $Size) = $Detail;
  475. /*
  476. list($TorrentID, $GroupID, $GroupName, $GroupTitle2, $GroupNameJP, $GroupCategoryID, $WikiImage, $TagsList,
  477. $Media, $Year, $Snatched, $Seeders, $Leechers, $Data, $Size) = $Detail;
  478. */
  479. $IsBookmarked = Bookmarks::has_bookmarked('torrent', $GroupID);
  480. $IsSnatched = Torrents::has_snatched($TorrentID);
  481. $Rank++;
  482. // Generate torrent's title
  483. $DisplayName = '';
  484. $DisplayName .= "<a class='torrent_title' href='torrents.php?id=$GroupID&amp;torrentid=$TorrentID' ";
  485. if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
  486. $DisplayName .= 'data-cover="'.ImageTools::process($WikiImage, 'thumb').'" ';
  487. }
  488. $Name = empty($GroupName) ? (empty($GroupTitle2) ? $GroupNameJP : $GroupTitle2) : $GroupName;
  489. $DisplayName .= "dir='ltr'>$Name</a>";
  490. // Append extra info to torrent title
  491. $ExtraInfo = '';
  492. $AddExtra = '&thinsp;|&thinsp;'; # breaking
  493. if (empty($GroupBy)) {
  494. # Year
  495. if ($Year) {
  496. $Label = '<br />📅&nbsp;';
  497. $DisplayName .= $Label."<a href='torrents.php?action=search&year=$Year'>$Year</a>";
  498. }
  499. # Studio
  500. if ($Studio) {
  501. $DisplayName .= "&nbsp;&nbsp;📍&nbsp;<a href='torrents.php?action=search&location=$Studio'>$Studio</a>";
  502. }
  503. # Authors
  504. if ($Artists) {
  505. # Emoji in classes/astists.class.php
  506. $Label = '&ensp;'; # breaking
  507. $DisplayName .= $Label.Artists::display_artists($Artists[$GroupID], true, true);
  508. }
  509. # Catalogue Number
  510. if ($CatalogueNumber) {
  511. $Label = '&ensp;🔑&nbsp;';
  512. $DisplayName .= $Label."<a href='torrents.php?action=search&numbers=$CatalogueNumber'>$CatalogueNumber</a>";
  513. }
  514. /*
  515. if ($Year > 0) {
  516. $ExtraInfo .= $Year;
  517. }
  518. */
  519. /*
  520. if ($Media) {
  521. $ExtraInfo .= " / $Media";
  522. }
  523. */
  524. /*
  525. if ($IsSnatched) {
  526. $ExtraInfo .= ' / ';
  527. $ExtraInfo .= Format::torrent_label('Snatched!', 'bold');
  528. }
  529. */
  530. /*
  531. if ($ExtraInfo !== '') {
  532. $ExtraInfo = "<br />$ExtraInfo";
  533. }
  534. */
  535. }
  536. $TorrentTags = new Tags($TagsList);
  537. // Get report info, use the cache if available. If not, add to it
  538. $Reported = false;
  539. $Reports = Torrents::get_reports($TorrentID);
  540. if (count($Reports) > 0) {
  541. $Reported = true;
  542. }
  543. // Print row?>
  544. <tr
  545. class="torrent row<?=($IsBookmarked ? ' bookmarked' : '') . ($IsSnatched ? ' snatched_torrent' : '')?>">
  546. <td style="padding: 8px; text-align: center;"><strong><?=$Rank?></strong></td>
  547. <td class="center cats_col">
  548. <div title="<?=Format::pretty_category($GroupCategoryID)?>"
  549. class="tooltip <?=Format::css_category($GroupCategoryID)?>">
  550. </div>
  551. </td>
  552. <td class="big_info">
  553. <div class="group_info clear">
  554. <span><a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>"
  555. title="Download" class="brackets tooltip">DL</a></span>
  556. <?=$DisplayName?> <?=$ExtraInfo?><?php if ($Reported) { ?> - <strong
  557. class="torrent_label tl_reported">Reported</strong><?php } ?>
  558. <?php
  559. if ($IsBookmarked) {
  560. ?>
  561. <span class="remove_bookmark float_right">
  562. <a href="#" id="bookmarklink_torrent_<?=$GroupID?>"
  563. class="bookmarklink_torrent_<?=$GroupID?> brackets"
  564. onclick="Unbookmark('torrent', <?=$GroupID?>, 'Bookmark'); return false;">Remove
  565. bookmark</a>
  566. </span>
  567. <?php
  568. } else { ?>
  569. <span class="add_bookmark float_right">
  570. <a href="#" id="bookmarklink_torrent_<?=$GroupID?>"
  571. class="bookmarklink_torrent_<?=$GroupID?> brackets"
  572. onclick="Bookmark('torrent', <?=$GroupID?>, 'Remove bookmark'); return false;">Bookmark</a>
  573. </span>
  574. <?php } ?>
  575. <div class="tags"><?=$TorrentTags->format()?>
  576. </div>
  577. </div>
  578. </td>
  579. <td class="number_column nobr"><?=Format::get_size($Size)?>
  580. </td>
  581. <td class="number_column nobr"><?=Format::get_size($Data)?>
  582. </td>
  583. <td class="number_column"><?=number_format((double)$Snatched)?>
  584. </td>
  585. <td class="number_column"><?=number_format((double)$Seeders)?>
  586. </td>
  587. <td class="number_column"><?=number_format((double)$Leechers)?>
  588. </td>
  589. <td class="number_column"><?=number_format($Seeders + $Leechers)?>
  590. </td>
  591. </tr>
  592. <?php
  593. } // foreach ($Details as $Detail)
  594. ?>
  595. </table>
  596. <br />
  597. <?php
  598. }