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.

edit_rules.php 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. #declare(strict_types=1);
  3. enforce_login();
  4. if (!check_perms('site_moderate_forums')) {
  5. error(403);
  6. }
  7. $ForumID = $_GET['forumid'];
  8. if (!is_number($ForumID)) {
  9. error(404);
  10. }
  11. if (!empty($_POST['add']) || (!empty($_POST['del']))) {
  12. if (!empty($_POST['add'])) {
  13. if (is_number($_POST['new_thread'])) {
  14. $DB->query("
  15. INSERT INTO forums_specific_rules (ForumID, ThreadID)
  16. VALUES ($ForumID, ".$_POST['new_thread'].')');
  17. }
  18. }
  19. if (!empty($_POST['del'])) {
  20. if (is_number($_POST['threadid'])) {
  21. $DB->query("
  22. DELETE FROM forums_specific_rules
  23. WHERE ForumID = $ForumID
  24. AND ThreadID = ".$_POST['threadid']);
  25. }
  26. }
  27. $Cache->delete_value('forums_list');
  28. }
  29. $DB->query("
  30. SELECT ThreadID
  31. FROM forums_specific_rules
  32. WHERE ForumID = $ForumID");
  33. $ThreadIDs = $DB->collect('ThreadID');
  34. $ENV = ENV::go();
  35. View::show_header();
  36. ?>
  37. <div class="box pad">
  38. <div class="header">
  39. <h2>
  40. <a href="forums.php">Forums</a>
  41. <?=$ENV->CRUMB?>
  42. <a
  43. href="forums.php?action=viewforum&amp;forumid=<?=$ForumID?>"><?=$Forums[$ForumID]['Name']?></a>
  44. <?=$ENV->CRUMB?>
  45. Edit forum specific rules
  46. </h2>
  47. </div>
  48. <table>
  49. <tr class="colhead">
  50. <td>
  51. Thread ID
  52. </td>
  53. <td></td>
  54. </tr>
  55. <tr>
  56. <form class="add_form" name="forum_rules" action="" method="post">
  57. <td>
  58. <input name="new_thread" type="text" size="8" />
  59. </td>
  60. <td>
  61. <input type="submit" name="add" value="Add thread" />
  62. </td>
  63. </form>
  64. <?php foreach ($ThreadIDs as $ThreadID) { ?>
  65. <tr>
  66. <td>
  67. <?=$ThreadID?>
  68. </td>
  69. <td>
  70. <form class="delete_form" name="forum_rules" action="" method="post">
  71. <input type="hidden" name="threadid"
  72. value="<?=$ThreadID?>" />
  73. <input type="submit" name="del" value="Delete link" />
  74. </form>
  75. </td>
  76. </tr>
  77. <?php } ?>
  78. </table>
  79. </div>
  80. <?php View::show_footer();