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

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