qhandler.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. session_start();
  3. require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
  4. if (quarantine('hash_details', $_GET['hash']) === false && !isset($_POST)) {
  5. header('Location: /admin');
  6. exit();
  7. }
  8. require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php';
  9. if (preg_match("/^([a-f0-9]{64})$/", $_POST['quick_release']) || preg_match("/^([a-f0-9]{64})$/", $_POST['quick_delete'])) {
  10. ?>
  11. <div class="container">
  12. <div class="row">
  13. <div class="col-md-offset-2 col-md-8">
  14. <div class="panel panel-default">
  15. <div class="panel-heading"><i class="bi bi-patch-exclamation-fill"></i> <?= $lang['header']['quarantine']; ?></div>
  16. <div class="panel-body">
  17. <legend><?=(isset($_POST['quick_release'])) ? $lang['quarantine']['release'] : $lang['quarantine']['remove'];?></legend>
  18. <p><?=$lang['quarantine']['qhandler_success'];?></p>
  19. </div>
  20. </div>
  21. </div>
  22. </div> <!-- /row -->
  23. </div> <!-- /container -->
  24. <?php
  25. }
  26. elseif (in_array($_GET['action'], array('release', 'delete'))) {
  27. if (preg_match("/^([a-f0-9]{64})$/", $_GET['hash'])) {
  28. ?>
  29. <div class="container">
  30. <div class="row">
  31. <div class="col-md-offset-2 col-md-8">
  32. <div class="panel panel-default">
  33. <div class="panel-heading"><i class="bi bi-patch-exclamation-fill"></i> <?= $lang['header']['quarantine']; ?></div>
  34. <div class="panel-body">
  35. <?php
  36. if ($_GET['action'] == "release") {
  37. ?>
  38. <legend id="qtitle" data-hash="<?=$_GET['hash'];?>"><?=$lang['quarantine']['release'];?></legend>
  39. <?php
  40. }
  41. elseif ($_GET['action'] == "delete") {
  42. ?>
  43. <legend id="qtitle" data-hash="<?=$_GET['hash'];?>"><?=$lang['quarantine']['remove'];?></legend>
  44. <?php
  45. }
  46. ?>
  47. <div id="qid_error" style="display:none" class="alert alert-danger"></div>
  48. <div class="form-group">
  49. <label for="qid_detail_symbols"><h4><?=$lang['quarantine']['rspamd_result'];?>:</h4></label>
  50. <p><?=$lang['quarantine']['spam_score'];?>: <span id="qid_detail_score"></span></p>
  51. <p id="qid_detail_symbols"></p>
  52. </div>
  53. <div class="form-group">
  54. <label for="qid_detail_subj"><h4><?=$lang['quarantine']['subj'];?>:</h4></label>
  55. <p id="qid_detail_subj"></p>
  56. </div>
  57. <div class="form-group">
  58. <label for="qid_detail_hfrom"><h4><?=$lang['quarantine']['sender_header'];?>:</h4></label>
  59. <p><span class="mail-address-item" id="qid_detail_hfrom"></span></p>
  60. </div>
  61. <div class="form-group">
  62. <label for="qid_detail_efrom"><h4><?=$lang['quarantine']['sender'];?>:</h4></label>
  63. <p><span class="mail-address-item" id="qid_detail_efrom"></span></p>
  64. </div>
  65. <div class="form-group">
  66. <label for="qid_detail_recipients"><h4><?=$lang['quarantine']['recipients'];?>:</h4></label>
  67. <p id="qid_detail_recipients"></p>
  68. </div>
  69. <div class="form-group">
  70. <label for="qid_detail_fuzzy"><h4>Fuzzy Hashes:</h4></label>
  71. <p id="qid_detail_fuzzy"></p>
  72. </div>
  73. <div id="qactions">
  74. <form method="post" autofill="off">
  75. <div class="form-group">
  76. <?php
  77. if ($_GET['action'] == "release") {
  78. ?>
  79. <button type="submit" class="btn btn-success" name="quick_release" value="<?=$_GET['hash'];?>"><?= $lang['quarantine']['confirm']; ?></button>
  80. <?php
  81. }
  82. elseif ($_GET['action'] == "delete") {
  83. ?>
  84. <button type="submit" class="btn btn-success" name="quick_delete" value="<?=$_GET['hash'];?>"><?= $lang['quarantine']['confirm']; ?></button>
  85. <?php
  86. }
  87. ?>
  88. </div>
  89. </form>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </div> <!-- /row -->
  95. </div> <!-- /container -->
  96. <?php
  97. }
  98. }
  99. ?>
  100. <script type='text/javascript'>
  101. <?php
  102. $lang_quarantine = json_encode($lang['quarantine']);
  103. echo "var lang = ". $lang_quarantine . ";\n";
  104. ?>
  105. </script>
  106. <?php
  107. $js_minifier->add('/web/js/site/qhandler.js');
  108. require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
  109. ?>