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 8.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <?php
  2. #declare(strict_types = 1);
  3. include SERVER_ROOT.'/sections/reports/array.php';
  4. if (empty($_GET['type']) || empty($_GET['id']) || !is_number($_GET['id'])) {
  5. error(404);
  6. }
  7. if (!array_key_exists($_GET['type'], $Types)) {
  8. error(403);
  9. }
  10. $Short = $_GET['type'];
  11. $Type = $Types[$Short];
  12. $ID = $_GET['id'];
  13. switch ($Short) {
  14. case 'user':
  15. $DB->query("
  16. SELECT Username
  17. FROM users_main
  18. WHERE ID = $ID");
  19. if (!$DB->has_results()) {
  20. error(404);
  21. }
  22. list($Username) = $DB->next_record();
  23. break;
  24. case 'request_update':
  25. $NoReason = true;
  26. $DB->query("
  27. SELECT Title, Description, TorrentID, CategoryID, Year
  28. FROM requests
  29. WHERE ID = $ID");
  30. if (!$DB->has_results()) {
  31. error(404);
  32. }
  33. list($Name, $Desc, $Filled, $CategoryID, $Year) = $DB->next_record();
  34. if ($Filled || ($CategoryID != 0 && ($Categories[$CategoryID - 1] != 'Music' || $Year != 0))) {
  35. error(403);
  36. }
  37. break;
  38. case 'request':
  39. $DB->query("
  40. SELECT Title, Description, TorrentID
  41. FROM requests
  42. WHERE ID = $ID");
  43. if (!$DB->has_results()) {
  44. error(404);
  45. }
  46. list($Name, $Desc, $Filled) = $DB->next_record();
  47. break;
  48. case 'collage':
  49. $DB->query("
  50. SELECT Name, Description
  51. FROM collages
  52. WHERE ID = $ID");
  53. if (!$DB->has_results()) {
  54. error(404);
  55. }
  56. list($Name, $Desc) = $DB->next_record();
  57. break;
  58. case 'thread':
  59. $DB->query("
  60. SELECT ft.Title, ft.ForumID, um.Username
  61. FROM forums_topics AS ft
  62. JOIN users_main AS um ON um.ID = ft.AuthorID
  63. WHERE ft.ID = $ID");
  64. if (!$DB->has_results()) {
  65. error(404);
  66. }
  67. list($Title, $ForumID, $Username) = $DB->next_record();
  68. $DB->query("
  69. SELECT MinClassRead
  70. FROM forums
  71. WHERE ID = $ForumID");
  72. list($MinClassRead) = $DB->next_record();
  73. if (!empty($LoggedUser['DisableForums'])
  74. || ($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0))
  75. || (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
  76. error(403);
  77. }
  78. break;
  79. case 'post':
  80. $DB->query("
  81. SELECT fp.Body, fp.TopicID, um.Username
  82. FROM forums_posts AS fp
  83. JOIN users_main AS um ON um.ID = fp.AuthorID
  84. WHERE fp.ID = $ID");
  85. if (!$DB->has_results()) {
  86. error(404);
  87. }
  88. list($Body, $TopicID, $Username) = $DB->next_record();
  89. $DB->query("
  90. SELECT ForumID
  91. FROM forums_topics
  92. WHERE ID = $TopicID");
  93. list($ForumID) = $DB->next_record();
  94. $DB->query("
  95. SELECT MinClassRead
  96. FROM forums
  97. WHERE ID = $ForumID");
  98. list($MinClassRead) = $DB->next_record();
  99. if (!empty($LoggedUser['DisableForums'])
  100. || ($MinClassRead > $LoggedUser['EffectiveClass'] && (!isset($LoggedUser['CustomForums'][$ForumID]) || $LoggedUser['CustomForums'][$ForumID] == 0))
  101. || (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] == 0)) {
  102. error(403);
  103. }
  104. break;
  105. case 'comment':
  106. $DB->query("
  107. SELECT c.Body, um.Username
  108. FROM comments AS c
  109. JOIN users_main AS um ON um.ID = c.AuthorID
  110. WHERE c.ID = $ID");
  111. if (!$DB->has_results()) {
  112. error(404);
  113. }
  114. list($Body, $Username) = $DB->next_record();
  115. break;
  116. }
  117. View::show_header(
  118. 'Report a '.$Type['title'],
  119. 'bbcode,vendor/jquery.validate.min,form_validate'
  120. );
  121. ?>
  122. <div class="thin">
  123. <div class="header">
  124. <h2>Report <?=$Type['title']?>
  125. </h2>
  126. </div>
  127. <h3>Reporting guidelines</h3>
  128. <div class="box pad">
  129. <p>Following these guidelines will help the moderators deal with your report in a timely fashion. </p>
  130. <ul>
  131. <?php foreach ($Type['guidelines'] as $Guideline) { ?>
  132. <li><?=$Guideline?>
  133. </li>
  134. <?php } ?>
  135. </ul>
  136. <p>In short, please include as much detail as possible when reporting. Thank you. </p>
  137. </div>
  138. <?php
  139. switch ($Short) {
  140. case 'user':
  141. ?>
  142. <p>You are reporting the user <strong><?=display_str($Username)?></strong></p>
  143. <?php
  144. break;
  145. case 'request_update':
  146. ?>
  147. <p>You are reporting the request:</p>
  148. <table class="box">
  149. <tr class="colhead">
  150. <td>Title</td>
  151. <td>Description</td>
  152. <td>Filled?</td>
  153. </tr>
  154. <tr>
  155. <td><?=display_str($Name)?>
  156. </td>
  157. <td><?=Text::full_format($Desc)?>
  158. </td>
  159. <td><strong><?=($Filled == 0 ? 'No' : 'Yes')?></strong>
  160. </td>
  161. </tr>
  162. </table>
  163. <br />
  164. <div class="box pad center">
  165. <p><strong>It will greatly increase the turnover rate of the updates if you can fill in as much of the following
  166. details as possible.</strong></p>
  167. <form class="create_form" id="report_form" name="report" action="" method="post">
  168. <input type="hidden" name="action" value="takereport" />
  169. <input type="hidden" name="auth"
  170. value="<?=$LoggedUser['AuthKey']?>" />
  171. <input type="hidden" name="id" value="<?=$ID?>" />
  172. <input type="hidden" name="type" value="<?=$Short?>" />
  173. <table class="layout">
  174. <tr>
  175. <td class="label">Year (required)</td>
  176. <td>
  177. <input type="text" size="4" name="year" class="required" />
  178. </td>
  179. </tr>
  180. <tr>
  181. <td class="label">Release type</td>
  182. <td>
  183. <select id="releasetype" name="releasetype">
  184. <option value="0">---</option>
  185. <?php foreach ($ReleaseTypes as $Key => $Val) { ?>
  186. <option value="<?=$Key?>" <?=(!empty($ReleaseType) ? ($Key == $ReleaseType ? ' selected="selected"' : '') : '')?>><?=$Val?>
  187. </option>
  188. <?php } ?>
  189. </select>
  190. </td>
  191. </tr>
  192. <tr>
  193. <td class="label">Comment</td>
  194. <td>
  195. <textarea rows="8" cols="80" name="comment" class="required"></textarea>
  196. </td>
  197. </tr>
  198. </table>
  199. <br />
  200. <br />
  201. <input type="submit" value="Submit report" />
  202. </form>
  203. </div>
  204. <?php
  205. break;
  206. case 'request':
  207. ?>
  208. <p>You are reporting the request:</p>
  209. <table class="box">
  210. <tr class="colhead">
  211. <td>Title</td>
  212. <td>Description</td>
  213. <td>Filled?</td>
  214. </tr>
  215. <tr>
  216. <td><?=display_str($Name)?>
  217. </td>
  218. <td><?=Text::full_format($Desc)?>
  219. </td>
  220. <td><strong><?=($Filled == 0 ? 'No' : 'Yes')?></strong>
  221. </td>
  222. </tr>
  223. </table>
  224. <?php
  225. break;
  226. case 'collage':
  227. ?>
  228. <p>You are reporting the collection:</p>
  229. <table class="box">
  230. <tr class="colhead">
  231. <td>Title</td>
  232. <td>Description</td>
  233. </tr>
  234. <tr>
  235. <td><?=display_str($Name)?>
  236. </td>
  237. <td><?=Text::full_format($Desc)?>
  238. </td>
  239. </tr>
  240. </table>
  241. <?php
  242. break;
  243. case 'thread':
  244. ?>
  245. <p>You are reporting the thread:</p>
  246. <table>
  247. <tr class="colhead">
  248. <td>Username</td>
  249. <td>Title</td>
  250. </tr>
  251. <tr>
  252. <td><?=display_str($Username)?>
  253. </td>
  254. <td><?=display_str($Title)?>
  255. </td>
  256. </tr>
  257. </table>
  258. <?php
  259. break;
  260. case 'post':
  261. ?>
  262. <p>You are reporting the post:</p>
  263. <table>
  264. <tr class="colhead">
  265. <td>Username</td>
  266. <td>Body</td>
  267. </tr>
  268. <tr>
  269. <td><?=display_str($Username)?>
  270. </td>
  271. <td><?=Text::full_format($Body)?>
  272. </td>
  273. </tr>
  274. </table>
  275. <?php
  276. break;
  277. case 'comment':
  278. ?>
  279. <p>You are reporting the <?=$Types[$Short]['title']?>:</p>
  280. <table class="box">
  281. <tr class="colhead">
  282. <td>Username</td>
  283. <td>Body</td>
  284. </tr>
  285. <tr>
  286. <td><?=display_str($Username)?>
  287. </td>
  288. <td><?=Text::full_format($Body)?>
  289. </td>
  290. </tr>
  291. </table>
  292. <?php
  293. break;
  294. }
  295. if (empty($NoReason)) {
  296. ?>
  297. <h3>Reason</h3>
  298. <div class="box pad center">
  299. <form class="create_form" name="report" id="report_form" action="" method="post">
  300. <input type="hidden" name="action" value="takereport" />
  301. <input type="hidden" name="auth"
  302. value="<?=$LoggedUser['AuthKey']?>" />
  303. <input type="hidden" name="id" value="<?=$ID?>" />
  304. <input type="hidden" name="type" value="<?=$Short?>" />
  305. <textarea class="required" rows="10" cols="95" name="reason"></textarea><br /><br />
  306. <input type="submit" value="Submit report" />
  307. </form>
  308. </div>
  309. <?php
  310. }
  311. // close <div class="thin">?>
  312. </div>
  313. <?php
  314. View::show_footer();