Merge branch 'master' of https://github.com/mailcow/mailcow-dockerized
commit
83231ba8b5
|
@ -91,6 +91,19 @@ if (!empty($_GET['id']) && ctype_alnum($_GET['id'])) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isset($_GET['eml'])) {
|
||||||
|
$dl_filename = str_replace('/', '_', $data['subject']);
|
||||||
|
header('Pragma: public');
|
||||||
|
header('Expires: 0');
|
||||||
|
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||||
|
header('Cache-Control: private', false);
|
||||||
|
header('Content-Type: message/rfc822');
|
||||||
|
header('Content-Disposition: attachment; filename="'. $dl_filename . '.eml";');
|
||||||
|
header('Content-Transfer-Encoding: binary');
|
||||||
|
header('Content-Length: ' . strlen($mailc['msg']));
|
||||||
|
echo $mailc['msg'];
|
||||||
|
exit;
|
||||||
|
}
|
||||||
if (isset($_GET['att'])) {
|
if (isset($_GET['att'])) {
|
||||||
if ($_SESSION['acl']['quarantine_attachments'] == 0) {
|
if ($_SESSION['acl']['quarantine_attachments'] == 0) {
|
||||||
exit(json_encode('Forbidden'));
|
exit(json_encode('Forbidden'));
|
||||||
|
|
|
@ -69,6 +69,7 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
|
|
||||||
// check for valid json
|
// check for valid json
|
||||||
if ($action != 'get' && $requestDecoded === null) {
|
if ($action != 'get' && $requestDecoded === null) {
|
||||||
|
http_response_code(400);
|
||||||
echo json_encode(array(
|
echo json_encode(array(
|
||||||
'type' => 'error',
|
'type' => 'error',
|
||||||
'msg' => 'Request body doesn\'t contain valid json!'
|
'msg' => 'Request body doesn\'t contain valid json!'
|
||||||
|
@ -126,6 +127,15 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
$attr = (array)json_decode($_POST['attr'], true);
|
$attr = (array)json_decode($_POST['attr'], true);
|
||||||
unset($attr['csrf_token']);
|
unset($attr['csrf_token']);
|
||||||
}
|
}
|
||||||
|
// only allow POST requests to POST API endpoints
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
|
http_response_code(405);
|
||||||
|
echo json_encode(array(
|
||||||
|
'type' => 'error',
|
||||||
|
'msg' => 'only POST method is allowed'
|
||||||
|
));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
switch ($category) {
|
switch ($category) {
|
||||||
case "time_limited_alias":
|
case "time_limited_alias":
|
||||||
process_add_return(mailbox('add', 'time_limited_alias', $attr));
|
process_add_return(mailbox('add', 'time_limited_alias', $attr));
|
||||||
|
@ -196,12 +206,29 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
case "tls-policy-map":
|
case "tls-policy-map":
|
||||||
process_add_return(tls_policy_maps('add', $attr));
|
process_add_return(tls_policy_maps('add', $attr));
|
||||||
break;
|
break;
|
||||||
|
// return no route found if no case is matched
|
||||||
|
default:
|
||||||
|
http_response_code(404);
|
||||||
|
echo json_encode(array(
|
||||||
|
'type' => 'error',
|
||||||
|
'msg' => 'route not found'
|
||||||
|
));
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "get":
|
case "get":
|
||||||
function process_get_return($data) {
|
function process_get_return($data) {
|
||||||
echo (!isset($data) || empty($data)) ? '{}' : json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
echo (!isset($data) || empty($data)) ? '{}' : json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||||
}
|
}
|
||||||
|
// only allow GET requests to GET API endpoints
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] != 'GET') {
|
||||||
|
http_response_code(405);
|
||||||
|
echo json_encode(array(
|
||||||
|
'type' => 'error',
|
||||||
|
'msg' => 'only GET method is allowed'
|
||||||
|
));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
switch ($category) {
|
switch ($category) {
|
||||||
case "rspamd":
|
case "rspamd":
|
||||||
switch ($object) {
|
switch ($object) {
|
||||||
|
@ -561,6 +588,14 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
}
|
}
|
||||||
echo (isset($logs) && !empty($logs)) ? json_encode($logs, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) : '{}';
|
echo (isset($logs) && !empty($logs)) ? json_encode($logs, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) : '{}';
|
||||||
break;
|
break;
|
||||||
|
// return no route found if no case is matched
|
||||||
|
default:
|
||||||
|
http_response_code(404);
|
||||||
|
echo json_encode(array(
|
||||||
|
'type' => 'error',
|
||||||
|
'msg' => 'route not found'
|
||||||
|
));
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "mailbox":
|
case "mailbox":
|
||||||
|
@ -1026,9 +1061,14 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
// return no route found if no case is matched
|
||||||
default:
|
default:
|
||||||
echo '{}';
|
http_response_code(404);
|
||||||
break;
|
echo json_encode(array(
|
||||||
|
'type' => 'error',
|
||||||
|
'msg' => 'route not found'
|
||||||
|
));
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "delete":
|
case "delete":
|
||||||
|
@ -1055,6 +1095,15 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
else {
|
else {
|
||||||
$items = (array)json_decode($_POST['items'], true);
|
$items = (array)json_decode($_POST['items'], true);
|
||||||
}
|
}
|
||||||
|
// only allow POST requests to POST API endpoints
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
|
http_response_code(405);
|
||||||
|
echo json_encode(array(
|
||||||
|
'type' => 'error',
|
||||||
|
'msg' => 'only POST method is allowed'
|
||||||
|
));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
switch ($category) {
|
switch ($category) {
|
||||||
case "alias":
|
case "alias":
|
||||||
process_delete_return(mailbox('delete', 'alias', array('id' => $items)));
|
process_delete_return(mailbox('delete', 'alias', array('id' => $items)));
|
||||||
|
@ -1135,6 +1184,14 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
case "rlhash":
|
case "rlhash":
|
||||||
echo ratelimit('delete', null, implode($items));
|
echo ratelimit('delete', null, implode($items));
|
||||||
break;
|
break;
|
||||||
|
// return no route found if no case is matched
|
||||||
|
default:
|
||||||
|
http_response_code(404);
|
||||||
|
echo json_encode(array(
|
||||||
|
'type' => 'error',
|
||||||
|
'msg' => 'route not found'
|
||||||
|
));
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
|
@ -1163,6 +1220,15 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
unset($attr['csrf_token']);
|
unset($attr['csrf_token']);
|
||||||
$items = isset($_POST['items']) ? (array)json_decode($_POST['items'], true) : null;
|
$items = isset($_POST['items']) ? (array)json_decode($_POST['items'], true) : null;
|
||||||
}
|
}
|
||||||
|
// only allow POST requests to POST API endpoints
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
|
http_response_code(405);
|
||||||
|
echo json_encode(array(
|
||||||
|
'type' => 'error',
|
||||||
|
'msg' => 'only POST method is allowed'
|
||||||
|
));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
switch ($category) {
|
switch ($category) {
|
||||||
case "bcc":
|
case "bcc":
|
||||||
process_edit_return(bcc('edit', array_merge(array('id' => $items), $attr)));
|
process_edit_return(bcc('edit', array_merge(array('id' => $items), $attr)));
|
||||||
|
@ -1271,8 +1337,29 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
|
||||||
process_edit_return(edit_user_account($attr));
|
process_edit_return(edit_user_account($attr));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
// return no route found if no case is matched
|
||||||
|
default:
|
||||||
|
http_response_code(404);
|
||||||
|
echo json_encode(array(
|
||||||
|
'type' => 'error',
|
||||||
|
'msg' => 'route not found'
|
||||||
|
));
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
// return no route found if no case is matched
|
||||||
|
default:
|
||||||
|
http_response_code(404);
|
||||||
|
echo json_encode(array(
|
||||||
|
'type' => 'error',
|
||||||
|
'msg' => 'route not found'
|
||||||
|
));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_SESSION['mailcow_cc_api'] === true) {
|
||||||
|
if (isset($_SESSION['mailcow_cc_api']) && $_SESSION['mailcow_cc_api'] === true) {
|
||||||
|
unset($_SESSION['return']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -777,6 +777,7 @@ $lang['quarantine']['quarantine'] = "Quarantäne";
|
||||||
$lang['quarantine']['qinfo'] = 'Das Quarantänesystem speichert abgelehnte Nachrichten in der Datenbank. Dem Sender wird <em>nicht</em> signalisiert, dass seine E-Mail zugestellt wurde.
|
$lang['quarantine']['qinfo'] = 'Das Quarantänesystem speichert abgelehnte Nachrichten in der Datenbank. Dem Sender wird <em>nicht</em> signalisiert, dass seine E-Mail zugestellt wurde.
|
||||||
<br>"' . $lang['quarantine']['learn_spam_delete'] . '" lernt Nachrichten nach bayesscher Statistik als Spam und erstellt Fuzzy Hashes ausgehend von der jeweiligen Nachricht, um ähnliche Inhalte zukünftig zu unterbinden.
|
<br>"' . $lang['quarantine']['learn_spam_delete'] . '" lernt Nachrichten nach bayesscher Statistik als Spam und erstellt Fuzzy Hashes ausgehend von der jeweiligen Nachricht, um ähnliche Inhalte zukünftig zu unterbinden.
|
||||||
<br>Der Prozess des Lernens kann abhängig vom System zeitintensiv sein.';
|
<br>Der Prozess des Lernens kann abhängig vom System zeitintensiv sein.';
|
||||||
|
$lang['quarantine']['download_eml'] = "Herunterladen (.eml)";
|
||||||
$lang['quarantine']['release'] = "Freigeben";
|
$lang['quarantine']['release'] = "Freigeben";
|
||||||
$lang['quarantine']['empty'] = 'Keine Einträge';
|
$lang['quarantine']['empty'] = 'Keine Einträge';
|
||||||
$lang['quarantine']['toggle_all'] = 'Alle auswählen';
|
$lang['quarantine']['toggle_all'] = 'Alle auswählen';
|
||||||
|
|
|
@ -794,6 +794,7 @@ $lang['quarantine']['learn_spam_delete'] = "Learn as spam and delete";
|
||||||
$lang['quarantine']['qinfo'] = 'The quarantine system will save rejected mail to the database, while the sender will <em>not</em> be given the impression of a delivered mail.
|
$lang['quarantine']['qinfo'] = 'The quarantine system will save rejected mail to the database, while the sender will <em>not</em> be given the impression of a delivered mail.
|
||||||
<br>"' . $lang['quarantine']['learn_spam_delete'] . '" will learn a message as spam via Bayesian theorem and also calculate fuzzy hashes to deny similar messages in the future.
|
<br>"' . $lang['quarantine']['learn_spam_delete'] . '" will learn a message as spam via Bayesian theorem and also calculate fuzzy hashes to deny similar messages in the future.
|
||||||
<br>Please be aware that learning multiple messages can be - depending on your system - time consuming.';
|
<br>Please be aware that learning multiple messages can be - depending on your system - time consuming.';
|
||||||
|
$lang['quarantine']['download_eml'] = "Download (.eml)";
|
||||||
$lang['quarantine']['release'] = "Release";
|
$lang['quarantine']['release'] = "Release";
|
||||||
$lang['quarantine']['empty'] = 'No results';
|
$lang['quarantine']['empty'] = 'No results';
|
||||||
$lang['quarantine']['toggle_all'] = 'Toggle all';
|
$lang['quarantine']['toggle_all'] = 'Toggle all';
|
||||||
|
|
|
@ -46,6 +46,8 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
|
||||||
<li role="separator" class="divider"></li>
|
<li role="separator" class="divider"></li>
|
||||||
<li><a data-action="edit_selected" data-id="qitems_single" data-item="" data-api-url='edit/qitem' data-api-attr='{"action":"learnspam"}' href="#"><?=$lang['quarantine']['learn_spam_delete'];?></a></li>
|
<li><a data-action="edit_selected" data-id="qitems_single" data-item="" data-api-url='edit/qitem' data-api-attr='{"action":"learnspam"}' href="#"><?=$lang['quarantine']['learn_spam_delete'];?></a></li>
|
||||||
<li role="separator" class="divider"></li>
|
<li role="separator" class="divider"></li>
|
||||||
|
<li><a data-id="qitems_single" data-item="" onclick="window.open('/inc/ajax/qitem_details.php?id=' + $(this).data('item') + '&eml', '_blank')" href="#"><?=$lang['quarantine']['download_eml'];?></a></li>
|
||||||
|
<li role="separator" class="divider"></li>
|
||||||
<li><a data-action="delete_selected" data-id="qitems_single" data-item="" data-api-url='delete/qitem' href="#"><?=$lang['quarantine']['remove'];?></a></li>
|
<li><a data-action="delete_selected" data-id="qitems_single" data-item="" data-api-url='delete/qitem' href="#"><?=$lang['quarantine']['remove'];?></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue