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

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