Oppaitime'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.

expunge_requests.php 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?
  2. if (!check_perms('users_mod')) {
  3. error(403);
  4. }
  5. $QueryID = $DB->query("
  6. SELECT SQL_CALC_FOUND_ROWS *
  7. FROM deletion_requests");
  8. $DB->query("SELECT FOUND_ROWS()");
  9. list($NumResults) = $DB->next_record();
  10. $DB->set_query_id($QueryID);
  11. $Requests = $DB->to_array();
  12. if (isset($_GET['deny']) && isset($_GET['type']) && isset($_GET['value'])) {
  13. authorize();
  14. $Deny = ($_GET['deny'] == 'true');
  15. $Type = $_GET['type'] == 'email' ? 'Email' : ($_GET['type'] == 'ip' ? 'IP' : '');
  16. $Value = db_string($_GET['value']);
  17. $DB->query("
  18. DELETE FROM deletion_requests
  19. WHERE Value = '$Value'");
  20. $DB->query("
  21. SELECT UserID
  22. FROM users_history_".strtolower($Type)."s
  23. WHERE $Type = '$Value'");
  24. if ($DB->has_results()) {
  25. list($UserID) = $DB->next_record();
  26. if ($UserID != $_GET['userid']) {
  27. $Err = "The specified UserID is incorrect.";
  28. }
  29. } else {
  30. $Err = "That $Type doesn't exist.";
  31. }
  32. if (empty($Err)) {
  33. if (!$Deny) {
  34. $DB->query("
  35. SELECT $Type
  36. FROM users_history_".strtolower($Type)."s
  37. WHERE UserID = '$UserID'");
  38. $ToDelete = [];
  39. while (list($EncValue) = $DB->next_record()) {
  40. if (Crypto::decrypt($Value) == Crypto::decrypt($EncValue)) {
  41. $ToDelete[] = $EncValue;
  42. }
  43. }
  44. forEach ($ToDelete as $DelValue) {
  45. $DB->query("
  46. DELETE FROM users_history_".strtolower($Type)."s
  47. WHERE UserID = $UserID
  48. AND $Type = '$DelValue'");
  49. }
  50. $Succ = "$Type deleted.";
  51. Misc::send_pm($UserID, 0, "$Type Deletion Request Accepted.", "Your deletion request has been accepted. What $Type? I don't know! We don't have it anymore!");
  52. } else {
  53. $Succ = "Request denied.";
  54. Misc::send_pm($UserID, 0, "$Type Deletion Request Denied.", "Your deletion request has been denied.\n\nIf you wish to discuss this matter further, please create a staff PM, or join ".BOT_HELP_CHAN." on IRC to speak with a staff member.");
  55. }
  56. }
  57. $Cache->delete_value('num_deletion_requests');
  58. }
  59. View::show_header("Expunge Requests");
  60. ?>
  61. <div class="header">
  62. <h2>Expunge Requests</h2>
  63. </div>
  64. <? if (isset($Err)) { ?>
  65. <span>Error: <?=$Err?></span>
  66. <? } elseif (isset($Succ)) { ?>
  67. <span>Success: <?=$Succ?></span>
  68. <? } ?>
  69. <div class="thin">
  70. <table width="100%">
  71. <tr class="colhead">
  72. <td>User</td>
  73. <td>Type</td>
  74. <td>Value</td>
  75. <td>Reason</td>
  76. <td>Accept</td>
  77. <td>Deny</td>
  78. </tr>
  79. <? foreach ($Requests as $Request) { ?>
  80. <tr>
  81. <td><?=Users::format_username($Request['UserID'])?></td>
  82. <td><?=$Request['Type']?></td>
  83. <td><?=Crypto::decrypt($Request['Value'])?></td>
  84. <td><?=display_str($Request['Reason'])?></td>
  85. <td><a href="tools.php?action=expunge_requests&auth=<?=$LoggedUser['AuthKey']?>&type=<?=strtolower($Request['Type'])?>&value=<?=urlencode($Request['Value'])?>&userid=<?=$Request['UserID']?>&deny=false" class="brackets">Accept</a></td>
  86. <td><a href="tools.php?action=expunge_requests&auth=<?=$LoggedUser['AuthKey']?>&type=<?=strtolower($Request['Type'])?>&value=<?=urlencode($Request['Value'])?>&userid=<?=$Request['UserID']?>&deny=true" class="brackets">Deny</a></td>
  87. </tr>
  88. <? } ?>
  89. </table>
  90. </div>
  91. <? View::show_footer(); ?>