Oppaitime'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.

details.php 35KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818
  1. <?php
  2. function compare($X, $Y) {
  3. return($Y['name'] < $X['name']);
  4. }
  5. define('MAX_PERS_COLLAGES', 3); // How many personal collages should be shown by default
  6. define('MAX_COLLAGES', 5); // How many normal collages should be shown by default
  7. $GroupID = ceil($_GET['id']);
  8. if (!empty($_GET['revisionid']) && is_number($_GET['revisionid'])) {
  9. $RevisionID = $_GET['revisionid'];
  10. } else {
  11. $RevisionID = 0;
  12. }
  13. include(SERVER_ROOT.'/sections/torrents/functions.php');
  14. include(SERVER_ROOT.'/classes/mediainfo.class.php');
  15. $TorrentCache = get_group_info($GroupID, true, $RevisionID);
  16. $TorrentDetails = $TorrentCache[0];
  17. $TorrentList = $TorrentCache[1];
  18. // Group details
  19. list($WikiBody, $WikiImage, $GroupID, $GroupName, $GroupNameRJ, $GroupNameJP, $GroupYear,
  20. $GroupStudio, $GroupSeries, $GroupCatalogueNumber, $GroupPages, $GroupCategoryID,
  21. $GroupDLsiteID, $GroupTime, $TorrentTags, $TorrentTagIDs, $TorrentTagUserIDs,
  22. $Screenshots, $GroupFlags) = array_values($TorrentDetails);
  23. if (!$GroupName) {
  24. if (!$GroupNameRJ) {
  25. $GroupName = $GroupNameJP;
  26. } else {
  27. $GroupName = $GroupNameRJ;
  28. }
  29. }
  30. $DisplayName = "<span dir=\"ltr\">$GroupName</span><br />";
  31. $AltName = $GroupName; // Goes in the alt text of the image
  32. $Title = $GroupName; // goes in <title>
  33. $WikiBody = Text::full_format($WikiBody);
  34. $Artists = Artists::get_artist($GroupID);
  35. if ($GroupNameRJ && $GroupNameRJ != $GroupName) {
  36. $DisplayName .= "<span dir=\"ltr\">$GroupNameRJ</span><br />";
  37. }
  38. if ($GroupNameJP && $GroupNameJP != $GroupName) {
  39. $DisplayName .= "<span dir=\"ltr\">$GroupNameJP</span><br />";
  40. }
  41. if ($Artists) {
  42. $DisplayName = Artists::display_artists($Artists, true) . "$DisplayName";
  43. $AltName = display_str(Artists::display_artists($Artists, false)) . $AltName;
  44. $Title = $AltName;
  45. }
  46. if ($GroupCategoryID) {
  47. $DisplayName = '<div class="'.Format::css_category($GroupCategoryID).' group_cat"></div>' . "$DisplayName";
  48. }
  49. if ($GroupYear > 0) {
  50. $DisplayName .= " [$GroupYear]";
  51. $AltName .= " [$GroupYear]";
  52. $Title .= " [$GroupYear]";
  53. }
  54. if ($GroupStudio) {
  55. $DisplayName .= " [$GroupStudio]";
  56. }
  57. if ($GroupCatalogueNumber) {
  58. $DisplayName .= " [$GroupCatalogueNumber]";
  59. }
  60. if ($GroupPages) {
  61. $DisplayName .= " [{$GroupPages}p]";
  62. }
  63. if ($GroupDLsiteID) {
  64. $DisplayName .= " [$GroupDLsiteID]";
  65. }
  66. $Tags = [];
  67. if ($TorrentTags != '') {
  68. $TorrentTags = explode('|', $TorrentTags);
  69. $TorrentTagIDs = explode('|', $TorrentTagIDs);
  70. $TorrentTagUserIDs = explode('|', $TorrentTagUserIDs);
  71. foreach ($TorrentTags as $TagKey => $TagName) {
  72. $Tags[$TagKey]['name'] = $TagName;
  73. $Tags[$TagKey]['id'] = $TorrentTagIDs[$TagKey];
  74. $Tags[$TagKey]['userid'] = $TorrentTagUserIDs[$TagKey];
  75. $Split = Tags::get_name_and_class($TagName);
  76. $Tags[$TagKey]['display'] = $Split['name'];
  77. $Tags[$TagKey]['class'] = $Split['class'];
  78. }
  79. uasort($Tags, 'compare');
  80. }
  81. $CoverArt = $Cache->get_value("torrents_cover_art_$GroupID");
  82. if (!$CoverArt) {
  83. $DB->query("
  84. SELECT ID, Image, Summary, UserID, Time
  85. FROM cover_art
  86. WHERE GroupID = '$GroupID'
  87. ORDER BY Time ASC");
  88. $CoverArt = [];
  89. $CoverArt = $DB->to_array();
  90. if ($DB->has_results()) {
  91. $Cache->cache_value("torrents_cover_art_$GroupID", $CoverArt, 0);
  92. }
  93. }
  94. // Comments (must be loaded before View::show_header so that subscriptions and quote notifications are handled properly)
  95. list($NumComments, $Page, $Thread, $LastRead) = Comments::load('torrents', $GroupID);
  96. // Start output
  97. View::show_header($Title, 'browse,comments,torrent,bbcode,recommend,cover_art,subscriptions');
  98. ?>
  99. <div class="thin">
  100. <div class="header">
  101. <h2><?=$DisplayName?></h2>
  102. <div class="linkbox">
  103. <? if (check_perms('site_edit_wiki')) { ?>
  104. <a href="torrents.php?action=editgroup&amp;groupid=<?=$GroupID?>" class="brackets">Edit group</a>
  105. <? } ?>
  106. <a href="torrents.php?action=history&amp;groupid=<?=$GroupID?>" class="brackets">View history</a>
  107. <? if ($RevisionID && check_perms('site_edit_wiki')) { ?>
  108. <a href="torrents.php?action=revert&amp;groupid=<?=$GroupID ?>&amp;revisionid=<?=$RevisionID ?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Revert to this revision</a>
  109. <?
  110. }
  111. if (Bookmarks::has_bookmarked('torrent', $GroupID)) {
  112. ?>
  113. <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="remove_bookmark brackets" onclick="Unbookmark('torrent', <?=$GroupID?>, 'Bookmark'); return false;">Remove bookmark</a>
  114. <? } else { ?>
  115. <a href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="add_bookmark brackets" onclick="Bookmark('torrent', <?=$GroupID?>, 'Remove bookmark'); return false;">Bookmark</a>
  116. <? } ?>
  117. <a href="#" id="subscribelink_torrents<?=$GroupID?>" class="brackets" onclick="SubscribeComments('torrents', <?=$GroupID?>); return false;"><?=Subscriptions::has_subscribed_comments('torrents', $GroupID) !== false ? 'Unsubscribe' : 'Subscribe'?></a>
  118. <!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
  119. <?
  120. if ($Categories[$GroupCategoryID-1] == 'Movies' || $Categories[$GroupCategoryID-1] == 'Anime' || $Categories[$GroupCategoryID-1] == 'Manga' || $Categories[$GroupCategoryID-1] == 'Games') { ?>
  121. <a href="upload.php?groupid=<?=$GroupID?>" class="brackets">Add format</a>
  122. <?
  123. }
  124. if (check_perms('site_submit_requests')) { ?>
  125. <a href="requests.php?action=new&amp;groupid=<?=$GroupID?>" class="brackets">Request format</a>
  126. <? } ?>
  127. <a href="torrents.php?action=grouplog&amp;groupid=<?=$GroupID?>" class="brackets">View log</a>
  128. </div>
  129. </div>
  130. <? /* Misc::display_recommend($GroupID, "torrent"); */ ?>
  131. <div class="sidebar">
  132. <div class="box box_image box_image_albumart box_albumart"><!-- .box_albumart deprecated -->
  133. <div class="head">
  134. <strong><?=(count($CoverArt) > 0 ? 'Covers (' . (count($CoverArt) + 1) . ')' : 'Cover')?></strong>
  135. <?
  136. if (count($CoverArt) > 0) {
  137. if (empty($LoggedUser['ShowExtraCovers'])) {
  138. for ($Index = 0; $Index <= count($CoverArt); $Index++) { ?>
  139. <span id="cover_controls_<?=($Index)?>"<?=($Index > 0 ? ' style="display: none;"' : '')?>>
  140. <? if ($Index == count($CoverArt)) { ?>
  141. <a class="brackets prev_cover" data-gazelle-prev-cover="<?=($Index - 1)?>" href="#">Prev</a>
  142. <a class="brackets show_all_covers" href="#">Show all</a>
  143. <span class="brackets next_cover">Next</span>
  144. <? } elseif ($Index > 0) { ?>
  145. <a class="brackets prev_cover" data-gazelle-prev-cover="<?=($Index - 1)?>" href="#">Prev</a>
  146. <a class="brackets show_all_covers" href="#">Show all</a>
  147. <a class="brackets next_cover" data-gazelle-next-cover="<?=($Index + 1)?>" href="#">Next</a>
  148. <? } elseif ($Index == 0 && count($CoverArt) > 0) { ?>
  149. <span class="brackets prev_cover">Prev</span>
  150. <a class="brackets show_all_covers" href="#">Show all</a>
  151. <a class="brackets next_cover" data-gazelle-next-cover="<?=($Index + 1)?>" href="#">Next</a>
  152. <? } ?>
  153. </span>
  154. <?
  155. }
  156. } else { ?>
  157. <span>
  158. <a class="brackets show_all_covers" href="#">Hide</a>
  159. </span>
  160. <?
  161. }
  162. } ?>
  163. </div>
  164. <? $Index = 0; ?>
  165. <div id="covers">
  166. <div id="cover_div_<?=$Index?>">
  167. <? if ($WikiImage != '') { ?>
  168. <div><img width="100%" class="lightbox-init" src="<?=ImageTools::process($WikiImage, true)?>" alt="<?=$AltName?>" /></div>
  169. <? } else { ?>
  170. <div><img width="100%" src="<?=STATIC_SERVER?>common/noartwork/nocover.png" alt="<?=$Categories[$GroupCategoryID - 1]?>" class="brackets tooltip" title="<?=$Categories[$GroupCategoryID - 1]?>" /></div>
  171. <?
  172. }
  173. $Index++;
  174. ?>
  175. </div>
  176. <? foreach ($CoverArt as $Cover) {
  177. list($ImageID, $Image, $Summary, $AddedBy) = $Cover;
  178. ?>
  179. <div id="cover_div_<?=$Index?>"<?=(empty($LoggedUser['ShowExtraCovers']) ? ' style="display: none;"' : '')?>>
  180. <div>
  181. <?
  182. if (empty($LoggedUser['ShowExtraCovers'])) {
  183. $Src = 'src="" data-gazelle-temp-src="' . ImageTools::process($Image, true) . '"';
  184. } else {
  185. $Src = 'src="' . ImageTools::process($Image, true) . '"';
  186. }
  187. ?>
  188. <img id="cover_<?=$Index?>" class="lightbox-init" lightbox-img="<?=ImageTools::process($Image)?>" width="100%" <?=$Src?> alt="<?=$Summary?>" />
  189. </div>
  190. <ul class="stats nobullet">
  191. <li>
  192. <?=$Summary?>
  193. <?=(check_perms('users_mod') ? ' added by ' . Users::format_username($AddedBy, false, false, false, false, false) : '')?>
  194. <span class="remove remove_cover_art"><a href="#" onclick="if (confirm('Do not delete valid alternative cover art. Are you sure you want to delete this cover art?') == true) { ajax.get('torrents.php?action=remove_cover_art&amp;auth=<?=$LoggedUser['AuthKey']?>&amp;id=<?=$ImageID?>&amp;groupid=<?=$GroupID?>'); this.parentNode.parentNode.parentNode.style.display = 'none'; this.parentNode.parentNode.parentNode.previousElementSibling.style.display = 'none'; } else { return false; }" class="brackets tooltip" title="Remove image">X</a></span>
  195. </li>
  196. </ul>
  197. </div>
  198. <?
  199. $Index++;
  200. } ?>
  201. </div>
  202. <?
  203. if (check_perms('site_edit_wiki') && $WikiImage != '') { ?>
  204. <div id="add_cover_div">
  205. <div style="padding: 10px;">
  206. <span class="additional_add_artists float_right">
  207. <a onclick="addCoverField(); return false;" href="#" class="brackets">Add alternate cover</a>
  208. </span>
  209. </div>
  210. <div class="body">
  211. <form class="add_form" name="covers" id="add_covers_form" action="torrents.php" method="post">
  212. <div id="add_cover">
  213. <input type="hidden" name="action" value="add_cover_art" />
  214. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  215. <input type="hidden" name="groupid" value="<?=$GroupID?>" />
  216. </div>
  217. </form>
  218. </div>
  219. </div>
  220. <? } ?>
  221. </div>
  222. <?
  223. if ($Categories[$GroupCategoryID - 1] != 'Other') {
  224. $ShownWith = false;
  225. ?>
  226. <div class="box box_artists">
  227. <div class="head"><strong>Artists</strong>
  228. <?=check_perms('torrents_edit') ? '<span class="edit_artists"><a onclick="ArtistManager(); return false;" href="#" class="brackets float_right">Edit</a></span>' : ''?>
  229. </div>
  230. <ul class="stats nobullet" id="artist_list">
  231. <? foreach ($Artists as $Num => $Artist) { ?>
  232. <li class="artist"><?=Artists::display_artist($Artist)?>
  233. <? if (check_perms('torrents_edit')) { ?>
  234. <span class="remove remove_artist float_right"><a href="javascript:void(0);" onclick="ajax.get('torrents.php?action=delete_alias&amp;auth=' + authkey + '&amp;groupid=<?=$GroupID?>&amp;artistid=<?=$Artist['id']?>&amp;importance=4'); this.parentNode.parentNode.style.display = 'none';" class="brackets tooltip" title="Remove artist">X</a></span>
  235. <? } ?>
  236. </li>
  237. <? } ?>
  238. </ul>
  239. </div>
  240. <? if (check_perms('torrents_add_artist')) { ?>
  241. <div class="box box_addartists">
  242. <div class="head"><strong>Add artist</strong></div>
  243. <div class="body">
  244. <form class="flex_input_container" name="artists" action="torrents.php" method="post">
  245. <input type="hidden" name="action" value="add_alias" />
  246. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  247. <input type="hidden" name="groupid" value="<?=$GroupID?>" />
  248. <input type="text" id="artist" name="artistname[]" <? Users::has_autocomplete_enabled('other'); ?> />
  249. <input type="submit" value="Add" />
  250. </form>
  251. </div>
  252. </div>
  253. <?
  254. }
  255. }
  256. ?>
  257. <div class="box box_tags">
  258. <div class="head">
  259. <strong>Tags</strong>
  260. <?
  261. $DeletedTag = $Cache->get_value("deleted_tags_$GroupID".'_'.$LoggedUser['ID']);
  262. if (!empty($DeletedTag)) { ?>
  263. <form style="display: none;" id="undo_tag_delete_form" name="tags" action="torrents.php" method="post">
  264. <input type="hidden" name="action" value="add_tag" />
  265. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  266. <input type="hidden" name="groupid" value="<?=$GroupID?>" />
  267. <input type="hidden" name="tagname" value="<?=$DeletedTag?>" />
  268. <input type="hidden" name="undo" value="true" />
  269. </form>
  270. <a class="brackets" href="#" onclick="$('#undo_tag_delete_form').raw().submit(); return false;">Undo delete</a>
  271. <? } ?>
  272. </div>
  273. <?
  274. if (count($Tags) > 0) {
  275. ?>
  276. <ul class="stats nobullet">
  277. <?
  278. foreach ($Tags as $TagKey=>$Tag) {
  279. ?>
  280. <li>
  281. <a href="torrents.php?taglist=<?=$Tag['name']?>" class="float_left <?=display_str($Tag['class'])?>" ><?=display_str($Tag['display'])?></a>
  282. <div class="edit_tags_votes float_right">
  283. <? if (check_perms('users_warn')) { ?>
  284. <a href="user.php?id=<?=$Tag['userid']?>" title="View the profile of the user that added this tag" class="brackets tooltip view_tag_user">U</a>
  285. <? } ?>
  286. <? if (empty($LoggedUser['DisableTagging']) && check_perms('site_delete_tag')) { ?>
  287. <span class="remove remove_tag"><a href="torrents.php?action=delete_tag&amp;groupid=<?=$GroupID?>&amp;tagid=<?=$Tag['id']?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets tooltip" title="Remove tag">X</a></span>
  288. <? } ?>
  289. </div>
  290. <br>
  291. </li>
  292. <?
  293. }
  294. ?>
  295. </ul>
  296. <?
  297. } else { // The "no tags to display" message was wrapped in <ul> tags to pad the text.
  298. ?>
  299. <ul><li>There are no tags to display.</li></ul>
  300. <?
  301. }
  302. ?>
  303. </div>
  304. <?
  305. if (empty($LoggedUser['DisableTagging'])) {
  306. ?>
  307. <div class="box box_addtag">
  308. <div class="head"><strong>Add tag</strong></div>
  309. <div class="body">
  310. <form class="flex_input_container" name="tags" action="torrents.php" method="post">
  311. <input type="hidden" name="action" value="add_tag" />
  312. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  313. <input type="hidden" name="groupid" value="<?=$GroupID?>" />
  314. <input type="text" name="tagname" id="tagname" <? Users::has_autocomplete_enabled('other'); ?> />
  315. <input type="submit" value="Add" />
  316. </form>
  317. <br />
  318. <strong><a href="rules.php?p=tag" class="brackets">View tagging rules</a></strong>
  319. </div>
  320. </div>
  321. <?
  322. }
  323. ?>
  324. </div>
  325. <div class="main_column">
  326. <div class="box">
  327. <table class="torrent_table details<?=$GroupFlags['IsSnatched'] ? ' snatched' : ''?>" id="torrent_details">
  328. <tr class="colhead_dark">
  329. <td width="80%"><strong>Torrents</strong></td>
  330. <td><strong>Size</strong></td>
  331. <td class="sign snatches">
  332. <a><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></a>
  333. <td class="sign seeders">
  334. <a><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></a>
  335. </td>
  336. <td class="sign leechers">
  337. <a><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></a>
  338. </td>
  339. </tr>
  340. <?
  341. function filelist($Str) {
  342. return "</td><td>".Format::get_size($Str[1])."</td></tr>";
  343. }
  344. foreach ($TorrentList as $Torrent) {
  345. list($TorrentID, $Media, $Container, $Codec, $Resolution, $AudioFormat, $Subbing,
  346. $Subber, $Language, $Censored, $Archive, $FileCount, $Size, $Seeders, $Leechers,
  347. $Snatched, $FreeTorrent, $FreeLeechType, $TorrentTime, $Description, $MediaInfo, $FileList,
  348. $FilePath, $UserID, $LastActive, $InfoHash, $BadTags, $BadFolders, $BadFiles,
  349. $LastReseedRequest, $LogInDB, $HasFile, $PersonalFL, $IsSnatched, $IsSeeding, $IsLeeching
  350. ) = array_values($Torrent);
  351. $Reported = false;
  352. $Reports = Torrents::get_reports($TorrentID);
  353. $NumReports = count($Reports);
  354. if ($NumReports > 0) {
  355. $Reported = true;
  356. include(SERVER_ROOT.'/sections/reportsv2/array.php');
  357. $ReportInfo = '
  358. <table class="reportinfo_table">
  359. <tr class="colhead_dark" style="font-weight: bold;">
  360. <td>This torrent has '.$NumReports.' active '.($NumReports === 1 ? 'report' : 'reports').":</td>
  361. </tr>";
  362. foreach ($Reports as $Report) {
  363. if (check_perms('admin_reports')) {
  364. $ReporterID = $Report['ReporterID'];
  365. $Reporter = Users::user_info($ReporterID);
  366. $ReporterName = $Reporter['Username'];
  367. $ReportLinks = "<a href=\"user.php?id=$ReporterID\">$ReporterName</a> <a href=\"reportsv2.php?view=report&amp;id=$Report[ID]\">reported it</a>";
  368. } else {
  369. $ReportLinks = 'Someone reported it';
  370. }
  371. if (isset($Types[$GroupCategoryID][$Report['Type']])) {
  372. $ReportType = $Types[$GroupCategoryID][$Report['Type']];
  373. } elseif (isset($Types['master'][$Report['Type']])) {
  374. $ReportType = $Types['master'][$Report['Type']];
  375. } else {
  376. //There was a type but it wasn't an option!
  377. $ReportType = $Types['master']['other'];
  378. }
  379. $ReportInfo .= "
  380. <tr>
  381. <td>$ReportLinks ".time_diff($Report['ReportedTime'], 2, true, true).' for the reason "'.$ReportType['title'].'":
  382. <blockquote>'.Text::full_format($Report['UserComment']).'</blockquote>
  383. </td>
  384. </tr>';
  385. }
  386. $ReportInfo .= "\n\t\t</table>";
  387. }
  388. $CanEdit = (check_perms('torrents_edit') || (($UserID == $LoggedUser['ID'] && !$LoggedUser['DisableWiki']) && !($Remastered && !$RemasterYear)));
  389. $RegenLink = check_perms('users_mod') ? ' <a href="torrents.php?action=regen_filelist&amp;torrentid='.$TorrentID.'" class="brackets">Regenerate</a>' : '';
  390. $FileTable = '
  391. <table class="filelist_table">
  392. <tr class="colhead_dark">
  393. <td>
  394. <div class="filelist_title float_left">File Names' . $RegenLink . '</div>
  395. <div class="filelist_path float_right">' . ($FilePath ? "/$FilePath/" : '') . '</div>
  396. </td>
  397. <td class="nobr">
  398. <strong>Size</strong>
  399. </td>
  400. </tr>';
  401. if (substr($FileList, -3) == '}}}') { // Old style
  402. $FileListSplit = explode('|||', $FileList);
  403. foreach ($FileListSplit as $File) {
  404. $NameEnd = strrpos($File, '{{{');
  405. $Name = substr($File, 0, $NameEnd);
  406. if ($Spaces = strspn($Name, ' ')) {
  407. $Name = str_replace(' ', '&nbsp;', substr($Name, 0, $Spaces)) . substr($Name, $Spaces);
  408. }
  409. $FileSize = substr($File, $NameEnd + 3, -3);
  410. $FileTable .= sprintf("\n<tr class=\"row\"><td>%s</td><td class=\"number_column nobr\">%s</td></tr>", $Name, Format::get_size($FileSize));
  411. }
  412. } else {
  413. $FileListSplit = explode("\n", $FileList);
  414. foreach ($FileListSplit as $File) {
  415. $FileInfo = Torrents::filelist_get_file($File);
  416. $FileTable .= sprintf("\n<tr class=\"row\"><td>%s</td><td class=\"number_column nobr\">%s</td></tr>", $FileInfo['name'], Format::get_size($FileInfo['size']));
  417. }
  418. }
  419. $FileTable .= '
  420. </table>';
  421. $ExtraInfo = ''; // String that contains information on the torrent (e.g. format and encoding)
  422. $AddExtra = ''; // Separator between torrent properties
  423. // similar to Torrents::torrent_info()
  424. if ($Media && $GroupCategoryID != 5) { $ExtraInfo.=display_str($Media); $AddExtra=" / "; }
  425. if ($Container) { $ExtraInfo.=$AddExtra.display_str($Container); $AddExtra=' / '; }
  426. if ($Codec) { $ExtraInfo.=$AddExtra.display_str($Codec); $AddExtra=' / '; }
  427. if ($Resolution) { $ExtraInfo.=$AddExtra.display_str($Resolution); $AddExtra=' / '; }
  428. if ($AudioFormat) { $ExtraInfo.=$AddExtra.display_str($AudioFormat); $AddExtra=' / '; }
  429. if ($Language) {
  430. if ($Subber && ($GroupCategoryID == 3 || $GroupCategoryID == 4)) {
  431. $ExtraInfo.=$AddExtra.display_str($Language.' ('.$Subber.')'); $AddExtra=' / ';
  432. } else {
  433. $ExtraInfo.=$AddExtra.display_str($Language); $AddExtra=' / ';
  434. }
  435. }
  436. if ($Subbing) {
  437. if ($Subber) {
  438. if (($GroupCategoryID == 2 || $GroupCategoryID == 1) && $Subbing != "RAW") {
  439. $ExtraInfo.=$AddExtra.display_str($Subbing)." (".display_str($Subber).")"; $AddExtra=' / ';
  440. }
  441. } else {
  442. $ExtraInfo.=$AddExtra.display_str($Subbing); $AddExtra=' / ';
  443. }
  444. }
  445. if ($Archive) {
  446. $ExtraInfo .= $AddExtra.display_str('Archived ('.$Archive.')'); $AddExtra=' / ';
  447. }
  448. if (!$ExtraInfo) {
  449. $ExtraInfo = $GroupName ; $AddExtra=' / ';
  450. }
  451. if ($IsLeeching) { $ExtraInfo.=$AddExtra. Format::torrent_label('Leeching'); $AddExtra=' / '; }
  452. else if ($IsSeeding) { $ExtraInfo.=$AddExtra . Format::torrent_label('Seeding'); $AddExtra=' / '; }
  453. else if ($IsSnatched) { $ExtraInfo.=$AddExtra. Format::torrent_label('Snatched!'); $AddExtra=' / '; }
  454. if ($FreeTorrent == '1') { $ExtraInfo.=$AddExtra. Format::torrent_label('Freeleech!'); $AddExtra=' / '; }
  455. if ($FreeTorrent == '2') { $ExtraInfo.=$AddExtra. Format::torrent_label('Neutral Leech!'); $AddExtra=' / '; }
  456. // Freleechizer
  457. if ($FreeLeechType == '3') {
  458. $DB->query("
  459. SELECT UNIX_TIMESTAMP(ExpiryTime)
  460. FROM shop_freeleeches
  461. WHERE TorrentID = $TorrentID");
  462. if ($DB->has_results()) {
  463. $ExpiryTime = $DB->next_record(MYSQLI_NUM, false)[0];
  464. $ExtraInfo .= " <strong>(" . str_replace(['week','day','hour','min','Just now','s',' '],['w','d','h','m','0m'],time_diff(max($ExpiryTime, time()), 1, false)) . ")</strong>";
  465. }
  466. }
  467. if ($PersonalFL) { $ExtraInfo.=$AddExtra. Format::torrent_label('Personal Freeleech!'); $AddExtra=' / '; }
  468. if ($Reported) { $ExtraInfo.=$AddExtra. Format::torrent_label('Reported'); $AddExtra=' / '; }
  469. if (!$Censored) { $ExtraInfo .= $AddExtra.Format::torrent_label('Uncensored'); $AddExtra=' / '; }
  470. if (!empty($BadTags)) { $ExtraInfo.=$AddExtra. Format::torrent_label('Bad Tags'); $AddExtra=' / '; }
  471. if (!empty($BadFolders)) { $ExtraInfo.=$AddExtra. Format::torrent_label('Bad Folders'); $AddExtra=' / '; }
  472. if (!empty($BadFiles)) { $ExtraInfo.=$AddExtra. Format::torrent_label('Bad File Names'); $AddExtra=' / '; }
  473. $TorrentDL = "torrents.php?action=download&amp;id=".$TorrentID."&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass'];
  474. if (!empty(G::$LoggedUser) && (G::$LoggedUser['ShowMagnets'] ?? false)) {
  475. if (!($TorrentFileName = $Cache->get_value('torrent_file_name_'.$TorrentID))) {
  476. $TorrentFile = file_get_contents(TORRENT_STORE.$TorrentID.'.torrent');
  477. $Tor = new BencodeTorrent($TorrentFile);
  478. $TorrentFileName = $Tor->Dec['info']['name'];
  479. $Cache->cache_value('torrent_file_name_'.$TorrentID, $TorrentFileName);
  480. }
  481. $TorrentMG = "magnet:?dn=".rawurlencode($TorrentFileName)."&xt=urn:btih:".$InfoHash."&as=https://".SITE_DOMAIN."/".str_replace('&amp;','%26',$TorrentDL)."&tr=".implode("/".$LoggedUser['torrent_pass']."/announce&tr=",ANNOUNCE_URLS[0])."/".$LoggedUser['torrent_pass']."/announce&xl=".$Size;
  482. }
  483. ?>
  484. <tr class="torrent_row groupid_<?=$GroupID?> group_torrent<?=($IsSnatched ? ' snatched_torrent' : '')?>" style="font-weight: normal;" id="torrent<?=$TorrentID?>">
  485. <td>
  486. <span>[ <a href="<?=$TorrentDL?>" class="tooltip" title="Download"><?=($HasFile ? 'DL' : 'Missing')?></a>
  487. <? if (isset($TorrentMG)) { ?>
  488. | <a href="<?=$TorrentMG?>" class="tooltip" title="Magnet Link">MG</a>
  489. <? }
  490. if (Torrents::can_use_token($Torrent)) { ?>
  491. | <a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1" class="tooltip" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
  492. <? } ?>
  493. | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" class="tooltip" title="Report">RP</a>
  494. <? if ($CanEdit) { ?>
  495. | <a href="torrents.php?action=edit&amp;id=<?=$TorrentID ?>" class="tooltip" title="Edit release">ED</a>
  496. <? }
  497. if (check_perms('torrents_delete') || $UserID == $LoggedUser['ID']) { ?>
  498. | <a href="torrents.php?action=delete&amp;torrentid=<?=$TorrentID ?>" class="tooltip" title="Remove">RM</a>
  499. <? }?>
  500. | <a href="torrents.php?torrentid=<?=$TorrentID ?>" class="tooltip" title="Permalink">PL</a>
  501. ]</span>
  502. &raquo; <a data-toggle-target="#torrent_<?=$TorrentID?>"><?=$ExtraInfo; ?></a>
  503. </td>
  504. <td class="number_column nobr"><?=Format::get_size($Size)?></td>
  505. <td class="number_column"><?=number_format($Snatched)?></td>
  506. <td class="number_column"><?=number_format($Seeders)?></td>
  507. <td class="number_column"><?=number_format($Leechers)?></td>
  508. </tr>
  509. <tr class=" groupid_<?=$GroupID?> torrentdetails pad <? if (!isset($_GET['torrentid']) || $_GET['torrentid'] != $TorrentID) { ?>hidden<? } ?>" id="torrent_<?=$TorrentID; ?>">
  510. <td colspan="5">
  511. <div id="release_<?=$TorrentID?>" class="no_overflow">
  512. <blockquote>
  513. Uploaded by <?=Users::format_username($UserID, false, false, false)?> <?=time_diff($TorrentTime);?>
  514. <? if ($Seeders == 0) {
  515. if ($LastActive && time() - strtotime($LastActive) >= 1209600) { ?>
  516. <br /><strong>Last active: <?=time_diff($LastActive); ?></strong>
  517. <? } else { ?>
  518. <br />Last active: <?=time_diff($LastActive); ?>
  519. <? }
  520. }
  521. if (($Seeders == 0 && $LastActive && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) || check_perms('users_mod')) { ?>
  522. <br /><a href="torrents.php?action=reseed&amp;torrentid=<?=$TorrentID?>&amp;groupid=<?=$GroupID?>" class="brackets">Request re-seed</a>
  523. <? }
  524. ?>
  525. </blockquote>
  526. </div>
  527. <? if (check_perms('site_moderate_requests')) { ?>
  528. <div class="linkbox">
  529. <a href="torrents.php?action=masspm&amp;id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>" class="brackets">Mass PM snatchers</a>
  530. </div>
  531. <? } ?>
  532. <div class="linkbox">
  533. <a href="#" class="brackets" onclick="show_peers('<?=$TorrentID?>', 0); return false;">View peer list</a>
  534. <? if (check_perms('site_view_torrent_snatchlist')) { ?>
  535. <a href="#" class="brackets tooltip" onclick="show_downloads('<?=$TorrentID?>', 0); return false;" title="View the list of users that have clicked the &quot;DL&quot; button.">View download list</a>
  536. <a href="#" class="brackets tooltip" onclick="show_snatches('<?=$TorrentID?>', 0); return false;" title="View the list of users that have reported a snatch to the tracker.">View snatch list</a>
  537. <? } ?>
  538. <a href="#" class="brackets" onclick="show_files('<?=$TorrentID?>'); return false;">View file list</a>
  539. <? if ($Reported) { ?>
  540. <a href="#" class="brackets" onclick="show_reported('<?=$TorrentID?>'); return false;">View report information</a>
  541. <? } ?>
  542. </div>
  543. <div id="peers_<?=$TorrentID?>" class="hidden"></div>
  544. <div id="downloads_<?=$TorrentID?>" class="hidden"></div>
  545. <div id="snatches_<?=$TorrentID?>" class="hidden"></div>
  546. <div id="files_<?=$TorrentID?>" class="hidden"><?=$FileTable?></div>
  547. <? if ($Reported) { ?>
  548. <div id="reported_<?=$TorrentID?>" class="hidden"><?=$ReportInfo?></div>
  549. <?
  550. }
  551. if (!empty($Description)) {
  552. echo "\n<blockquote>".Text::full_format($Description).'</blockquote>';
  553. }
  554. if (!empty($MediaInfo)) {
  555. $parsed = MediaInfo::parse($MediaInfo);
  556. echo "\n<blockquote>";
  557. if (!empty($parsed)) {
  558. echo $parsed;
  559. } else {
  560. ?>
  561. <div class="spoilerContainer hideContainer">
  562. <input type="button" class="spoilerButton" value="Show MediaInfo" /><blockquote class="spoiler hidden">
  563. <?
  564. echo Text::full_format($MediaInfo);
  565. ?>
  566. </blockquote>
  567. </div>
  568. <?
  569. }
  570. echo "</blockquote>";
  571. }
  572. ?>
  573. </td>
  574. </tr>
  575. <? } ?>
  576. </table>
  577. </div>
  578. <?
  579. $Requests = get_group_requests($GroupID);
  580. if (empty($LoggedUser['DisableRequests']) && count($Requests) > 0) {
  581. ?>
  582. <div class="box">
  583. <div class="head">
  584. <span style="font-weight: bold;">Requests (<?=number_format(count($Requests))?>)</span>
  585. <a data-toggle-target="#requests" data-toggle-replace="Hide" class="float_right brackets">Show</a>
  586. </div>
  587. <table id="requests" class="request_table hidden">
  588. <tr class="colhead">
  589. <td>Description</td>
  590. <td>Votes</td>
  591. <td>Bounty</td>
  592. </tr>
  593. <? foreach ($Requests as $Request) {
  594. $RequestVotes = Requests::get_votes_array($Request['ID']);
  595. $RequestDesc = substr(explode('\n', Text::strip_bbcode($Request['Description']), 2)[0], 0, 70);
  596. if (strlen(explode('\n', Text::strip_bbcode($Request['Description']), 2)[0]) > 70) {
  597. $RequestDesc = substr($RequestDesc, 0, 67) . '...';
  598. }
  599. ?>
  600. <tr class="requestrows row">
  601. <td><a href="requests.php?action=view&amp;id=<?=$Request['ID']?>"><?=$RequestDesc?></a></td>
  602. <td>
  603. <span id="vote_count_<?=$Request['ID']?>"><?=count($RequestVotes['Voters'])?></span>
  604. <? if (check_perms('site_vote')) { ?>
  605. &nbsp;&nbsp; <a href="javascript:Vote(0, <?=$Request['ID']?>)" class="brackets">+</a>
  606. <? } ?>
  607. </td>
  608. <td><?=Format::get_size($RequestVotes['TotalBounty'])?></td>
  609. </tr>
  610. <? } ?>
  611. </table>
  612. </div>
  613. <?
  614. }
  615. $Collages = $Cache->get_value("torrent_collages_$GroupID");
  616. if (!is_array($Collages)) {
  617. $DB->query("
  618. SELECT c.Name, c.NumTorrents, c.ID
  619. FROM collages AS c
  620. JOIN collages_torrents AS ct ON ct.CollageID = c.ID
  621. WHERE ct.GroupID = '$GroupID'
  622. AND Deleted = '0'
  623. AND CategoryID != '0'");
  624. $Collages = $DB->to_array();
  625. $Cache->cache_value("torrent_collages_$GroupID", $Collages, 3600 * 6);
  626. }
  627. if (count($Collages) > 0) {
  628. if (count($Collages) > MAX_COLLAGES) {
  629. // Pick some at random
  630. $Range = range(0, count($Collages) - 1);
  631. shuffle($Range);
  632. $Indices = array_slice($Range, 0, MAX_COLLAGES);
  633. $SeeAll = ' <a data-toggle-target=".collage_rows">(See all)</a>';
  634. } else {
  635. $Indices = range(0, count($Collages) - 1);
  636. $SeeAll = '';
  637. }
  638. ?>
  639. <table class="box collage_table" id="collages">
  640. <tr class="colhead">
  641. <td width="85%"><a href="#">&uarr;</a>&nbsp;This content is in <?=number_format(count($Collages))?> collection<?=((count($Collages) > 1) ? 's' : '')?><?=$SeeAll?></td>
  642. <td># torrents</td>
  643. </tr>
  644. <? foreach ($Indices as $i) {
  645. list($CollageName, $CollageTorrents, $CollageID) = $Collages[$i];
  646. unset($Collages[$i]);
  647. ?>
  648. <tr>
  649. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  650. <td class="number_column"><?=number_format($CollageTorrents)?></td>
  651. </tr>
  652. <? }
  653. foreach ($Collages as $Collage) {
  654. list($CollageName, $CollageTorrents, $CollageID) = $Collage;
  655. ?>
  656. <tr class="collage_rows hidden">
  657. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  658. <td class="number_column"><?=number_format($CollageTorrents)?></td>
  659. </tr>
  660. <? } ?>
  661. </table>
  662. <?
  663. }
  664. $PersonalCollages = $Cache->get_value("torrent_collages_personal_$GroupID");
  665. if (!is_array($PersonalCollages)) {
  666. $DB->query("
  667. SELECT c.Name, c.NumTorrents, c.ID
  668. FROM collages AS c
  669. JOIN collages_torrents AS ct ON ct.CollageID = c.ID
  670. WHERE ct.GroupID = '$GroupID'
  671. AND Deleted = '0'
  672. AND CategoryID = '0'");
  673. $PersonalCollages = $DB->to_array(false, MYSQLI_NUM);
  674. $Cache->cache_value("torrent_collages_personal_$GroupID", $PersonalCollages, 3600 * 6);
  675. }
  676. if (count($PersonalCollages) > 0) {
  677. if (count($PersonalCollages) > MAX_PERS_COLLAGES) {
  678. // Pick some at random
  679. $Range = range(0,count($PersonalCollages) - 1);
  680. shuffle($Range);
  681. $Indices = array_slice($Range, 0, MAX_PERS_COLLAGES);
  682. $SeeAll = ' <a data-toggle-target=".personal_rows">(See all)</a>';
  683. } else {
  684. $Indices = range(0, count($PersonalCollages) - 1);
  685. $SeeAll = '';
  686. }
  687. ?>
  688. <table class="box collage_table" id="personal_collages">
  689. <tr class="colhead">
  690. <td width="85%"><a href="#">&uarr;</a>&nbsp;This content is in <?=number_format(count($PersonalCollages))?> personal collection<?=((count($PersonalCollages) > 1) ? 's' : '')?><?=$SeeAll?></td>
  691. <td># torrents</td>
  692. </tr>
  693. <? foreach ($Indices as $i) {
  694. list($CollageName, $CollageTorrents, $CollageID) = $PersonalCollages[$i];
  695. unset($PersonalCollages[$i]);
  696. ?>
  697. <tr>
  698. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  699. <td class="number_column"><?=number_format($CollageTorrents)?></td>
  700. </tr>
  701. <? }
  702. foreach ($PersonalCollages as $Collage) {
  703. list($CollageName, $CollageTorrents, $CollageID) = $Collage;
  704. ?>
  705. <tr class="personal_rows hidden">
  706. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  707. <td class="number_column"><?=number_format($CollageTorrents)?></td>
  708. </tr>
  709. <? } ?>
  710. </table>
  711. <?
  712. }
  713. ?>
  714. <div class="box torrent_description">
  715. <div class="head"><a href="#">&uarr;</a>&nbsp;<strong><?=(!empty($ReleaseType) ? $ReleaseTypes[$ReleaseType].' info' : 'Info' )?></strong></div>
  716. <div class="body"><? if ($WikiBody != '') { echo $WikiBody; } else { echo 'There is no information on this torrent.'; } ?></div>
  717. </div>
  718. <div class="box torrent_screenshots_box <? if (!count($Screenshots)) echo 'dead'; ?>">
  719. <div class="head"><a href="#">&uarr;</a>&nbsp;<strong>
  720. <?=($GroupCategoryID == 3)?'Samples':'Screenshots'?> (<?=count($Screenshots)?>)</strong>
  721. <?
  722. if (count($Screenshots) > 0) {
  723. ?>
  724. <a class="float_right brackets" data-toggle-target=".torrent_screenshots" data-toggle-replace="Hide">Show</a>
  725. <? }
  726. $DB->query("
  727. SELECT UserID
  728. FROM torrents
  729. WHERE GroupID = $GroupID");
  730. if (in_array($LoggedUser['ID'], $DB->collect('UserID')) || check_perms('torrents_edit') || check_perms('screenshots_add') || check_perms('screenshots_delete')) {
  731. ?>
  732. <a class="brackets" href="torrents.php?action=editgroup&groupid=<?=$GroupID?>#screenshots_section">Add/Remove</a>
  733. <?
  734. }
  735. ?>
  736. </div>
  737. <div class="body torrent_screenshots hidden">
  738. <?
  739. foreach($Screenshots as $Screenshot) {
  740. $SSURL = ImageTools::process($Screenshot['Image'], false)
  741. ?><img class='tooltip lightbox-init' title='<?=Users::format_username($Screenshot['UserID'], false, false, false)?> - <?=time_diff($Screenshot['Time'])?>' src="<?=$SSURL?>" /><?
  742. }
  743. ?>
  744. </div>
  745. <script>try{$('.torrent_screenshots>img').last().raw().style.width=($('.torrent_screenshots>img').length%2+1)*50+'%'}catch(e){}</script>
  746. </div>
  747. <?
  748. // --- Comments ---
  749. $Pages = Format::get_pages($Page, $NumComments, TORRENT_COMMENTS_PER_PAGE, 9, '#comments');
  750. ?>
  751. <div id="torrent_comments">
  752. <div class="linkbox"><a name="comments"></a>
  753. <?=$Pages?>
  754. </div>
  755. <?
  756. CommentsView::render_comments($Thread, $LastRead, "torrents.php?id=$GroupID");
  757. ?>
  758. <div class="linkbox">
  759. <?=$Pages?>
  760. </div>
  761. <?
  762. View::parse('generic/reply/quickreply.php', array(
  763. 'InputName' => 'pageid',
  764. 'InputID' => $GroupID,
  765. 'Action' => 'comments.php?page=torrents',
  766. 'InputAction' => 'take_post',
  767. 'TextareaCols' => 65,
  768. 'SubscribeBox' => true
  769. ));
  770. ?>
  771. </div>
  772. </div>
  773. </div>
  774. <? View::show_footer(); ?>