[Web] Write API logs when format is data binary

master
andryyy 2019-05-12 15:22:00 +02:00
parent ff1b57315d
commit 06193ca625
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
1 changed files with 7 additions and 12 deletions

View File

@ -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) {