From 06193ca6252789aafadc485936ea0c0df6be6e67 Mon Sep 17 00:00:00 2001 From: andryyy Date: Sun, 12 May 2019 15:22:00 +0200 Subject: [PATCH] [Web] Write API logs when format is data binary --- data/web/json_api.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/data/web/json_api.php b/data/web/json_api.php index 8e6407b7..45963ec6 100644 --- a/data/web/json_api.php +++ b/data/web/json_api.php @@ -53,8 +53,6 @@ function api_log($_data) { } } -api_log($_POST); - if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_username'])) { if (isset($_GET['query'])) { @@ -70,7 +68,7 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u $requestDecoded = json_decode($request, true); // check for valid json - if($action != 'get' && $requestDecoded === null) { + if ($action != 'get' && $requestDecoded === null) { echo json_encode(array( 'type' => 'error', 'msg' => 'Request body doesn\'t contain valid json!' @@ -79,30 +77,27 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u } // add - if($action == 'add') { + if ($action == 'add') { $_POST['attr'] = $request; } // edit - if($action == 'edit') { + if ($action == 'edit') { $_POST['attr'] = json_encode($requestDecoded['attr']); $_POST['items'] = json_encode($requestDecoded['items']); } // delete - if($action == 'delete') { + if ($action == 'delete') { $_POST['items'] = $request; } - unset($_SESSION['return']); - unset($_SESSION['success']); - unset($_SESSION['danger']); - unset($_SESSION['error']); } + api_log($_POST); $request_incomplete = json_encode(array( - 'type' => 'error', - 'msg' => 'Cannot find attributes in post data' + 'type' => 'error', + 'msg' => 'Cannot find attributes in post data' )); switch ($action) {