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

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