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.8KB

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