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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  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 = array();
  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 = array();
  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 description</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. include(SERVER_ROOT.'/sections/torrents/vote_ranks.php');
  276. include(SERVER_ROOT.'/sections/torrents/vote.php');
  277. ?>
  278. <div class="box box_tags">
  279. <div class="head">
  280. <strong>Tags</strong>
  281. <?
  282. $DeletedTag = $Cache->get_value("deleted_tags_$GroupID".'_'.$LoggedUser['ID']);
  283. if (!empty($DeletedTag)) { ?>
  284. <form style="display: none;" id="undo_tag_delete_form" name="tags" action="torrents.php" method="post">
  285. <input type="hidden" name="action" value="add_tag" />
  286. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  287. <input type="hidden" name="groupid" value="<?=$GroupID?>" />
  288. <input type="hidden" name="tagname" value="<?=$DeletedTag?>" />
  289. <input type="hidden" name="undo" value="true" />
  290. </form>
  291. <a class="brackets" href="#" onclick="$('#undo_tag_delete_form').raw().submit(); return false;">Undo delete</a>
  292. <? } ?>
  293. </div>
  294. <?
  295. if (count($Tags) > 0) {
  296. ?>
  297. <ul class="stats nobullet">
  298. <?
  299. foreach ($Tags as $TagKey=>$Tag) {
  300. ?>
  301. <li>
  302. <a href="torrents.php?taglist=<?=$Tag['name']?>" style="float: left; display: block;" class="<?=display_str($Tag['class'])?>" ><?=display_str($Tag['display'])?></a>
  303. <div style="float: right; display: block; letter-spacing: -1px;" class="edit_tags_votes">
  304. <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>
  305. <?=$Tag['score']?>
  306. <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>
  307. <? if (check_perms('users_warn')) { ?>
  308. <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>
  309. <? } ?>
  310. <? if (empty($LoggedUser['DisableTagging']) && check_perms('site_delete_tag')) { ?>
  311. <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>
  312. <? } ?>
  313. </div>
  314. <br style="clear: both;" />
  315. </li>
  316. <?
  317. }
  318. ?>
  319. </ul>
  320. <?
  321. } else { // The "no tags to display" message was wrapped in <ul> tags to pad the text.
  322. ?>
  323. <ul><li>There are no tags to display.</li></ul>
  324. <?
  325. }
  326. ?>
  327. </div>
  328. <?
  329. if (empty($LoggedUser['DisableTagging'])) {
  330. ?>
  331. <div class="box box_addtag">
  332. <div class="head"><strong>Add tag</strong></div>
  333. <div class="body">
  334. <form class="flex_input_container" name="tags" action="torrents.php" method="post">
  335. <input type="hidden" name="action" value="add_tag" />
  336. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  337. <input type="hidden" name="groupid" value="<?=$GroupID?>" />
  338. <input type="text" name="tagname" id="tagname" <? Users::has_autocomplete_enabled('other'); ?> />
  339. <input type="submit" value="Add" />
  340. </form>
  341. <br />
  342. <strong><a href="rules.php?p=tag" class="brackets">View tagging rules</a></strong>
  343. </div>
  344. </div>
  345. <?
  346. }
  347. ?>
  348. </div>
  349. <div class="main_column">
  350. <div class="box">
  351. <table class="torrent_table details<?=$GroupFlags['IsSnatched'] ? ' snatched' : ''?>" id="torrent_details">
  352. <tr class="colhead_dark">
  353. <td width="80%"><strong>Torrents</strong></td>
  354. <td><strong>Size</strong></td>
  355. <td class="sign snatches"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/snatched.png" class="tooltip" alt="Snatches" title="Snatches" /></td>
  356. <td class="sign seeders">
  357. <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>
  358. </td>
  359. <td class="sign leechers">
  360. <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>
  361. </td>
  362. </tr>
  363. <?
  364. function filelist($Str) {
  365. return "</td><td>".Format::get_size($Str[1])."</td></tr>";
  366. }
  367. foreach ($TorrentList as $Torrent) {
  368. list($TorrentID, $Media, $Container, $Codec, $Resolution, $AudioFormat, $Subbing,
  369. $Subber, $Language, $Censored, $Archive, $FileCount, $Size, $Seeders, $Leechers,
  370. $Snatched, $FreeTorrent, $FreeLeechType, $TorrentTime, $Description, $MediaInfo, $FileList,
  371. $FilePath, $UserID, $LastActive, $InfoHash, $BadTags, $BadFolders, $BadFiles,
  372. $LastReseedRequest, $LogInDB, $HasFile, $PersonalFL, $IsSnatched, $IsSeeding, $IsLeeching
  373. ) = array_values($Torrent);
  374. $Reported = false;
  375. $Reports = Torrents::get_reports($TorrentID);
  376. $NumReports = count($Reports);
  377. if ($NumReports > 0) {
  378. $Reported = true;
  379. include(SERVER_ROOT.'/sections/reportsv2/array.php');
  380. $ReportInfo = '
  381. <table class="reportinfo_table">
  382. <tr class="colhead_dark" style="font-weight: bold;">
  383. <td>This torrent has '.$NumReports.' active '.($NumReports === 1 ? 'report' : 'reports').":</td>
  384. </tr>";
  385. foreach ($Reports as $Report) {
  386. if (check_perms('admin_reports')) {
  387. $ReporterID = $Report['ReporterID'];
  388. $Reporter = Users::user_info($ReporterID);
  389. $ReporterName = $Reporter['Username'];
  390. $ReportLinks = "<a href=\"user.php?id=$ReporterID\">$ReporterName</a> <a href=\"reportsv2.php?view=report&amp;id=$Report[ID]\">reported it</a>";
  391. } else {
  392. $ReportLinks = 'Someone reported it';
  393. }
  394. if (isset($Types[$GroupCategoryID][$Report['Type']])) {
  395. $ReportType = $Types[$GroupCategoryID][$Report['Type']];
  396. } elseif (isset($Types['master'][$Report['Type']])) {
  397. $ReportType = $Types['master'][$Report['Type']];
  398. } else {
  399. //There was a type but it wasn't an option!
  400. $ReportType = $Types['master']['other'];
  401. }
  402. $ReportInfo .= "
  403. <tr>
  404. <td>$ReportLinks ".time_diff($Report['ReportedTime'], 2, true, true).' for the reason "'.$ReportType['title'].'":
  405. <blockquote>'.Text::full_format($Report['UserComment']).'</blockquote>
  406. </td>
  407. </tr>';
  408. }
  409. $ReportInfo .= "\n\t\t</table>";
  410. }
  411. $CanEdit = (check_perms('torrents_edit') || (($UserID == $LoggedUser['ID'] && !$LoggedUser['DisableWiki']) && !($Remastered && !$RemasterYear)));
  412. $RegenLink = check_perms('users_mod') ? ' <a href="torrents.php?action=regen_filelist&amp;torrentid='.$TorrentID.'" class="brackets">Regenerate</a>' : '';
  413. $FileTable = '
  414. <table class="filelist_table">
  415. <tr class="colhead_dark">
  416. <td>
  417. <div class="filelist_title" style="float: left;">File Names' . $RegenLink . '</div>
  418. <div class="filelist_path" style="float: right;">' . ($FilePath ? "/$FilePath/" : '') . '</div>
  419. </td>
  420. <td class="nobr">
  421. <strong>Size</strong>
  422. </td>
  423. </tr>';
  424. if (substr($FileList, -3) == '}}}') { // Old style
  425. $FileListSplit = explode('|||', $FileList);
  426. foreach ($FileListSplit as $File) {
  427. $NameEnd = strrpos($File, '{{{');
  428. $Name = substr($File, 0, $NameEnd);
  429. if ($Spaces = strspn($Name, ' ')) {
  430. $Name = str_replace(' ', '&nbsp;', substr($Name, 0, $Spaces)) . substr($Name, $Spaces);
  431. }
  432. $FileSize = substr($File, $NameEnd + 3, -3);
  433. $FileTable .= sprintf("\n<tr class=\"row\"><td>%s</td><td class=\"number_column nobr\">%s</td></tr>", $Name, Format::get_size($FileSize));
  434. }
  435. } else {
  436. $FileListSplit = explode("\n", $FileList);
  437. foreach ($FileListSplit as $File) {
  438. $FileInfo = Torrents::filelist_get_file($File);
  439. $FileTable .= sprintf("\n<tr class=\"row\"><td>%s</td><td class=\"number_column nobr\">%s</td></tr>", $FileInfo['name'], Format::get_size($FileInfo['size']));
  440. }
  441. }
  442. $FileTable .= '
  443. </table>';
  444. $ExtraInfo = ''; // String that contains information on the torrent (e.g. format and encoding)
  445. $AddExtra = ''; // Separator between torrent properties
  446. // similar to Torrents::torrent_info()
  447. if ($Media && $GroupCategoryID != 5) { $ExtraInfo.=display_str($Media); $AddExtra=" / "; }
  448. if ($Container) { $ExtraInfo.=$AddExtra.display_str($Container); $AddExtra=' / '; }
  449. if ($Codec) { $ExtraInfo.=$AddExtra.display_str($Codec); $AddExtra=' / '; }
  450. if ($Resolution) { $ExtraInfo.=$AddExtra.display_str($Resolution); $AddExtra=' / '; }
  451. if ($AudioFormat) { $ExtraInfo.=$AddExtra.display_str($AudioFormat); $AddExtra=' / '; }
  452. if ($Language) {
  453. if ($Subber && ($GroupCategoryID == 3 || $GroupCategoryID == 4)) {
  454. $ExtraInfo.=$AddExtra.display_str($Language.' ('.$Subber.')'); $AddExtra=' / ';
  455. } else {
  456. $ExtraInfo.=$AddExtra.display_str($Language); $AddExtra=' / ';
  457. }
  458. }
  459. if ($Subbing) {
  460. if ($Subber) {
  461. if (($GroupCategoryID == 2 || $GroupCategoryID == 1) && $Subbing != "RAW") {
  462. $ExtraInfo.=$AddExtra.display_str($Subbing)." (".display_str($Subber).")"; $AddExtra=' / ';
  463. }
  464. } else {
  465. $ExtraInfo.=$AddExtra.display_str($Subbing); $AddExtra=' / ';
  466. }
  467. }
  468. if ($Archive) {
  469. $ExtraInfo .= $AddExtra.display_str('Archived ('.$Archive.')'); $AddExtra=' / ';
  470. }
  471. if (!$ExtraInfo) {
  472. $ExtraInfo = $GroupName ; $AddExtra=' / ';
  473. }
  474. if ($IsLeeching) { $ExtraInfo.=$AddExtra. Format::torrent_label('Leeching'); $AddExtra=' / '; }
  475. else if ($IsSeeding) { $ExtraInfo.=$AddExtra . Format::torrent_label('Seeding'); $AddExtra=' / '; }
  476. else if ($IsSnatched) { $ExtraInfo.=$AddExtra. Format::torrent_label('Snatched!'); $AddExtra=' / '; }
  477. if ($FreeTorrent == '1') { $ExtraInfo.=$AddExtra. Format::torrent_label('Freeleech!'); $AddExtra=' / '; }
  478. if ($FreeTorrent == '2') { $ExtraInfo.=$AddExtra. Format::torrent_label('Neutral Leech!'); $AddExtra=' / '; }
  479. // Freleechizer
  480. if ($FreeLeechType == '3') {
  481. $DB->query("
  482. SELECT GREATEST(NOW(), ExpiryTime)
  483. FROM shop_freeleeches
  484. WHERE TorrentID = $TorrentID");
  485. if ($DB->has_results()) {
  486. $ExpiryTime = $DB->next_record(MYSQLI_NUM, false)[0];
  487. $ExtraInfo .= " <strong>(" . str_replace(['week','day','hour','min','Just now','s',' '],['w','d','h','m','0m'],time_diff($ExpiryTime, 1, false)) . ")</strong>";
  488. }
  489. }
  490. if ($PersonalFL) { $ExtraInfo.=$AddExtra. Format::torrent_label('Personal Freeleech!'); $AddExtra=' / '; }
  491. if ($Reported) { $ExtraInfo.=$AddExtra. Format::torrent_label('Reported'); $AddExtra=' / '; }
  492. if (!$Censored) { $ExtraInfo .= $AddExtra.Format::torrent_label('Uncensored'); $AddExtra=' / '; }
  493. if (!empty($BadTags)) { $ExtraInfo.=$AddExtra. Format::torrent_label('Bad Tags'); $AddExtra=' / '; }
  494. if (!empty($BadFolders)) { $ExtraInfo.=$AddExtra. Format::torrent_label('Bad Folders'); $AddExtra=' / '; }
  495. if (!empty($BadFiles)) { $ExtraInfo.=$AddExtra. Format::torrent_label('Bad File Names'); $AddExtra=' / '; }
  496. $TorrentDL = "torrents.php?action=download&amp;id=".$TorrentID."&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass'];
  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. <tr class="torrent_row groupid_<?=$GroupID?> group_torrent<?=($IsSnatched ? ' snatched_torrent' : '')?>" style="font-weight: normal;" id="torrent<?=$TorrentID?>">
  506. <td>
  507. <span>[ <a href="<?=$TorrentDL?>" class="tooltip" title="Download"><?=($HasFile ? 'DL' : 'Missing')?></a>
  508. | <a href="<?=$TorrentMG?>" class="tooltip" title="Magnet Link">MG</a>
  509. <? if (Torrents::can_use_token($Torrent)) { ?>
  510. | <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>
  511. <? } ?>
  512. | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" class="tooltip" title="Report">RP</a>
  513. <? if ($CanEdit) { ?>
  514. | <a href="torrents.php?action=edit&amp;id=<?=$TorrentID ?>" class="tooltip" title="Edit">ED</a>
  515. <? }
  516. if (check_perms('torrents_delete') || $UserID == $LoggedUser['ID']) { ?>
  517. | <a href="torrents.php?action=delete&amp;torrentid=<?=$TorrentID ?>" class="tooltip" title="Remove">RM</a>
  518. <? }?>
  519. | <a href="torrents.php?torrentid=<?=$TorrentID ?>" class="tooltip" title="Permalink">PL</a>
  520. ]</span>
  521. &raquo; <a toggle-target="#torrent_<?=$TorrentID?>"><?=$ExtraInfo; ?></a>
  522. </td>
  523. <td class="number_column nobr"><?=Format::get_size($Size)?></td>
  524. <td class="number_column"><?=number_format($Snatched)?></td>
  525. <td class="number_column"><?=number_format($Seeders)?></td>
  526. <td class="number_column"><?=number_format($Leechers)?></td>
  527. </tr>
  528. <tr class=" groupid_<?=$GroupID?> torrentdetails pad <? if (!isset($_GET['torrentid']) || $_GET['torrentid'] != $TorrentID) { ?>hidden<? } ?>" id="torrent_<?=$TorrentID; ?>">
  529. <td colspan="5">
  530. <div id="release_<?=$TorrentID?>" class="no_overflow">
  531. <blockquote>
  532. Uploaded by <?=Users::format_username($UserID, false, false, false)?> <?=time_diff($TorrentTime);?>
  533. <? if ($Seeders == 0) {
  534. if ($LastActive && time() - strtotime($LastActive) >= 1209600) { ?>
  535. <br /><strong>Last active: <?=time_diff($LastActive); ?></strong>
  536. <? } else { ?>
  537. <br />Last active: <?=time_diff($LastActive); ?>
  538. <? }
  539. }
  540. if (($Seeders == 0 && $LastActive && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) || check_perms('users_mod')) { ?>
  541. <br /><a href="torrents.php?action=reseed&amp;torrentid=<?=$TorrentID?>&amp;groupid=<?=$GroupID?>" class="brackets">Request re-seed</a>
  542. <? }
  543. ?>
  544. </blockquote>
  545. </div>
  546. <? if (check_perms('site_moderate_requests')) { ?>
  547. <div class="linkbox">
  548. <a href="torrents.php?action=masspm&amp;id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>" class="brackets">Mass PM snatchers</a>
  549. </div>
  550. <? } ?>
  551. <div class="linkbox">
  552. <a href="#" class="brackets" onclick="show_peers('<?=$TorrentID?>', 0); return false;">View peer list</a>
  553. <? if (check_perms('site_view_torrent_snatchlist')) { ?>
  554. <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>
  555. <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>
  556. <? } ?>
  557. <a href="#" class="brackets" onclick="show_files('<?=$TorrentID?>'); return false;">View file list</a>
  558. <? if ($Reported) { ?>
  559. <a href="#" class="brackets" onclick="show_reported('<?=$TorrentID?>'); return false;">View report information</a>
  560. <? } ?>
  561. </div>
  562. <div id="peers_<?=$TorrentID?>" class="hidden"></div>
  563. <div id="downloads_<?=$TorrentID?>" class="hidden"></div>
  564. <div id="snatches_<?=$TorrentID?>" class="hidden"></div>
  565. <div id="files_<?=$TorrentID?>" class="hidden"><?=$FileTable?></div>
  566. <? if ($Reported) { ?>
  567. <div id="reported_<?=$TorrentID?>" class="hidden"><?=$ReportInfo?></div>
  568. <?
  569. }
  570. if (!empty($Description)) {
  571. echo "\n<blockquote>".Text::full_format($Description).'</blockquote>';
  572. }
  573. if (!empty($MediaInfo)) {
  574. $parsed = MediaInfo::parse($MediaInfo);
  575. echo "\n<blockquote>";
  576. if (!empty($parsed)) {
  577. echo $parsed;
  578. } else {
  579. ?>
  580. <div class="spoilerContainer hideContainer">
  581. <input type="button" class="spoilerButton" onclick="BBCode.spoiler(this);" value="Show MediaInfo" /><blockquote class="spoiler hidden">
  582. <?
  583. echo Text::full_format($MediaInfo);
  584. ?>
  585. </blockquote>
  586. </div>
  587. <?
  588. }
  589. echo "</blockquote>";
  590. }
  591. ?>
  592. </td>
  593. </tr>
  594. <? } ?>
  595. </table>
  596. </div>
  597. <?
  598. $Requests = get_group_requests($GroupID);
  599. if (empty($LoggedUser['DisableRequests']) && count($Requests) > 0) {
  600. ?>
  601. <div class="box">
  602. <div class="head">
  603. <span style="font-weight: bold;">Requests (<?=number_format(count($Requests))?>)</span>
  604. <a toggle-target="#requests" toggle-replace="Hide" style="float: right;" class="brackets">Show</a>
  605. </div>
  606. <table id="requests" class="request_table hidden">
  607. <tr class="colhead">
  608. <td>Description</td>
  609. <td>Votes</td>
  610. <td>Bounty</td>
  611. </tr>
  612. <? foreach ($Requests as $Request) {
  613. $RequestVotes = Requests::get_votes_array($Request['ID']);
  614. $RequestDesc = substr(explode('\n', Text::strip_bbcode($Request['Description']), 2)[0], 0, 70);
  615. if (strlen(explode('\n', Text::strip_bbcode($Request['Description']), 2)[0]) > 70) {
  616. $RequestDesc = substr($RequestDesc, 0, 67) . '...';
  617. }
  618. ?>
  619. <tr class="requestrows row">
  620. <td><a href="requests.php?action=view&amp;id=<?=$Request['ID']?>"><?=$RequestDesc?></a></td>
  621. <td>
  622. <span id="vote_count_<?=$Request['ID']?>"><?=count($RequestVotes['Voters'])?></span>
  623. <? if (check_perms('site_vote')) { ?>
  624. &nbsp;&nbsp; <a href="javascript:Vote(0, <?=$Request['ID']?>)" class="brackets">+</a>
  625. <? } ?>
  626. </td>
  627. <td><?=Format::get_size($RequestVotes['TotalBounty'])?></td>
  628. </tr>
  629. <? } ?>
  630. </table>
  631. </div>
  632. <?
  633. }
  634. $Collages = $Cache->get_value("torrent_collages_$GroupID");
  635. if (!is_array($Collages)) {
  636. $DB->query("
  637. SELECT c.Name, c.NumTorrents, c.ID
  638. FROM collages AS c
  639. JOIN collages_torrents AS ct ON ct.CollageID = c.ID
  640. WHERE ct.GroupID = '$GroupID'
  641. AND Deleted = '0'
  642. AND CategoryID != '0'");
  643. $Collages = $DB->to_array();
  644. $Cache->cache_value("torrent_collages_$GroupID", $Collages, 3600 * 6);
  645. }
  646. if (count($Collages) > 0) {
  647. if (count($Collages) > MAX_COLLAGES) {
  648. // Pick some at random
  649. $Range = range(0, count($Collages) - 1);
  650. shuffle($Range);
  651. $Indices = array_slice($Range, 0, MAX_COLLAGES);
  652. $SeeAll = ' <a toggle-target=".collage_rows">(See all)</a>';
  653. } else {
  654. $Indices = range(0, count($Collages) - 1);
  655. $SeeAll = '';
  656. }
  657. ?>
  658. <table class="box collage_table" id="collages">
  659. <tr class="colhead">
  660. <td width="85%"><a href="#">&uarr;</a>&nbsp;This album is in <?=number_format(count($Collages))?> collage<?=((count($Collages) > 1) ? 's' : '')?><?=$SeeAll?></td>
  661. <td># torrents</td>
  662. </tr>
  663. <? foreach ($Indices as $i) {
  664. list($CollageName, $CollageTorrents, $CollageID) = $Collages[$i];
  665. unset($Collages[$i]);
  666. ?>
  667. <tr>
  668. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  669. <td class="number_column"><?=number_format($CollageTorrents)?></td>
  670. </tr>
  671. <? }
  672. foreach ($Collages as $Collage) {
  673. list($CollageName, $CollageTorrents, $CollageID) = $Collage;
  674. ?>
  675. <tr class="collage_rows hidden">
  676. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  677. <td class="number_column"><?=number_format($CollageTorrents)?></td>
  678. </tr>
  679. <? } ?>
  680. </table>
  681. <?
  682. }
  683. $PersonalCollages = $Cache->get_value("torrent_collages_personal_$GroupID");
  684. if (!is_array($PersonalCollages)) {
  685. $DB->query("
  686. SELECT c.Name, c.NumTorrents, c.ID
  687. FROM collages AS c
  688. JOIN collages_torrents AS ct ON ct.CollageID = c.ID
  689. WHERE ct.GroupID = '$GroupID'
  690. AND Deleted = '0'
  691. AND CategoryID = '0'");
  692. $PersonalCollages = $DB->to_array(false, MYSQLI_NUM);
  693. $Cache->cache_value("torrent_collages_personal_$GroupID", $PersonalCollages, 3600 * 6);
  694. }
  695. if (count($PersonalCollages) > 0) {
  696. if (count($PersonalCollages) > MAX_PERS_COLLAGES) {
  697. // Pick some at random
  698. $Range = range(0,count($PersonalCollages) - 1);
  699. shuffle($Range);
  700. $Indices = array_slice($Range, 0, MAX_PERS_COLLAGES);
  701. $SeeAll = ' <a toggle-target=".personal_rows">(See all)</a>';
  702. } else {
  703. $Indices = range(0, count($PersonalCollages) - 1);
  704. $SeeAll = '';
  705. }
  706. ?>
  707. <table class="box collage_table" id="personal_collages">
  708. <tr class="colhead">
  709. <td width="85%"><a href="#">&uarr;</a>&nbsp;This album is in <?=number_format(count($PersonalCollages))?> personal collage<?=((count($PersonalCollages) > 1) ? 's' : '')?><?=$SeeAll?></td>
  710. <td># torrents</td>
  711. </tr>
  712. <? foreach ($Indices as $i) {
  713. list($CollageName, $CollageTorrents, $CollageID) = $PersonalCollages[$i];
  714. unset($PersonalCollages[$i]);
  715. ?>
  716. <tr>
  717. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  718. <td class="number_column"><?=number_format($CollageTorrents)?></td>
  719. </tr>
  720. <? }
  721. foreach ($PersonalCollages as $Collage) {
  722. list($CollageName, $CollageTorrents, $CollageID) = $Collage;
  723. ?>
  724. <tr class="personal_rows hidden">
  725. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  726. <td class="number_column"><?=number_format($CollageTorrents)?></td>
  727. </tr>
  728. <? } ?>
  729. </table>
  730. <?
  731. }
  732. // Matched Votes
  733. include(SERVER_ROOT.'/sections/torrents/voter_picks.php');
  734. ?>
  735. <div class="box torrent_description">
  736. <div class="head"><a href="#">&uarr;</a>&nbsp;<strong><?=(!empty($ReleaseType) ? $ReleaseTypes[$ReleaseType].' info' : 'Info' )?></strong></div>
  737. <div class="body"><? if ($WikiBody != '') { echo $WikiBody; } else { echo 'There is no information on this torrent.'; } ?></div>
  738. </div>
  739. <div class="box torrent_screenshots_box <? if (!count($Screenshots)) echo 'dead'; ?>">
  740. <div class="head"><a href="#">&uarr;</a>&nbsp;<strong>
  741. <?=($GroupCategoryID == 3)?'Samples':'Screenshots'?> (<?=count($Screenshots)?>)</strong>
  742. <?
  743. if (count($Screenshots) > 0) {
  744. ?>
  745. <a style="float: right;" class='brackets' toggle-target=".torrent_screenshots" toggle-replace="Hide">Show</a>
  746. <? }
  747. $DB->query("
  748. SELECT UserID
  749. FROM torrents
  750. WHERE GroupID = $GroupID");
  751. if (in_array($LoggedUser['ID'], $DB->collect('UserID')) || check_perms('torrents_edit') || check_perms('screenshots_add') || check_perms('screenshots_delete')) {
  752. ?>
  753. <a class="brackets" href="torrents.php?action=editgroup&groupid=<?=$GroupID?>#screenshots_section">Add/Remove</a>
  754. <?
  755. }
  756. ?>
  757. </div>
  758. <div class="body torrent_screenshots hidden">
  759. <?
  760. foreach($Screenshots as $Screenshot) {
  761. $SSURL = ImageTools::process($Screenshot['Image'], false)
  762. ?><img class='tooltip lightbox-init' title='<?=Users::format_username($Screenshot['UserID'], false, false, false)?> - <?=time_diff($Screenshot['Time'])?>' src="<?=$SSURL?>" /><?
  763. }
  764. ?>
  765. </div>
  766. <script>try{$('.torrent_screenshots>img').last().raw().style.width=($('.torrent_screenshots>img').length%2+1)*50+'%'}catch(e){}</script>
  767. </div>
  768. <?
  769. // --- Comments ---
  770. $Pages = Format::get_pages($Page, $NumComments, TORRENT_COMMENTS_PER_PAGE, 9, '#comments');
  771. ?>
  772. <div id="torrent_comments">
  773. <div class="linkbox"><a name="comments"></a>
  774. <?=$Pages?>
  775. </div>
  776. <?
  777. CommentsView::render_comments($Thread, $LastRead, "torrents.php?id=$GroupID");
  778. ?>
  779. <div class="linkbox">
  780. <?=$Pages?>
  781. </div>
  782. <?
  783. View::parse('generic/reply/quickreply.php', array(
  784. 'InputName' => 'pageid',
  785. 'InputID' => $GroupID,
  786. 'Action' => 'comments.php?page=torrents',
  787. 'InputAction' => 'take_post',
  788. 'TextareaCols' => 65,
  789. 'SubscribeBox' => true
  790. ));
  791. ?>
  792. </div>
  793. </div>
  794. </div>
  795. <? View::show_footer(); ?>