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

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