andryyy 2019-10-09 22:24:52 +02:00
commit 88a32f025a
7 changed files with 82 additions and 6 deletions

View File

@ -1,40 +1,49 @@
table.footable>tbody>tr.footable-empty>td { table.footable>tbody>tr.footable-empty>td {
font-size:15px !important; font-size: 15px !important;
font-style:italic; font-style: italic;
} }
.pagination a { .pagination a {
text-decoration: none !important; text-decoration: none !important;
} }
.panel panel-default { .panel panel-default {
overflow: visible !important; overflow: visible !important;
} }
.table-responsive { .table-responsive {
overflow: visible !important; overflow: visible !important;
} }
@media screen and (max-width: 767px) { @media screen and (max-width: 767px) {
.table-responsive { .table-responsive {
overflow-x: scroll !important; overflow-x: scroll !important;
} }
} }
.footer-add-item { .footer-add-item {
display:block; display: block;
text-align: center; text-align: center;
font-style: italic; font-style: italic;
padding: 10px; padding: 10px;
background: #F5F5F5; background: #F5F5F5;
} }
@media (min-width: 992px) { @media (min-width: 992px) {
.container { .container {
width: 80%; width: 80%;
} }
} }
.mass-actions-quarantine { .mass-actions-quarantine {
user-select: none; user-select: none;
padding:10px 0 10px 10px; padding: 10px 0 10px 10px;
} }
.inputMissingAttr { .inputMissingAttr {
border-color: #FF4136; border-color: #FF4136;
} }
.dot-danger { .dot-danger {
height: 10px; height: 10px;
width: 10px; width: 10px;
@ -42,6 +51,7 @@ table.footable>tbody>tr.footable-empty>td {
border-radius: 50%; border-radius: 50%;
display: inline-block; display: inline-block;
} }
.dot-neutral { .dot-neutral {
height: 10px; height: 10px;
width: 10px; width: 10px;
@ -50,6 +60,44 @@ table.footable>tbody>tr.footable-empty>td {
display: inline-block; display: inline-block;
} }
.modal#qidDetailModal p {
word-break: break-all;
}
span#qid_detail_score {
font-weight: 700;
margin-left: 5px;
}
span.rspamd-symbol {
display: inline-block;
margin: 2px 6px 2px 0px;
border-radius: 4px;
padding: 0px 7px;
}
span.rspamd-symbol.positive {
background: #4CAF50;
border: 1px solid #4CAF50;
color: white;
}
span.rspamd-symbol.negative {
background: #ff4136;
border: 1px solid #ff4136;
color: white;
}
span.rspamd-symbol.neutral {
background: #f5f5f5;
color: #333;
border: 1px solid #ccc;
}
span.rspamd-symbol span.score {
font-weight: 700;
}
span.mail-address-item { span.mail-address-item {
background-color: #f5f5f5; background-color: #f5f5f5;
border-radius: 4px; border-radius: 4px;

View File

@ -54,6 +54,10 @@ if (!empty($_GET['id']) && ctype_alnum($_GET['id'])) {
$data['recipients'] = $recipientsList; $data['recipients'] = $recipientsList;
} }
// Get rspamd score
$data['score'] = $mailc['score'];
// Get rspamd symbols
$data['symbols'] = json_decode($mailc['symbols']);
// Get text/plain content // Get text/plain content
$data['text_plain'] = $mail_parser->getMessageBody('text'); $data['text_plain'] = $mail_parser->getMessageBody('text');
// Get html content and convert to text // Get html content and convert to text

View File

@ -678,7 +678,7 @@ function quarantine($_action, $_data = null) {
if (!is_numeric($_data) || empty($_data)) { if (!is_numeric($_data) || empty($_data)) {
return false; return false;
} }
$stmt = $pdo->prepare('SELECT `rcpt`, `symbols`, `msg`, `domain` FROM `quarantine` WHERE `id`= :id'); $stmt = $pdo->prepare('SELECT `rcpt`, `score`, `symbols`, `msg`, `domain` FROM `quarantine` WHERE `id`= :id');
$stmt->execute(array(':id' => $_data)); $stmt->execute(array(':id' => $_data));
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
if (hasMailboxObjectAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $row['rcpt'])) { if (hasMailboxObjectAccess($_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role'], $row['rcpt'])) {

View File

@ -92,6 +92,23 @@ jQuery(function($){
$('#qid_detail_text').text(data.text_plain); $('#qid_detail_text').text(data.text_plain);
$('#qid_detail_text_from_html').text(data.text_html); $('#qid_detail_text_from_html').text(data.text_html);
$('#qid_detail_score').text(data.score);
$('#qid_detail_symbols').html('');
if (typeof data.symbols !== 'undefined') {
data.symbols.sort(function (a, b) {
if (a.score === 0) return 1
if (b.score === 0) return -1
return b.score - a.score
})
$.each(data.symbols, function (index, value) {
var highlightClass = ''
if (value.score > 0) highlightClass = 'negative'
else if (value.score < 0) highlightClass = 'positive'
else highlightClass = 'neutral'
$('#qid_detail_symbols').append('<span class="rspamd-symbol ' + highlightClass + '" title="' + (value.options ? value.options.join(', ') : '') + '">' + value.name + ' (<span class="score">' + value.score + '</span>)</span>');
});
}
$('#qid_detail_recipients').html(''); $('#qid_detail_recipients').html('');
if (typeof data.recipients !== 'undefined') { if (typeof data.recipients !== 'undefined') {
$.each(data.recipients, function(index, value) { $.each(data.recipients, function(index, value) {

View File

@ -791,6 +791,7 @@ $lang['quarantine']['sender'] = "Sender";
$lang['quarantine']['show_item'] = "Details"; $lang['quarantine']['show_item'] = "Details";
$lang['quarantine']['check_hash'] = "Checksumme auf VirusTotal suchen"; $lang['quarantine']['check_hash'] = "Checksumme auf VirusTotal suchen";
$lang['quarantine']['qitem'] = "Quarantäneeintrag"; $lang['quarantine']['qitem'] = "Quarantäneeintrag";
$lang['quarantine']['rspamd_result'] = "Rspamd Ergebnis";
$lang['quarantine']['subj'] = "Betreff"; $lang['quarantine']['subj'] = "Betreff";
$lang['quarantine']['recipients'] = "Empfänger"; $lang['quarantine']['recipients'] = "Empfänger";
$lang['quarantine']['text_plain_content'] = "Inhalt (text/plain)"; $lang['quarantine']['text_plain_content'] = "Inhalt (text/plain)";

View File

@ -808,6 +808,7 @@ $lang['quarantine']['sender'] = "Sender";
$lang['quarantine']['show_item'] = "Show item"; $lang['quarantine']['show_item'] = "Show item";
$lang['quarantine']['check_hash'] = "Search file hash @ VT"; $lang['quarantine']['check_hash'] = "Search file hash @ VT";
$lang['quarantine']['qitem'] = "Quarantine item"; $lang['quarantine']['qitem'] = "Quarantine item";
$lang['quarantine']['rspamd_result'] = "Rspamd result";
$lang['quarantine']['subj'] = "Subject"; $lang['quarantine']['subj'] = "Subject";
$lang['quarantine']['recipients'] = "Recipients"; $lang['quarantine']['recipients'] = "Recipients";
$lang['quarantine']['text_plain_content'] = "Content (text/plain)"; $lang['quarantine']['text_plain_content'] = "Content (text/plain)";

View File

@ -13,6 +13,11 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div id="qid_error" style="display:none" class="alert alert-danger"></div> <div id="qid_error" style="display:none" class="alert alert-danger"></div>
<div class="form-group">
<label for="qid_detail_symbols"><h4><?=$lang['quarantine']['rspamd_result'];?>:</h4></label>
<p><?=$lang['quarantine']['spam_score'];?>: <span id="qid_detail_score"></span></p>
<p id="qid_detail_symbols"></p>
</div>
<div class="form-group"> <div class="form-group">
<label for="qid_detail_subj"><h4><?=$lang['quarantine']['subj'];?>:</h4></label> <label for="qid_detail_subj"><h4><?=$lang['quarantine']['subj'];?>:</h4></label>
<p id="qid_detail_subj"></p> <p id="qid_detail_subj"></p>