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

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