소스 검색

Merge pull request #6205 from PhoenixPeca/master

Improve the existing validation flow for sieve filter
FreddleSpl0it 7 달 전
부모
커밋
2f1884e94b
2개의 변경된 파일4개의 추가작업 그리고 5개의 파일을 삭제
  1. 3 3
      data/web/inc/ajax/sieve_validation.php
  2. 1 2
      data/web/js/site/mailbox.js

+ 3 - 3
data/web/inc/ajax/sieve_validation.php

@@ -4,14 +4,14 @@ header('Content-Type: application/json');
 if (!isset($_SESSION['mailcow_cc_role'])) {
   exit();
 }
-if (isset($_GET['script'])) {
+if (isset($_REQUEST['script'])) {
   $sieve = new Sieve\SieveParser();
   try {
-    if (empty($_GET['script'])) {
+    if (empty($_REQUEST['script'])) {
       echo json_encode(array('type' => 'danger', 'msg' => $lang['danger']['script_empty']));
       exit();
     }
-    $sieve->parse($_GET['script']);
+    $sieve->parse($_REQUEST['script']);
   }
   catch (Exception $e) {
     echo json_encode(array('type' => 'danger', 'msg' => $e->getMessage()));

+ 1 - 2
data/web/js/site/mailbox.js

@@ -179,9 +179,8 @@ $(document).ready(function() {
     // Get script_data textarea content from form the button was clicked in
     var script = $('textarea[name="script_data"]', $(this).parents('form:first')).val();
     $.ajax({
-      dataType: 'json',
       url: "/inc/ajax/sieve_validation.php",
-      type: "get",
+      type: "post",
       data: { script: script },
       complete: function(data) {
         var response = (data.responseText);