diff --git a/data/web/inc/ajax/queue_manager.php b/data/web/inc/ajax/queue_manager.php deleted file mode 100644 index 8ae5cb35..00000000 --- a/data/web/inc/ajax/queue_manager.php +++ /dev/null @@ -1,16 +0,0 @@ - 'mailq')); - -if (isset($docker_return['type']['danger'])) { - echo "Cannot load mail queue: " . $docker_return['msg']; -} -else { - echo $docker_return; -} -?> diff --git a/data/web/inc/functions.mailq.inc.php b/data/web/inc/functions.mailq.inc.php index 24de47be..b980d7c8 100644 --- a/data/web/inc/functions.mailq.inc.php +++ b/data/web/inc/functions.mailq.inc.php @@ -10,64 +10,98 @@ function mailq($_action, $_data = null) { } function process_mailq_output($returned_output, $_action, $_data) { if ($returned_output !== NULL) { - if (isset($returned_output['type']) && $returned_output['type'] == 'danger') { - $_SESSION['return'][] = array( - 'type' => 'danger', - 'log' => array('mailq', $_action, $_data), - 'msg' => 'Error: ' . $returned_output['msg'] - ); + if ($_action == 'cat') { + logger(array('return' => array( + array( + 'type' => 'success', + 'log' => array(__FUNCTION__, $_action, $_data), + 'msg' => 'queue_cat_success' + ) + ))); + return $returned_output; } - if (isset($returned_output['type']) && $returned_output['type'] == 'success') { - $_SESSION['return'][] = array( - 'type' => 'success', - 'log' => array('mailq', $_action, $_data), - 'msg' => 'queue_command_success' - ); + else { + if (isset($returned_output['type']) && $returned_output['type'] == 'danger') { + $_SESSION['return'][] = array( + 'type' => 'danger', + 'log' => array(__FUNCTION__, $_action, $_data), + 'msg' => 'Error: ' . $returned_output['msg'] + ); + } + if (isset($returned_output['type']) && $returned_output['type'] == 'success') { + $_SESSION['return'][] = array( + 'type' => 'success', + 'log' => array(__FUNCTION__, $_action, $_data), + 'msg' => 'queue_command_success' + ); + } } } else { $_SESSION['return'][] = array( 'type' => 'danger', - 'log' => array('mailq', $_action, $_data), + 'log' => array(__FUNCTION__, $_action, $_data), 'msg' => 'unknown' ); } } global $lang; - switch ($_action) { - case 'get': - $mailq_lines = docker('post', 'postfix-mailcow', 'exec', array('cmd' => 'mailq', 'task' => 'list')); - $lines = 0; - // Hard limit to 10000 items - foreach (preg_split("/((\r?\n)|(\r\n?))/", $mailq_lines) as $mailq_item) if ($lines++ < 10000) { - if (empty($mailq_item) || $mailq_item == '1') { - continue; - } - $mq_line = json_decode($mailq_item, true); - if ($mq_line !== NULL) { - $rcpts = array(); - foreach ($mq_line['recipients'] as $rcpt) { - if (isset($rcpt['delay_reason'])) { - $rcpts[] = $rcpt['address'] . ' (' . $rcpt['delay_reason'] . ')'; - } - else { - $rcpts[] = $rcpt['address']; - } + if ($_action == 'get') { + $mailq_lines = docker('post', 'postfix-mailcow', 'exec', array('cmd' => 'mailq', 'task' => 'list')); + $lines = 0; + // Hard limit to 10000 items + foreach (preg_split("/((\r?\n)|(\r\n?))/", $mailq_lines) as $mailq_item) if ($lines++ < 10000) { + if (empty($mailq_item) || $mailq_item == '1') { + continue; + } + $mq_line = json_decode($mailq_item, true); + if ($mq_line !== NULL) { + $rcpts = array(); + foreach ($mq_line['recipients'] as $rcpt) { + if (isset($rcpt['delay_reason'])) { + $rcpts[] = $rcpt['address'] . ' (' . $rcpt['delay_reason'] . ')'; } - if (!empty($rcpts)) { - $mq_line['recipients'] = $rcpts; + else { + $rcpts[] = $rcpt['address']; } - $line[] = $mq_line; } + if (!empty($rcpts)) { + $mq_line['recipients'] = $rcpts; + } + $line[] = $mq_line; } - if (!isset($line) || empty($line)) { - return '{}'; - } - else { - return json_encode($line); - } - break; - case 'delete': + } + if (!isset($line) || empty($line)) { + return '{}'; + } + else { + return json_encode($line); + } + } + elseif ($_action == 'delete') { + if (!is_array($_data['qid'])) { + $qids = array(); + $qids[] = $_data['qid']; + } + else { + $qids = $_data['qid']; + } + $docker_return = docker('post', 'postfix-mailcow', 'exec', array('cmd' => 'mailq', 'task' => 'delete', 'items' => $qids)); + process_mailq_output(json_decode($docker_return, true), $_action, $_data); + } + elseif ($_action == 'cat') { + if (!is_array($_data['qid'])) { + $qids = array(); + $qids[] = $_data['qid']; + } + else { + $qids = $_data['qid']; + } + $docker_return = docker('post', 'postfix-mailcow', 'exec', array('cmd' => 'mailq', 'task' => 'cat', 'items' => $qids)); + return process_mailq_output($docker_return, $_action, $_data); + } + elseif ($_action == 'edit') { + if (in_array($_data['action'], array('hold', 'unhold', 'deliver'))) { if (!is_array($_data['qid'])) { $qids = array(); $qids[] = $_data['qid']; @@ -75,30 +109,14 @@ function mailq($_action, $_data = null) { else { $qids = $_data['qid']; } - $docker_return = docker('post', 'postfix-mailcow', 'exec', array('cmd' => 'mailq', 'task' => 'delete', 'items' => $qids)); - process_mailq_output(json_decode($docker_return, true), $_action, $_data); - break; - case 'edit': - if (in_array($_data['action'], array('hold', 'unhold', 'deliver'))) { - if (!is_array($_data['qid'])) { - $qids = array(); - $qids[] = $_data['qid']; - } - else { - $qids = $_data['qid']; - } - if (!empty($qids)) { - $docker_return = docker('post', 'postfix-mailcow', 'exec', array('cmd' => 'mailq', 'task' => $_data['action'], 'items' => $qids)); - process_mailq_output(json_decode($docker_return, true), $_action, $_data); - } - } - if (in_array($_data['action'], array('flush', 'super_delete'))) { - $docker_return = docker('post', 'postfix-mailcow', 'exec', array('cmd' => 'mailq', 'task' => $_data['action'])); + if (!empty($qids)) { + $docker_return = docker('post', 'postfix-mailcow', 'exec', array('cmd' => 'mailq', 'task' => $_data['action'], 'items' => $qids)); process_mailq_output(json_decode($docker_return, true), $_action, $_data); } - break; - case 'get': - // todo: move get from json_api here - break; + } + if (in_array($_data['action'], array('flush', 'super_delete'))) { + $docker_return = docker('post', 'postfix-mailcow', 'exec', array('cmd' => 'mailq', 'task' => $_data['action'])); + process_mailq_output(json_decode($docker_return, true), $_action, $_data); + } } } diff --git a/data/web/js/site/admin.js b/data/web/js/site/admin.js index c0428deb..6ca76635 100644 --- a/data/web/js/site/admin.js +++ b/data/web/js/site/admin.js @@ -248,6 +248,7 @@ jQuery(function($){ }}, {"name":"sender","title":lang.sender, "type": "text","breakpoints":"xs sm"}, {"name":"recipients","title":lang.recipients, "type": "text","style":{"word-break":"break-all","min-width":"300px"},"breakpoints":"xs sm md"}, + {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"220px","width":"220px"},"type":"html","title":lang.action,"breakpoints":"xs sm md"} ], "rows": $.ajax({ dataType: 'json', @@ -301,6 +302,9 @@ jQuery(function($){ return escapeHtml(i); }); item.recipients = rcpts.join('
smtp_tls_mandatory_protocols
und smtp_tls_mandatory_ciphers
.",
"tls_policy_maps_long": "Ausgehende TLS-Richtlinien",
"toggle_all": "Alle",
"username": "Benutzername",
diff --git a/data/web/lang/lang.en.json b/data/web/lang/lang.en.json
index 11a2b7d3..b21c3924 100644
--- a/data/web/lang/lang.en.json
+++ b/data/web/lang/lang.en.json
@@ -230,6 +230,7 @@
"queue_manager": "Queue manager",
"queue_unban": "queue unban",
"queue_unhold_mail": "Unhold",
+ "queue_show_message": "Show message",
"quota_notification_html": "Notification email template:smtp_tls_mandatory_protocols
and smtp_tls_mandatory_ciphers
.",
"tls_policy_maps_long": "Outgoing TLS policy map overrides",
"toggle_all": "Toggle all",
"username": "Username",
diff --git a/data/web/mailbox.php b/data/web/mailbox.php
index 366aea09..cabeec4b 100644
--- a/data/web/mailbox.php
+++ b/data/web/mailbox.php
@@ -498,6 +498,7 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
=$lang['mailbox']['tls_policy_maps_info'];?>
+=$lang['mailbox']['tls_policy_maps_enforced_tls'];?>