Oppaitime's version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

details.php 35KB

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