BioTorrents.de’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 42KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130
  1. <?php
  2. function compare($x, $y)
  3. {
  4. return($y['name'] < $x['name']);
  5. }
  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. $Screenshots, $Mirrors, $GroupFlags) = array_values($TorrentDetails);
  24. if (!$GroupName) {
  25. if (!$GroupNameRJ) {
  26. $GroupName = $GroupNameJP;
  27. } else {
  28. $GroupName = $GroupNameRJ;
  29. }
  30. }
  31. # Make the main headings
  32. $DisplayName = "$GroupName<br />";
  33. $AltName = $GroupName; // Goes in the alt text of the image
  34. $Title = $GroupName; // Goes in <title>
  35. $WikiBody = Text::full_format($WikiBody);
  36. $Artists = Artists::get_artist($GroupID);
  37. if ($GroupNameRJ && $GroupNameRJ !== $GroupName) {
  38. $DisplayName .= "<em>$GroupNameRJ</em> ";
  39. }
  40. if ($GroupNameJP && $GroupNameJP !== $GroupName) {
  41. $DisplayName .= "$GroupNameJP";
  42. }
  43. if ($GroupNameRJ || $GroupNameJP) {
  44. $DisplayName .= '<br />';
  45. }
  46. if ($Artists) {
  47. $DisplayName = Artists::display_artists($Artists, true) . "$DisplayName";
  48. $AltName = display_str(Artists::display_artists($Artists, false)) . $AltName;
  49. $Title = $AltName;
  50. }
  51. if ($GroupCategoryID) {
  52. $DisplayName = '<div class="'.Format::css_category($GroupCategoryID).' group_cat"></div>' . "$DisplayName";
  53. }
  54. if ($GroupYear > 0) {
  55. $DisplayName .= "$GroupYear";
  56. $AltName .= " [$GroupYear]";
  57. $Title .= " [$GroupYear]";
  58. }
  59. if ($GroupStudio) {
  60. $DisplayName .= " &ndash; $GroupStudio";
  61. }
  62. if ($GroupCatalogueNumber) {
  63. $DisplayName .= " &ndash; $GroupCatalogueNumber";
  64. }
  65. /*
  66. if ($GroupPages) {
  67. $DisplayName .= " [{$GroupPages}p]";
  68. }
  69. */
  70. /*
  71. if ($GroupDLsiteID) {
  72. $DisplayName .= " [$GroupDLsiteID]";
  73. }
  74. */
  75. $Tags = [];
  76. if ($TorrentTags !== '') {
  77. $TorrentTags = explode('|', $TorrentTags);
  78. $TorrentTagIDs = explode('|', $TorrentTagIDs);
  79. $TorrentTagUserIDs = explode('|', $TorrentTagUserIDs);
  80. foreach ($TorrentTags as $TagKey => $TagName) {
  81. $Tags[$TagKey]['name'] = $TagName;
  82. $Tags[$TagKey]['id'] = $TorrentTagIDs[$TagKey];
  83. $Tags[$TagKey]['userid'] = $TorrentTagUserIDs[$TagKey];
  84. $Split = Tags::get_name_and_class($TagName);
  85. $Tags[$TagKey]['display'] = $Split['name'];
  86. $Tags[$TagKey]['class'] = $Split['class'];
  87. }
  88. uasort($Tags, 'compare');
  89. }
  90. $CoverArt = $Cache->get_value("torrents_cover_art_$GroupID");
  91. if (!$CoverArt) {
  92. $DB->query("
  93. SELECT ID, Image, Summary, UserID, Time
  94. FROM cover_art
  95. WHERE GroupID = '$GroupID'
  96. ORDER BY Time ASC");
  97. $CoverArt = [];
  98. $CoverArt = $DB->to_array();
  99. if ($DB->has_results()) {
  100. $Cache->cache_value("torrents_cover_art_$GroupID", $CoverArt, 0);
  101. }
  102. }
  103. // Comments (must be loaded before View::show_header so that subscriptions and quote notifications are handled properly)
  104. list($NumComments, $Page, $Thread, $LastRead) = Comments::load('torrents', $GroupID);
  105. // Start output
  106. View::show_header($Title, 'browse,comments,torrent,bbcode,recommend,cover_art,subscriptions');
  107. ?>
  108. <div class="thin">
  109. <div class="header">
  110. <h2><?=$DisplayName?>
  111. </h2>
  112. <div class="linkbox">
  113. <?php if (check_perms('site_edit_wiki')) { ?>
  114. <a href="torrents.php?action=editgroup&amp;groupid=<?=$GroupID?>"
  115. class="brackets">Edit group</a>
  116. <?php } ?>
  117. <a href="torrents.php?action=history&amp;groupid=<?=$GroupID?>"
  118. class="brackets">View history</a>
  119. <?php if ($RevisionID && check_perms('site_edit_wiki')) { ?>
  120. <a href="torrents.php?action=revert&amp;groupid=<?=$GroupID ?>&amp;revisionid=<?=$RevisionID ?>&amp;auth=<?=$LoggedUser['AuthKey']?>"
  121. class="brackets">Revert to this revision</a>
  122. <?php
  123. }
  124. if (Bookmarks::has_bookmarked('torrent', $GroupID)) {
  125. ?>
  126. <a href="#" id="bookmarklink_torrent_<?=$GroupID?>"
  127. class="remove_bookmark brackets"
  128. onclick="Unbookmark('torrent', <?=$GroupID?>, 'Bookmark'); return false;">Remove
  129. bookmark</a>
  130. <?php
  131. } else { ?>
  132. <a href="#" id="bookmarklink_torrent_<?=$GroupID?>"
  133. class="add_bookmark brackets"
  134. onclick="Bookmark('torrent', <?=$GroupID?>, 'Remove bookmark'); return false;">Bookmark</a>
  135. <?php } ?>
  136. <a href="#" id="subscribelink_torrents<?=$GroupID?>"
  137. class="brackets"
  138. onclick="SubscribeComments('torrents', <?=$GroupID?>); return false;"><?=Subscriptions::has_subscribed_comments('torrents', $GroupID) !== false ? 'Unsubscribe' : 'Subscribe'?></a>
  139. <?php
  140. # Remove category-specific options to add a new format
  141. if ($Categories[$GroupCategoryID-1]) { ?>
  142. <a href="upload.php?groupid=<?=$GroupID?>" class="brackets">Add
  143. format</a>
  144. <?php
  145. }
  146. if (check_perms('site_submit_requests')) { ?>
  147. <a href="requests.php?action=new&amp;groupid=<?=$GroupID?>"
  148. class="brackets">Request format</a>
  149. <?php } ?>
  150. <a href="torrents.php?action=grouplog&amp;groupid=<?=$GroupID?>"
  151. class="brackets">View log</a>
  152. </div>
  153. </div>
  154. <?php Misc::display_recommend($GroupID, "torrent"); ?>
  155. <div class="sidebar">
  156. <div class="box box_image box_image_albumart box_albumart">
  157. <!-- .box_albumart deprecated -->
  158. <div class="head">
  159. <strong><?=(count($CoverArt) > 0 ? 'Pictures (' . (count($CoverArt) + 1) . ')' : 'Picture')?></strong>
  160. <?php
  161. if (count($CoverArt) > 0) {
  162. if (empty($LoggedUser['ShowExtraCovers'])) {
  163. for ($Index = 0; $Index <= count($CoverArt); $Index++) { ?>
  164. <span id="cover_controls_<?=($Index)?>" <?=($Index > 0 ? ' style="display: none;"' : '')?>>
  165. <?php if ($Index === count($CoverArt)) { ?>
  166. <a class="brackets prev_cover"
  167. data-gazelle-prev-cover="<?=($Index - 1)?>"
  168. href="#">Prev</a>
  169. <a class="brackets show_all_covers" href="#">Show all</a>
  170. <span class="brackets next_cover">Next</span>
  171. <?php } elseif ($Index > 0) { ?>
  172. <a class="brackets prev_cover"
  173. data-gazelle-prev-cover="<?=($Index - 1)?>"
  174. href="#">Prev</a>
  175. <a class="brackets show_all_covers" href="#">Show all</a>
  176. <a class="brackets next_cover"
  177. data-gazelle-next-cover="<?=($Index + 1)?>"
  178. href="#">Next</a>
  179. <?php } elseif ($Index === 0 && count($CoverArt) > 0) { ?>
  180. <span class="brackets prev_cover">Prev</span>
  181. <a class="brackets show_all_covers" href="#">Show all</a>
  182. <a class="brackets next_cover"
  183. data-gazelle-next-cover="<?=($Index + 1)?>"
  184. href="#">Next</a>
  185. <?php } ?>
  186. </span>
  187. <?php
  188. }
  189. } else { ?>
  190. <span>
  191. <a class="brackets show_all_covers" href="#">Hide</a>
  192. </span>
  193. <?php
  194. }
  195. }
  196. ?>
  197. </div>
  198. <?php $Index = 0; ?>
  199. <div id="covers">
  200. <div id="cover_div_<?=$Index?>">
  201. <?php if ($WikiImage !== '') { ?>
  202. <div><img width="100%" class="lightbox-init"
  203. src="<?=ImageTools::process($WikiImage, 'thumb')?>"
  204. lightbox-img="<?=ImageTools::process($WikiImage)?>"
  205. alt="<?=$AltName?>" /></div>
  206. <?php } else { ?>
  207. <div><img width="100%"
  208. src="<?=STATIC_SERVER?>common/noartwork/music.png"
  209. alt="<?=$Categories[$GroupCategoryID - 1]?>"
  210. class="brackets tooltip"
  211. title="<?=$Categories[$GroupCategoryID - 1]?>" /></div>
  212. <?php
  213. }
  214. $Index++;
  215. ?>
  216. </div>
  217. <?php
  218. foreach ($CoverArt as $Cover) {
  219. list($ImageID, $Image, $Summary, $AddedBy) = $Cover; ?>
  220. <div id="cover_div_<?=$Index?>" <?=(empty($LoggedUser['ShowExtraCovers']) ? ' style="display: none;"' : '')?>>
  221. <div>
  222. <?php
  223. if (empty($LoggedUser['ShowExtraCovers'])) {
  224. $Src = 'src="" data-gazelle-temp-src="' . ImageTools::process($Image, 'thumb') . '" lightbox-img="'.ImageTools::process($Image).'"';
  225. } else {
  226. $Src = 'src="' . ImageTools::process($Image, 'thumb') . '" lightbox-img="'.ImageTools::process($Image).'"';
  227. } ?>
  228. <img id="cover_<?=$Index?>" class="lightbox-init"
  229. width="100%" <?=$Src?> alt="<?=$Summary?>" />
  230. </div>
  231. <ul class="stats nobullet">
  232. <li>
  233. <?=$Summary?>
  234. <?=(check_perms('users_mod') ? ' added by ' . Users::format_username($AddedBy, false, false, false, false, false) : '')?>
  235. <span class="remove remove_cover_art"><a href="#"
  236. onclick="if (confirm('Do not delete useful alternative pictures. Are you sure you want to delete this picture?') === 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; }"
  237. class="brackets tooltip" title="Remove image">X</a></span>
  238. </li>
  239. </ul>
  240. </div>
  241. <?php
  242. $Index++;
  243. } ?>
  244. </div>
  245. <?php
  246. if (check_perms('site_edit_wiki') && $WikiImage !== '') { ?>
  247. <div id="add_cover_div">
  248. <div style="padding: 10px;">
  249. <span class="additional_add_artists float_right">
  250. <a onclick="addCoverField(); return false;" href="#" class="brackets">Add alternate cover</a>
  251. </span>
  252. </div>
  253. <div class="body">
  254. <form class="add_form" name="covers" id="add_covers_form" action="torrents.php" method="post">
  255. <div id="add_cover">
  256. <input type="hidden" name="action" value="add_cover_art" />
  257. <input type="hidden" name="auth"
  258. value="<?=$LoggedUser['AuthKey']?>" />
  259. <input type="hidden" name="groupid"
  260. value="<?=$GroupID?>" />
  261. </div>
  262. </form>
  263. </div>
  264. </div>
  265. <?php } ?>
  266. </div>
  267. <div class="box box_artists">
  268. <div class="head"><strong>Author(s)</strong>
  269. <?=check_perms('torrents_edit') ? '<span class="edit_artists"><a onclick="ArtistManager(); return false;" href="#" class="brackets float_right">Edit</a></span>' : ''?>
  270. </div>
  271. <ul class="stats nobullet" id="artist_list">
  272. <?php foreach ($Artists as $Num => $Artist) { ?>
  273. <li class="artist"><?=Artists::display_artist($Artist)?>
  274. <?php if (check_perms('torrents_edit')) { ?>
  275. <span class="remove remove_artist float_right"><a href="javascript:void(0);"
  276. 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';"
  277. class="brackets tooltip" title="Remove artist">X</a></span>
  278. <?php } ?>
  279. </li>
  280. <?php } ?>
  281. </ul>
  282. </div>
  283. <?php
  284. if (check_perms('torrents_add_artist')) { ?>
  285. <div class="box box_addartists">
  286. <div class="head"><strong>Add Author</strong></div>
  287. <div class="body">
  288. <form class="flex_input_container" name="artists" action="torrents.php" method="post">
  289. <input type="hidden" name="action" value="add_alias" />
  290. <input type="hidden" name="auth"
  291. value="<?=$LoggedUser['AuthKey']?>" />
  292. <input type="hidden" name="groupid"
  293. value="<?=$GroupID?>" />
  294. <input type="text" id="artist" name="artistname[]" <?php Users::has_autocomplete_enabled('other'); ?>
  295. />
  296. <input type="submit" value="Add" />
  297. </form>
  298. </div>
  299. </div>
  300. <?php
  301. } ?>
  302. <div class="box box_tags">
  303. <div class="head">
  304. <strong>Tags</strong>
  305. <?php
  306. $DeletedTag = $Cache->get_value("deleted_tags_$GroupID".'_'.$LoggedUser['ID']);
  307. if (!empty($DeletedTag)) { ?>
  308. <form style="display: none;" id="undo_tag_delete_form" name="tags" action="torrents.php" method="post">
  309. <input type="hidden" name="action" value="add_tag" />
  310. <input type="hidden" name="auth"
  311. value="<?=$LoggedUser['AuthKey']?>" />
  312. <input type="hidden" name="groupid"
  313. value="<?=$GroupID?>" />
  314. <input type="hidden" name="tagname"
  315. value="<?=$DeletedTag?>" />
  316. <input type="hidden" name="undo" value="true" />
  317. </form>
  318. <a class="brackets" href="#" onclick="$('#undo_tag_delete_form').raw().submit(); return false;">Undo delete</a>
  319. <?php } ?>
  320. </div>
  321. <?php
  322. if (count($Tags) > 0) {
  323. ?>
  324. <ul class="stats nobullet">
  325. <?php
  326. foreach ($Tags as $TagKey=>$Tag) {
  327. ?>
  328. <li>
  329. <a href="torrents.php?taglist=<?=$Tag['name']?>"
  330. class="<?=display_str($Tag['class'])?>"><?=display_str($Tag['display'])?></a>
  331. <div class="edit_tags_votes float_right">
  332. <?php if (check_perms('users_warn')) { ?>
  333. <a href="user.php?id=<?=$Tag['userid']?>"
  334. title="View the profile of the user that added this tag" class="brackets tooltip view_tag_user">U</a>
  335. <?php } ?>
  336. <?php if (empty($LoggedUser['DisableTagging']) && check_perms('site_delete_tag')) { ?>
  337. <span class="remove remove_tag"><a
  338. href="torrents.php?action=delete_tag&amp;groupid=<?=$GroupID?>&amp;tagid=<?=$Tag['id']?>&amp;auth=<?=$LoggedUser['AuthKey']?>"
  339. class="brackets tooltip" title="Remove tag">X</a></span>
  340. <?php } ?>
  341. </div>
  342. </li>
  343. <?php
  344. } ?>
  345. </ul>
  346. <?php
  347. } else { // The "no tags to display" message was wrapped in <ul> tags to pad the text
  348. ?>
  349. <ul>
  350. <li>There are no tags to display</li>
  351. </ul>
  352. <?php } ?>
  353. </div>
  354. <?php
  355. if (empty($LoggedUser['DisableTagging'])) {
  356. ?>
  357. <div class="box box_addtag">
  358. <div class="head"><strong>Add Tag</strong></div>
  359. <div class="body">
  360. <form class="flex_input_container" name="tags" action="torrents.php" method="post">
  361. <input type="hidden" name="action" value="add_tag" />
  362. <input type="hidden" name="auth"
  363. value="<?=$LoggedUser['AuthKey']?>" />
  364. <input type="hidden" name="groupid"
  365. value="<?=$GroupID?>" />
  366. <input type="text" name="tagname" id="tagname" <?php Users::has_autocomplete_enabled('other'); ?>
  367. />
  368. <input type="submit" value="Add" />
  369. </form>
  370. <br />
  371. <strong><a href="rules.php?p=tag" class="brackets">View tagging rules</a></strong>
  372. </div>
  373. </div>
  374. <?php
  375. } ?>
  376. </div>
  377. <!-- Main torrent display -->
  378. <div class="main_column">
  379. <div class="box">
  380. <table
  381. class="torrent_table details<?=$GroupFlags['IsSnatched'] ? ' snatched' : ''?>"
  382. id="torrent_details">
  383. <tr class="colhead_dark">
  384. <td width="80%"><strong>Torrents</strong></td>
  385. <td><strong>Size</strong></td>
  386. <td class="sign snatches">
  387. <a><svg width="15" height="15" fill="black" class="tooltip" alt="Snatches" title="Snatches"
  388. viewBox="3 0 88 98">
  389. <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>
  390. </svg></a>
  391. <td class="sign seeders">
  392. <a><svg width="11" height="15" fill="black" class="tooltip" alt="Seeders" title="Seeders">
  393. <polygon points="0,7 5.5,0 11,7 8,7 8,15 3,15 3,7"></polygon>
  394. </svg></a>
  395. </td>
  396. <td class="sign leechers">
  397. <a><svg width="11" height="15" fill="black" class="tooltip" alt="Leechers" title="Leechers">
  398. <polygon points="0,8 5.5,15 11,8 8,8 8,0 3,0 3,8"></polygon>
  399. </svg></a>
  400. </td>
  401. </tr>
  402. <?php
  403. function filelist($Str)
  404. {
  405. return "</td><td>".Format::get_size($Str[1])."</td></tr>";
  406. }
  407. foreach ($TorrentList as $Torrent) {
  408. list($TorrentID, $Media, $Container, $Codec, $Resolution, $AudioFormat, $Subbing,
  409. $Subber, $Language, $Censored, $Anonymous, $Archive, $FileCount, $Size, $Seeders, $Leechers,
  410. $Snatched, $FreeTorrent, $FreeLeechType, $TorrentTime, $Description, $MediaInfo, $FileList,
  411. $FilePath, $UserID, $LastActive, $InfoHash, $BadTags, $BadFolders, $BadFiles,
  412. $LastReseedRequest, $LogInDB, $HasFile, $PersonalFL, $IsSnatched, $IsSeeding, $IsLeeching
  413. ) = array_values($Torrent);
  414. $Reported = false;
  415. $Reports = Torrents::get_reports($TorrentID);
  416. $NumReports = count($Reports);
  417. if ($NumReports > 0) {
  418. $Reported = true;
  419. include(SERVER_ROOT.'/sections/reportsv2/array.php');
  420. $ReportInfo = '
  421. <table class="reportinfo_table">
  422. <tr class="colhead_dark" style="font-weight: bold;">
  423. <td>This torrent has '.$NumReports.' active '.($NumReports === 1 ? 'report' : 'reports').":</td>
  424. </tr>";
  425. foreach ($Reports as $Report) {
  426. if (check_perms('admin_reports')) {
  427. $ReporterID = $Report['ReporterID'];
  428. $Reporter = Users::user_info($ReporterID);
  429. $ReporterName = $Reporter['Username'];
  430. $ReportLinks = "<a href='user.php?id=$ReporterID'>$ReporterName</a> <a href='reportsv2.php?view=report&amp;id=$Report[ID]'>reported it</a>";
  431. } else {
  432. $ReportLinks = 'Someone reported it';
  433. }
  434. if (isset($Types[$GroupCategoryID][$Report['Type']])) {
  435. $ReportType = $Types[$GroupCategoryID][$Report['Type']];
  436. } elseif (isset($Types['master'][$Report['Type']])) {
  437. $ReportType = $Types['master'][$Report['Type']];
  438. } else {
  439. // There was a type but it wasn't an option!
  440. $ReportType = $Types['master']['other'];
  441. }
  442. $ReportInfo .= "
  443. <tr>
  444. <td>$ReportLinks ".time_diff($Report['ReportedTime'], 2, true, true).' for the reason "'.$ReportType['title'].'":
  445. <blockquote>'.Text::full_format($Report['UserComment']).'</blockquote>
  446. </td>
  447. </tr>';
  448. }
  449. $ReportInfo .= "\n\t\t</table>";
  450. }
  451. $CanEdit = (check_perms('torrents_edit') || (($UserID == $LoggedUser['ID'] && !$LoggedUser['DisableWiki']) && !($Remastered && !$RemasterYear)));
  452. $RegenLink = check_perms('users_mod') ? ' <a href="torrents.php?action=regen_filelist&amp;torrentid='.$TorrentID.'" class="brackets">Regenerate</a>' : '';
  453. $FileTable = '
  454. <table class="filelist_table">
  455. <tr class="colhead_dark">
  456. <td>
  457. <div class="filelist_title float_left">File Names' . $RegenLink . '</div>
  458. <div class="filelist_path float_right">' . ($FilePath ? "/$FilePath/" : '') . '</div>
  459. </td>
  460. <td class="nobr">
  461. <strong>Size</strong>
  462. </td>
  463. </tr>';
  464. if (substr($FileList, -3) === '}}}') { // Old style
  465. $FileListSplit = explode('|||', $FileList);
  466. foreach ($FileListSplit as $File) {
  467. $NameEnd = strrpos($File, '{{{');
  468. $Name = substr($File, 0, $NameEnd);
  469. if ($Spaces = strspn($Name, ' ')) {
  470. $Name = str_replace(' ', '&nbsp;', substr($Name, 0, $Spaces)) . substr($Name, $Spaces);
  471. }
  472. $FileSize = substr($File, $NameEnd + 3, -3);
  473. $FileTable .= sprintf("\n<tr class='row'><td>%s</td><td class='number_column nobr'>%s</td></tr>", $Name, Format::get_size($FileSize));
  474. }
  475. } else {
  476. $FileListSplit = explode("\n", $FileList);
  477. foreach ($FileListSplit as $File) {
  478. $FileInfo = Torrents::filelist_get_file($File);
  479. $FileTable .= sprintf("\n<tr class='row'><td>%s</td><td class='number_column nobr'>%s</td></tr>", $FileInfo['name'], Format::get_size($FileInfo['size']));
  480. }
  481. }
  482. $FileTable .= '
  483. </table>';
  484. $ExtraInfo = ''; // String that contains information on the torrent (e.g., format and encoding)
  485. $AddExtra = ''; // Separator between torrent properties
  486. // Similar to Torrents::torrent_info()
  487. if ($Media) {
  488. $ExtraInfo .= display_str($Media);
  489. $AddExtra = " / ";
  490. }
  491. if ($Container) {
  492. $ExtraInfo .= $AddExtra . display_str($Container);
  493. $AddExtra = ' / ';
  494. }
  495. if ($Archive) {
  496. $ExtraInfo .= $AddExtra . display_str($Archive);
  497. $AddExtra = ' / ';
  498. }
  499. if ($Codec) {
  500. $ExtraInfo .= $AddExtra . display_str($Codec);
  501. $AddExtra = ' / ';
  502. }
  503. if ($Resolution) {
  504. $ExtraInfo .= $AddExtra . display_str($Resolution);
  505. $AddExtra = ' / ';
  506. }
  507. /*
  508. if ($AudioFormat) {
  509. $ExtraInfo.=$AddExtra.display_str($AudioFormat);
  510. $AddExtra=' / '; }
  511. */
  512. /*
  513. if ($Language) {
  514. if ($Subber && ($GroupCategoryID == 3 || $GroupCategoryID == 4)) {
  515. $ExtraInfo.=$AddExtra.display_str($Language.' ('.$Subber.')');
  516. $AddExtra=' / ';
  517. } else {
  518. $ExtraInfo.=$AddExtra.display_str($Language); $AddExtra=' / ';
  519. }
  520. }
  521. */
  522. /*
  523. if ($Subbing) {
  524. if ($Subber) {
  525. if (($GroupCategoryID == 2 || $GroupCategoryID == 1) && $Subbing != "RAW") {
  526. $ExtraInfo.=$AddExtra.display_str($Subbing)." (".display_str($Subber).")"; $AddExtra=' / ';
  527. }
  528. } else {
  529. $ExtraInfo.=$AddExtra.display_str($Subbing); $AddExtra=' / ';
  530. }
  531. }
  532. */
  533. if ($Censored) {
  534. $ExtraInfo .= $AddExtra . display_str('Aligned');
  535. $AddExtra = ' / ';
  536. } else {
  537. $ExtraInfo .= $AddExtra . display_str('Not Aligned');
  538. $AddExtra = ' / ';
  539. }
  540. if (!$ExtraInfo) {
  541. $ExtraInfo = $GroupName;
  542. $AddExtra = ' / ';
  543. }
  544. if ($IsLeeching) {
  545. $ExtraInfo .= $AddExtra . Format::torrent_label('Leeching', 'important_text');
  546. $AddExtra=' / ';
  547. } elseif ($IsSeeding) {
  548. $ExtraInfo .= $AddExtra . Format::torrent_label('Seeding', 'important_text_alt');
  549. $AddExtra = ' / ';
  550. } elseif ($IsSnatched) {
  551. $ExtraInfo .= $AddExtra . Format::torrent_label('Snatched!', 'bold');
  552. $AddExtra = ' / ';
  553. }
  554. if ($FreeTorrent === '1') {
  555. $ExtraInfo .= $AddExtra . Format::torrent_label('Freeleech!', 'important_text_alt');
  556. $AddExtra=' / ';
  557. }
  558. if ($FreeTorrent === '2') {
  559. $ExtraInfo .= $AddExtra . Format::torrent_label('Neutral Leech!', 'bold');
  560. $AddExtra = ' / ';
  561. }
  562. // Freleechizer
  563. if ($FreeLeechType === '3') {
  564. $DB->query("
  565. SELECT UNIX_TIMESTAMP(ExpiryTime)
  566. FROM shop_freeleeches
  567. WHERE TorrentID = $TorrentID");
  568. if ($DB->has_results()) {
  569. $ExpiryTime = $DB->next_record(MYSQLI_NUM, false)[0];
  570. $ExtraInfo .= " <strong>(" . str_replace(['week','day','hour','min','Just now','s',' '], ['w','d','h','m','0m'], time_diff(max($ExpiryTime, time()), 1, false)) . ")</strong>";
  571. }
  572. }
  573. if ($PersonalFL) {
  574. $ExtraInfo .= $AddExtra . Format::torrent_label('Personal Freeleech!', 'important_text_alt');
  575. $AddExtra = ' / ';
  576. }
  577. if ($Reported) {
  578. $HtmlReportType = ucfirst($Reports[0]['Type']);
  579. $HtmlReportComment = htmlentities(htmlentities($Reports[0]['UserComment']));
  580. $ExtraInfo .= $AddExtra . "<strong class='torrent_label tl_reported tooltip' title='Type: $HtmlReportType<br>Comment: $HtmlReportComment'>".Format::torrent_label('Reported', 'important_text')."</strong>";
  581. $AddExtra = ' / ';
  582. }
  583. if (!empty($BadTags)) {
  584. $ExtraInfo .= $AddExtra . Format::torrent_label('Bad Tags', 'important_text');
  585. $AddExtra = ' / ';
  586. }
  587. if (!empty($BadFolders)) {
  588. $ExtraInfo .= $AddExtra . Format::torrent_label('Bad Folders', 'important_text');
  589. $AddExtra = ' / ';
  590. }
  591. if (!empty($BadFiles)) {
  592. $ExtraInfo .= $AddExtra . Format::torrent_label('Bad File Names', 'important_text');
  593. $AddExtra = ' / ';
  594. }
  595. $TorrentDL = "torrents.php?action=download&amp;id=".$TorrentID."&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass'];
  596. if (!empty(G::$LoggedUser) && (G::$LoggedUser['ShowMagnets'] ?? false)) {
  597. if (!($TorrentFileName = $Cache->get_value('torrent_file_name_'.$TorrentID))) {
  598. $TorrentFile = file_get_contents(TORRENT_STORE.$TorrentID.'.torrent');
  599. $Tor = new BencodeTorrent($TorrentFile, false, false);
  600. $TorrentFileName = $Tor->Dec['info']['name'];
  601. $Cache->cache_value('torrent_file_name_'.$TorrentID, $TorrentFileName);
  602. }
  603. # Magnet link h4x
  604. $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;
  605. } ?>
  606. <tr
  607. class="torrent_row groupid_<?=$GroupID?> group_torrent<?=($IsSnatched ? ' snatched_torrent' : '')?>"
  608. style="font-weight: normal;" id="torrent<?=$TorrentID?>">
  609. <td>
  610. <span>[ <a href="<?=$TorrentDL?>" class="tooltip"
  611. title="Download"><?=($HasFile ? 'DL' : 'Missing')?></a>
  612. <?php if (isset($TorrentMG)) { ?>
  613. | <a href="<?=$TorrentMG?>" class="tooltip"
  614. title="Magnet Link">MG</a>
  615. <?php }
  616. if (Torrents::can_use_token($Torrent)) { ?>
  617. | <a
  618. href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1"
  619. class="tooltip" title="Use a FL Token"
  620. onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
  621. <?php } ?>
  622. | <a
  623. href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>"
  624. class="tooltip" title="Report">RP</a>
  625. <?php if ($CanEdit) { ?>
  626. | <a
  627. href="torrents.php?action=edit&amp;id=<?=$TorrentID ?>"
  628. class="tooltip" title="Edit release">ED</a>
  629. <?php }
  630. if (check_perms('torrents_delete') || $UserID == $LoggedUser['ID']) { ?>
  631. | <a
  632. href="torrents.php?action=delete&amp;torrentid=<?=$TorrentID ?>"
  633. class="tooltip" title="Remove">RM</a>
  634. <?php } ?>
  635. | <a href="torrents.php?torrentid=<?=$TorrentID ?>"
  636. class="tooltip" title="Permalink">PL</a>
  637. ]</span>
  638. &raquo; <a
  639. data-toggle-target="#torrent_<?=$TorrentID?>"><?=$ExtraInfo; ?></a>
  640. </td>
  641. <td class="number_column nobr"><?=Format::get_size($Size)?>
  642. </td>
  643. <td class="number_column"><?=number_format($Snatched)?>
  644. </td>
  645. <td class="number_column"><?=number_format($Seeders)?>
  646. </td>
  647. <td class="number_column"><?=number_format($Leechers)?>
  648. </td>
  649. </tr>
  650. <tr
  651. class=" groupid_<?=$GroupID?> torrentdetails pad <?php if (!isset($_GET['torrentid']) || $_GET['torrentid'] != $TorrentID) { ?>hidden<?php } ?>"
  652. id="torrent_<?=$TorrentID; ?>">
  653. <td colspan="5">
  654. <div id="release_<?=$TorrentID?>" class="no_overflow">
  655. <blockquote>
  656. Uploaded by <?php
  657. if ($Anonymous) {
  658. if (check_perms('users_mod')) { ?>
  659. <em class="tooltip"
  660. title="<?=Users::user_info($UserID)['Username']?>">Anonymous</em>
  661. <?php } else {
  662. ?><em>Anonymous</em><?php
  663. }
  664. } else {
  665. print Users::format_username($UserID, false, false, false);
  666. } ?> <?=time_diff($TorrentTime); ?>
  667. <?php if ($Seeders === 0) {
  668. if ($LastActive && time() - strtotime($LastActive) >= 1209600) { ?>
  669. <br /><strong>Last active: <?=time_diff($LastActive); ?></strong>
  670. <?php } else { ?>
  671. <br />Last active: <?=time_diff($LastActive); ?>
  672. <?php }
  673. }
  674. if (($Seeders === 0 && $LastActive && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) || check_perms('users_mod')) { ?>
  675. <br /><a
  676. href="torrents.php?action=reseed&amp;torrentid=<?=$TorrentID?>&amp;groupid=<?=$GroupID?>"
  677. class="brackets">Request re-seed</a>
  678. <?php } ?>
  679. </blockquote>
  680. </div>
  681. <?php if (check_perms('site_moderate_requests')) { ?>
  682. <div class="linkbox">
  683. <a href="torrents.php?action=masspm&amp;id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"
  684. class="brackets">Mass PM snatchers</a>
  685. </div>
  686. <?php } ?>
  687. <div class="linkbox">
  688. <a href="#" class="brackets"
  689. onclick="show_peers('<?=$TorrentID?>', 0); return false;">View
  690. peer list</a>
  691. <?php if (check_perms('site_view_torrent_snatchlist')) { ?>
  692. <a href="#" class="brackets tooltip"
  693. onclick="show_downloads('<?=$TorrentID?>', 0); return false;"
  694. title="View the list of users that have clicked the &quot;DL&quot; button.">View download list</a>
  695. <a href="#" class="brackets tooltip"
  696. onclick="show_snatches('<?=$TorrentID?>', 0); return false;"
  697. title="View the list of users that have reported a snatch to the tracker.">View snatch list</a>
  698. <?php } ?>
  699. <a href="#" class="brackets"
  700. onclick="show_files('<?=$TorrentID?>'); return false;">View
  701. file list</a>
  702. <?php if ($Reported) { ?>
  703. <a href="#" class="brackets"
  704. onclick="show_reported('<?=$TorrentID?>'); return false;">View
  705. report information</a>
  706. <?php } ?>
  707. </div>
  708. <div id="peers_<?=$TorrentID?>" class="hidden"></div>
  709. <div id="downloads_<?=$TorrentID?>" class="hidden"></div>
  710. <div id="snatches_<?=$TorrentID?>" class="hidden"></div>
  711. <div id="files_<?=$TorrentID?>" class="hidden"><?=$FileTable?>
  712. </div>
  713. <?php if ($Reported) { ?>
  714. <div id="reported_<?=$TorrentID?>" class="hidden"><?=$ReportInfo?>
  715. </div>
  716. <?php
  717. }
  718. if (!empty($Description)) {
  719. echo "\n<blockquote>".Text::full_format($Description).'</blockquote>';
  720. }
  721. /*
  722. if (!empty($MediaInfo) || $MediaInfo === 'nil') { # Kludge
  723. $parsed = MediaInfo::parse($MediaInfo);
  724. echo "\n<blockquote>";
  725. if (!empty($parsed)) {
  726. echo $parsed;
  727. } else {
  728. */
  729. echo "\n<blockquote>"; ?>
  730. <div class="spoilerContainer hideContainer">
  731. <?php
  732. # Make a filename
  733. $filename = "BioTorrents.de-$TorrentID";
  734. # Make a BibTeX citation
  735. $bibtex = "
  736. @misc{ $filename,";
  737. foreach ($Artists as $Num => $Artist) {
  738. $bibtex .= "\n author = {".Artists::display_artist($Artist)."},";
  739. }
  740. if (!empty($GroupNameRJ) || !empty($GroupNameJP)) {
  741. $bibtex .= "\n subtitle= {".$GroupNameRJ." ".$GroupNameJP."},";
  742. }
  743. $bibtex .= "
  744. title = {".$GroupName."},
  745. year = {".$GroupYear."},
  746. url = \href{https://biotorrents.de/torrents.php?torrentid=$TorrentID},
  747. note = {Online; accessed ".strftime('%Y-%m-%d')."},
  748. },"; ?>
  749. <!-- todo: Download BibTeX citation feature
  750. <form method="post" action="download.php">
  751. <input type="hidden" name="file" id="file" value="< ? = urlencode($filename) ? >"
  752. />
  753. <input type="hidden" name="content" id="content"
  754. value="< ? = urlencode($bibtex) ? >" />
  755. <button type="submit">Download BibTeX</button>
  756. </form>
  757. -->
  758. <!-- Both tags must be on the same line -->
  759. <input type="button" class="spoilerButton" value="Show BibTeX" /><pre class="hidden">
  760. <?=$bibtex?>
  761. </pre>
  762. </div>
  763. <?php
  764. #}
  765. echo '</blockquote>';
  766. } ?>
  767. </td>
  768. </tr>
  769. <?php
  770. #}?>
  771. </table>
  772. </div>
  773. <?php
  774. $Requests = get_group_requests($GroupID);
  775. if (empty($LoggedUser['DisableRequests']) && count($Requests) > 0) {
  776. ?>
  777. <div class="box">
  778. <div class="head">
  779. <span style="font-weight: bold;">Requests (<?=number_format(count($Requests))?>)</span>
  780. <a data-toggle-target="#requests" data-toggle-replace="Hide" class="float_right brackets">Show</a>
  781. </div>
  782. <table id="requests" class="request_table hidden">
  783. <tr class="colhead">
  784. <td>Description</td>
  785. <td>Votes</td>
  786. <td>Bounty</td>
  787. </tr>
  788. <?php foreach ($Requests as $Request) {
  789. $RequestVotes = Requests::get_votes_array($Request['ID']);
  790. $RequestDesc = substr(explode('\n', Text::strip_bbcode($Request['Description']), 2)[0], 0, 70);
  791. if (strlen(explode('\n', Text::strip_bbcode($Request['Description']), 2)[0]) > 70) {
  792. $RequestDesc = substr($RequestDesc, 0, 67) . '...';
  793. } ?>
  794. <tr class="requestrows row">
  795. <td><a
  796. href="requests.php?action=view&amp;id=<?=$Request['ID']?>"><?=$RequestDesc?></a></td>
  797. <td>
  798. <span
  799. id="vote_count_<?=$Request['ID']?>"><?=count($RequestVotes['Voters'])?></span>
  800. <?php if (check_perms('site_vote')) { ?>
  801. &nbsp;&nbsp; <a
  802. href="javascript:Vote(0, <?=$Request['ID']?>)"
  803. class="brackets">+</a>
  804. <?php } ?>
  805. </td>
  806. <td><?=Format::get_size($RequestVotes['TotalBounty'])?>
  807. </td>
  808. </tr>
  809. <?php
  810. } ?>
  811. </table>
  812. </div>
  813. <?php
  814. }
  815. $Collages = $Cache->get_value("torrent_collages_$GroupID");
  816. if (!is_array($Collages)) {
  817. $DB->query("
  818. SELECT c.Name, c.NumTorrents, c.ID
  819. FROM collages AS c
  820. JOIN collages_torrents AS ct ON ct.CollageID = c.ID
  821. WHERE ct.GroupID = '$GroupID'
  822. AND Deleted = '0'
  823. AND CategoryID != '0'");
  824. $Collages = $DB->to_array();
  825. $Cache->cache_value("torrent_collages_$GroupID", $Collages, 3600 * 6);
  826. }
  827. if (count($Collages) > 0) {
  828. if (count($Collages) > MAX_COLLAGES) {
  829. // Pick some at random
  830. $Range = range(0, count($Collages) - 1);
  831. shuffle($Range);
  832. $Indices = array_slice($Range, 0, MAX_COLLAGES);
  833. $SeeAll = ' <a data-toggle-target=".collage_rows">(See all)</a>';
  834. } else {
  835. $Indices = range(0, count($Collages) - 1);
  836. $SeeAll = '';
  837. } ?>
  838. <table class="box collage_table" id="collages">
  839. <tr class="colhead">
  840. <td width="85%"><a href="#">&uarr;</a>&nbsp;This content is in <?=number_format(count($Collages))?> collection<?=((count($Collages) > 1) ? 's' : '')?><?=$SeeAll?>
  841. </td>
  842. <td># torrents</td>
  843. </tr>
  844. <?php foreach ($Indices as $i) {
  845. list($CollageName, $CollageTorrents, $CollageID) = $Collages[$i];
  846. unset($Collages[$i]); ?>
  847. <tr>
  848. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  849. <td class="number_column"><?=number_format($CollageTorrents)?>
  850. </td>
  851. </tr>
  852. <?php
  853. }
  854. foreach ($Collages as $Collage) {
  855. list($CollageName, $CollageTorrents, $CollageID) = $Collage; ?>
  856. <tr class="collage_rows hidden">
  857. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  858. <td class="number_column"><?=number_format($CollageTorrents)?>
  859. </td>
  860. </tr>
  861. <?php
  862. } ?>
  863. </table>
  864. <?php
  865. }
  866. $PersonalCollages = $Cache->get_value("torrent_collages_personal_$GroupID");
  867. if (!is_array($PersonalCollages)) {
  868. $DB->query("
  869. SELECT c.Name, c.NumTorrents, c.ID
  870. FROM collages AS c
  871. JOIN collages_torrents AS ct ON ct.CollageID = c.ID
  872. WHERE ct.GroupID = '$GroupID'
  873. AND Deleted = '0'
  874. AND CategoryID = '0'");
  875. $PersonalCollages = $DB->to_array(false, MYSQLI_NUM);
  876. $Cache->cache_value("torrent_collages_personal_$GroupID", $PersonalCollages, 3600 * 6);
  877. }
  878. if (count($PersonalCollages) > 0) {
  879. if (count($PersonalCollages) > MAX_PERS_COLLAGES) {
  880. // Pick some at random
  881. $Range = range(0, count($PersonalCollages) - 1);
  882. shuffle($Range);
  883. $Indices = array_slice($Range, 0, MAX_PERS_COLLAGES);
  884. $SeeAll = ' <a data-toggle-target=".personal_rows">(See all)</a>';
  885. } else {
  886. $Indices = range(0, count($PersonalCollages) - 1);
  887. $SeeAll = '';
  888. } ?>
  889. <table class="box collage_table" id="personal_collages">
  890. <tr class="colhead">
  891. <td width="85%"><a href="#">&uarr;</a>&nbsp;This content is in <?=number_format(count($PersonalCollages))?> personal
  892. collection<?=((count($PersonalCollages) > 1) ? 's' : '')?><?=$SeeAll?>
  893. </td>
  894. <td># torrents</td>
  895. </tr>
  896. <?php foreach ($Indices as $i) {
  897. list($CollageName, $CollageTorrents, $CollageID) = $PersonalCollages[$i];
  898. unset($PersonalCollages[$i]); ?>
  899. <tr>
  900. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  901. <td class="number_column"><?=number_format($CollageTorrents)?>
  902. </td>
  903. </tr>
  904. <?php
  905. }
  906. foreach ($PersonalCollages as $Collage) {
  907. list($CollageName, $CollageTorrents, $CollageID) = $Collage; ?>
  908. <tr class="personal_rows hidden">
  909. <td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
  910. <td class="number_column"><?=number_format($CollageTorrents)?>
  911. </td>
  912. </tr>
  913. <?php
  914. } ?>
  915. </table>
  916. <?php
  917. }
  918. ?>
  919. <!-- Torrent group description -->
  920. <div class="box torrent_description">
  921. <div class="head"><a href="#">&uarr;</a>&nbsp;<strong><?=(!empty($ReleaseType) ? $ReleaseTypes[$ReleaseType].' info' : 'Info')?></strong>
  922. </div>
  923. <div class="body"><?php if ($WikiBody != '') {
  924. echo $WikiBody;
  925. } else {
  926. echo 'There is no information on this torrent.';
  927. } ?>
  928. </div>
  929. </div>
  930. <!-- Mirrors -->
  931. <div class="box torrent_mirrors_box <?php if (!count($Mirrors)) {
  932. echo 'dead';
  933. } ?>">
  934. <div class="head"><a href="#">&uarr;</a>&nbsp;<strong>
  935. Mirrors (<?= count($Mirrors) ?>)</strong>
  936. <?php
  937. if (count($Mirrors) > 0) {
  938. ?>
  939. <a class="float_right brackets" data-toggle-target=".torrent_mirrors" data-toggle-replace="Show">Hide</a>
  940. <?php
  941. }
  942. $DB->query("
  943. SELECT UserID
  944. FROM torrents
  945. WHERE GroupID = $GroupID");
  946. if (in_array($LoggedUser['ID'], $DB->collect('UserID')) || check_perms('torrents_edit') || check_perms('screenshots_add') || check_perms('screenshots_delete')) {
  947. ?>
  948. <a class="brackets"
  949. href="torrents.php?action=editgroup&groupid=<?=$GroupID?>#mirrors_section">Add/Remove</a>
  950. <?php
  951. }
  952. ?>
  953. </div>
  954. <div class="body torrent_mirrors">
  955. <?php if (!empty($Mirrors)) {
  956. echo '<p>Mirror links open in a new tab.</p>';
  957. } ?>
  958. <ul>
  959. <?php
  960. foreach ($Mirrors as $Mirror) {
  961. echo '<li><a href="'.$Mirror['Resource'].'" target="_blank">'.$Mirror['Resource'].'</a></li>';
  962. }
  963. ?>
  964. </ul>
  965. </div>
  966. </div>
  967. <!-- Screenshots (Publications) -->
  968. <div class="box torrent_screenshots_box <?php if (!count($Screenshots)) {
  969. echo 'dead';
  970. } ?>">
  971. <div class="head"><a href="#">&uarr;</a>&nbsp;<strong>
  972. Publications (<?= count($Screenshots) ?>)</strong>
  973. <?php
  974. if (count($Screenshots) > 0) {
  975. ?>
  976. <a class="float_right brackets" data-toggle-target=".torrent_screenshots" data-toggle-replace="Show">Hide</a>
  977. <?php
  978. }
  979. $DB->query("
  980. SELECT UserID
  981. FROM torrents
  982. WHERE GroupID = $GroupID");
  983. if (in_array($LoggedUser['ID'], $DB->collect('UserID')) || check_perms('torrents_edit') || check_perms('screenshots_add') || check_perms('screenshots_delete')) {
  984. ?>
  985. <a class="brackets"
  986. href="torrents.php?action=editgroup&groupid=<?=$GroupID?>#screenshots_section">Add/Remove</a>
  987. <?php
  988. }
  989. ?>
  990. </div>
  991. <div class="body torrent_screenshots">
  992. <?php if (!empty($Screenshots)) {
  993. echo '<p>Sci-Hub links open in a new tab.</p>';
  994. } ?>
  995. <ul>
  996. <?php
  997. foreach ($Screenshots as $Screenshot) {
  998. echo '<li><a href="https://sci-hub.'.SCI_HUB.'/'.$Screenshot['Image'].'" target="_blank">'.$Screenshot['Image'].'</a></li>';
  999. /* Image proxy integration
  1000. $SSURL = ImageTools::process($Screenshot['Image']);
  1001. $ThumbURL = ImageTools::process($Screenshot['Image'], 'thumb');
  1002. */
  1003. /* todo: Bring this back
  1004. if (check_perms('users_mod')) {
  1005. ?><img class='tooltip lightbox-init' title='<?=Users::format_username($Screenshot['UserID'], false, false, false)?> - <?=time_diff($Screenshot['Time'])?>' lightbox-img="<?=$SSURL?>" src="<?=$ThumbURL?>" /><?
  1006. } else {
  1007. ?><img class='tooltip lightbox-init' title='Added <?=time_diff($Screenshot['Time'])?>' lightbox-img="<?=$SSURL?>" src="<?=$ThumbURL?>" /><?
  1008. }
  1009. */
  1010. }
  1011. ?>
  1012. </ul>
  1013. </div>
  1014. <script>
  1015. try {
  1016. $('.torrent_screenshots>img').last().raw().style.width = ($('.torrent_screenshots>img').length % 2 + 1) * 50 +
  1017. '%'
  1018. } catch (e) {}
  1019. </script>
  1020. </div>
  1021. <?php
  1022. // --- Comments ---
  1023. $Pages = Format::get_pages($Page, $NumComments, TORRENT_COMMENTS_PER_PAGE, 9, '#comments');
  1024. ?>
  1025. <div id="torrent_comments">
  1026. <div class="linkbox"><a name="comments"></a>
  1027. <?=$Pages?>
  1028. </div>
  1029. <?php
  1030. CommentsView::render_comments($Thread, $LastRead, "torrents.php?id=$GroupID");
  1031. ?>
  1032. <div class="linkbox">
  1033. <?=$Pages?>
  1034. </div>
  1035. <?php
  1036. View::parse('generic/reply/quickreply.php', array(
  1037. 'InputName' => 'pageid',
  1038. 'InputID' => $GroupID,
  1039. 'Action' => 'comments.php?page=torrents',
  1040. 'InputAction' => 'take_post',
  1041. 'TextareaCols' => 65,
  1042. 'SubscribeBox' => true
  1043. ));
  1044. ?>
  1045. </div>
  1046. </div>
  1047. </div>
  1048. <?php View::show_footer();