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.

report.php 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <?php
  2. #declare(strict_types=1);
  3. /**
  4. * This is the frontend of reporting a torrent, it's what users see when
  5. * they visit reportsv2.php?id=xxx
  6. */
  7. $ENV = ENV::go();
  8. require_once "$ENV->SERVER_ROOT/sections/torrents/functions.php";
  9. // If we're not coming from torrents.php, check we're being returned because of an error.
  10. if (!isset($_GET['id']) || !is_number($_GET['id'])) {
  11. if (!isset($Err)) {
  12. error(404);
  13. }
  14. } else {
  15. $TorrentID = $_GET['id'];
  16. $DB->prepared_query("
  17. SELECT tg.`category_id`, t.`GroupID`, u.`Username`
  18. FROM `torrents_group` AS tg
  19. LEFT JOIN `torrents` AS t ON t.`GroupID` = tg.`id`
  20. LEFT JOIN `users_main` AS u ON t.`UserID` = u.`ID`
  21. WHERE t.`ID` = " . $_GET['id']);
  22. list($CategoryID, $GroupID, $Username) = $DB->next_record();
  23. $Artists = Artists::get_artist($GroupID);
  24. $TorrentCache = get_group_info($GroupID, true);
  25. $GroupDetails = $TorrentCache[0];
  26. $TorrentList = $TorrentCache[1];
  27. // Resolve the torrentlist to the one specific torrent being reported
  28. foreach ($TorrentList as &$Torrent) {
  29. // Remove unneeded entries
  30. if ($Torrent['ID'] != $TorrentID) {
  31. unset($TorrentList[$Torrent['ID']]);
  32. }
  33. }
  34. // Group details
  35. list($WikiBody, $WikiImage, $GroupID, $GroupName, $GroupTitle2, $GroupNameJP,
  36. $GroupYear, $GroupStudio, $GroupSeries, $GroupCatalogueNumber,
  37. $GroupCategoryID, $GroupDLSite, $GroupTime, $TorrentTags, $TorrentTagIDs,
  38. $TorrentTagUserIDs, $Screenshots, $GroupFlags) = array_values($GroupDetails);
  39. $DisplayName = $GroupName;
  40. $AltName = $GroupName; // Goes in the alt text of the image
  41. $Title = $GroupName; // Goes in <title>
  42. $WikiBody = Text::full_format($WikiBody);
  43. // Get the artist name, group name etc.
  44. $Artists = Artists::get_artist($GroupID);
  45. if ($Artists) {
  46. $DisplayName = '<span dir="ltr">' . Artists::display_artists($Artists, true) . "<a href=\"torrents.php?torrentid=$TorrentID\">$DisplayName</a></span>";
  47. $AltName = display_str(Artists::display_artists($Artists, false)) . $AltName;
  48. $Title = $AltName;
  49. }
  50. if ($GroupYear > 0) {
  51. $DisplayName .= " [$GroupYear]";
  52. $AltName .= " [$GroupYear]";
  53. $Title .= " [$GroupYear]";
  54. }
  55. /*
  56. if ($GroupCategoryID === 1) {
  57. $DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
  58. $AltName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
  59. }
  60. */
  61. }
  62. View::show_header('Report', 'reportsv2,browse,torrent,recommend');
  63. ?>
  64. <div>
  65. <div class="header">
  66. <h2>Report a torrent</h2>
  67. </div>
  68. <div class="header">
  69. <h3><?=$DisplayName?></h3>
  70. </div>
  71. <div class="box">
  72. <table class="torrent_table details<?=((isset($GroupFlags['IsSnatched']) && $GroupFlags['IsSnatched']) ? ' snatched' : '')?>" id="torrent_details">
  73. <tr class="colhead_dark">
  74. <td width="80%"><strong>Reported torrent</strong></td>
  75. <td><strong>Size</strong></td>
  76. <td class="sign snatches">
  77. </td>
  78. <td class="sign seeders">
  79. &uarr;
  80. </td>
  81. <td class="sign leechers">
  82. &darr;
  83. </td>
  84. </tr>
  85. <?php
  86. $LangName = $GroupName ? $GroupName : ($GroupTitle2 ? $GroupTitle2 : $GroupNameJP);
  87. build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $LangName, $GroupCategoryID, $TorrentList, $Types, $Username);
  88. ?>
  89. </table>
  90. </div>
  91. <form class="create_form" name="report" action="reportsv2.php?action=takereport" enctype="multipart/form-data" method="post" id="reportform">
  92. <div>
  93. <input type="hidden" name="submit" value="true" />
  94. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  95. <input type="hidden" name="torrentid" value="<?=$TorrentID?>" />
  96. <input type="hidden" name="categoryid" value="<?=$CategoryID?>" />
  97. </div>
  98. <h3>Report Information</h3>
  99. <div class="box pad">
  100. <table class="layout">
  101. <tr>
  102. <td class="label">Reason</td>
  103. <td>
  104. <select id="type" name="type" class="change_report_type">
  105. <?php
  106. if (!empty($Types[$CategoryID])) {
  107. $TypeList = $Types['master'] + $Types[$CategoryID];
  108. $Priorities = [];
  109. foreach ($TypeList as $Key => $Value) {
  110. $Priorities[$Key] = $Value['priority'];
  111. }
  112. array_multisort($Priorities, SORT_ASC, $TypeList);
  113. } else {
  114. $TypeList = $Types['master'];
  115. }
  116. foreach ($TypeList as $Type => $Data) {
  117. ?>
  118. <option value="<?=($Type)?>"><?=($Data['title'])?></option>
  119. <?php
  120. } ?>
  121. </select>
  122. </td>
  123. </tr>
  124. </table>
  125. <p>Fields that contain lists of values (for example, listing more than one track number) should be separated by a space.</p>
  126. <p><strong>Following the below report type specific guidelines will help the moderators deal with your report in a timely fashion.</strong></p>
  127. <div id="dynamic_form">
  128. <?php
  129. /**
  130. * THIS IS WHERE SEXY AJAX COMES IN
  131. * The following malarky is needed so that if you get sent back here, the fields are filled in.
  132. */
  133. ?>
  134. <input id="sitelink" type="hidden" name="sitelink" size="50" value="<?=(!empty($_POST['sitelink']) ? display_str($_POST['sitelink']) : '')?>" />
  135. <input id="image" type="hidden" name="image" size="50" value="<?=(!empty($_POST['image']) ? display_str($_POST['image']) : '')?>" />
  136. <input id="track" type="hidden" name="track" size="8" value="<?=(!empty($_POST['track']) ? display_str($_POST['track']) : '')?>" />
  137. <input id="link" type="hidden" name="link" size="50" value="<?=(!empty($_POST['link']) ? display_str($_POST['link']) : '')?>" />
  138. <input id="extra" type="hidden" name="extra" value="<?=(!empty($_POST['extra']) ? display_str($_POST['extra']) : '')?>" />
  139. </div>
  140. </div>
  141. <input type="submit" class="button-primary" value="Report" />
  142. </form>
  143. </div>
  144. <?php View::show_footer();