Merge pull request #2569 from Howaner/quarantine-domain-alias
Added domain alias handling to quarantine mails and added recipients row to quarantine mail displaymaster
commit
48984270dd
|
@ -131,6 +131,14 @@ foreach (json_decode($rcpts, true) as $rcpt) {
|
||||||
));
|
));
|
||||||
$gotos = $stmt->fetch(PDO::FETCH_ASSOC)['goto'];
|
$gotos = $stmt->fetch(PDO::FETCH_ASSOC)['goto'];
|
||||||
}
|
}
|
||||||
|
if (empty($gotos)) {
|
||||||
|
$stmt = $pdo->prepare("SELECT `target_domain` FROM `alias_domain` WHERE `alias_domain` = :rcpt AND `active` = '1'");
|
||||||
|
$stmt->execute(array(':rcpt' => $parsed_rcpt['domain']));
|
||||||
|
$goto_branch = $stmt->fetch(PDO::FETCH_ASSOC)['target_domain'];
|
||||||
|
if ($goto_branch) {
|
||||||
|
$gotos = $parsed_rcpt['local'] . '@' . $goto_branch;
|
||||||
|
}
|
||||||
|
}
|
||||||
$gotos_array = explode(',', $gotos);
|
$gotos_array = explode(',', $gotos);
|
||||||
|
|
||||||
$loop_c = 0;
|
$loop_c = 0;
|
||||||
|
@ -159,8 +167,18 @@ foreach (json_decode($rcpts, true) as $rcpt) {
|
||||||
$stmt = $pdo->prepare("SELECT `goto` FROM `alias` WHERE `address` = :goto AND `active` = '1'");
|
$stmt = $pdo->prepare("SELECT `goto` FROM `alias` WHERE `address` = :goto AND `active` = '1'");
|
||||||
$stmt->execute(array(':goto' => $goto));
|
$stmt->execute(array(':goto' => $goto));
|
||||||
$goto_branch = $stmt->fetch(PDO::FETCH_ASSOC)['goto'];
|
$goto_branch = $stmt->fetch(PDO::FETCH_ASSOC)['goto'];
|
||||||
error_log("QUARANTINE: quarantine pipe: goto address " . $goto . " is a alias branch for " . $goto_branch);
|
if ($goto_branch) {
|
||||||
$goto_branch_array = explode(',', $goto_branch);
|
error_log("QUARANTINE: quarantine pipe: goto address " . $goto . " is a alias branch for " . $goto_branch);
|
||||||
|
$goto_branch_array = explode(',', $goto_branch);
|
||||||
|
} else {
|
||||||
|
$stmt = $pdo->prepare("SELECT `target_domain` FROM `alias_domain` WHERE `alias_domain` = :domain AND `active` AND '1'");
|
||||||
|
$stmt->execute(array(':domain' => $parsed_goto['domain']));
|
||||||
|
$goto_branch = $stmt->fetch(PDO::FETCH_ASSOC)['target_domain'];
|
||||||
|
if ($goto_branch) {
|
||||||
|
error_log("QUARANTINE: quarantine pipe: goto domain " . $parsed_gto['domain'] . " is a domain alias branch for " . $goto_branch);
|
||||||
|
$goto_branch_array = array($parsed_gto['local'] . '@' . $goto_branch);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// goto item was processed, unset
|
// goto item was processed, unset
|
||||||
|
|
|
@ -48,4 +48,12 @@ table.footable>tbody>tr.footable-empty>td {
|
||||||
background-color: #d4d4d4;
|
background-color: #d4d4d4;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span.mail-address-item {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 2px 7px;
|
||||||
|
margin-right: 7px;
|
||||||
|
}
|
||||||
|
|
|
@ -3,8 +3,9 @@ session_start();
|
||||||
header("Content-Type: application/json");
|
header("Content-Type: application/json");
|
||||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
|
||||||
if (!isset($_SESSION['mailcow_cc_role'])) {
|
if (!isset($_SESSION['mailcow_cc_role'])) {
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
function rrmdir($src) {
|
function rrmdir($src) {
|
||||||
$dir = opendir($src);
|
$dir = opendir($src);
|
||||||
while(false !== ( $file = readdir($dir)) ) {
|
while(false !== ( $file = readdir($dir)) ) {
|
||||||
|
@ -21,6 +22,13 @@ function rrmdir($src) {
|
||||||
closedir($dir);
|
closedir($dir);
|
||||||
rmdir($src);
|
rmdir($src);
|
||||||
}
|
}
|
||||||
|
function addAddresses(&$list, $mail, $headerName) {
|
||||||
|
$addresses = $mail->getAddresses($headerName);
|
||||||
|
foreach ($addresses as $address) {
|
||||||
|
$list[] = array('address' => $address['address'], 'type' => $headerName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($_GET['id']) && ctype_alnum($_GET['id'])) {
|
if (!empty($_GET['id']) && ctype_alnum($_GET['id'])) {
|
||||||
$tmpdir = '/tmp/' . $_GET['id'] . '/';
|
$tmpdir = '/tmp/' . $_GET['id'] . '/';
|
||||||
$mailc = quarantine('details', $_GET['id']);
|
$mailc = quarantine('details', $_GET['id']);
|
||||||
|
@ -36,6 +44,16 @@ if (!empty($_GET['id']) && ctype_alnum($_GET['id'])) {
|
||||||
$html2text = new Html2Text\Html2Text();
|
$html2text = new Html2Text\Html2Text();
|
||||||
// Load msg to parser
|
// Load msg to parser
|
||||||
$mail_parser->setText($mailc['msg']);
|
$mail_parser->setText($mailc['msg']);
|
||||||
|
|
||||||
|
// Get mail recipients
|
||||||
|
{
|
||||||
|
$recipientsList = array();
|
||||||
|
addAddresses($recipientsList, $mail_parser, 'to');
|
||||||
|
addAddresses($recipientsList, $mail_parser, 'cc');
|
||||||
|
addAddresses($recipientsList, $mail_parser, 'bcc');
|
||||||
|
$data['recipients'] = $recipientsList;
|
||||||
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
|
|
@ -87,8 +87,17 @@ 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_recipients').html('');
|
||||||
|
if (typeof data.recipients !== 'undefined') {
|
||||||
|
$.each(data.recipients, function(index, value) {
|
||||||
|
var elem = $('<span class="mail-address-item"></span>');
|
||||||
|
elem.text(value.address + (value.type != 'to' ? (' (' + value.type.toUpperCase() + ')') : ''));
|
||||||
|
$('#qid_detail_recipients').append(elem);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var qAtts = $("#qid_detail_atts");
|
||||||
if (typeof data.attachments !== 'undefined') {
|
if (typeof data.attachments !== 'undefined') {
|
||||||
qAtts = $("#qid_detail_atts");
|
|
||||||
qAtts.text('');
|
qAtts.text('');
|
||||||
$.each(data.attachments, function(index, value) {
|
$.each(data.attachments, function(index, value) {
|
||||||
qAtts.append(
|
qAtts.append(
|
||||||
|
|
|
@ -498,6 +498,7 @@ $lang['quarantine']['show_item'] = "Mostrar";
|
||||||
$lang['quarantine']['check_hash'] = "Comprovar el hash del fitxer a VT";
|
$lang['quarantine']['check_hash'] = "Comprovar el hash del fitxer a VT";
|
||||||
$lang['quarantine']['qitem'] = "Element en quarantena";
|
$lang['quarantine']['qitem'] = "Element en quarantena";
|
||||||
$lang['quarantine']['subj'] = "Assumpte";
|
$lang['quarantine']['subj'] = "Assumpte";
|
||||||
|
$lang['quarantine']['recipients'] = "Recipients";
|
||||||
$lang['quarantine']['text_plain_content'] = "Contingut (text/plain)";
|
$lang['quarantine']['text_plain_content'] = "Contingut (text/plain)";
|
||||||
$lang['quarantine']['text_from_html_content'] = "Contingut (a partir del HTML)";
|
$lang['quarantine']['text_from_html_content'] = "Contingut (a partir del HTML)";
|
||||||
$lang['quarantine']['atts'] = "Adjunts";
|
$lang['quarantine']['atts'] = "Adjunts";
|
||||||
|
|
|
@ -712,6 +712,7 @@ $lang['quarantine']['show_item'] = "Zobrazit položku";
|
||||||
$lang['quarantine']['check_hash'] = "Hledat hash @ VT souboru";
|
$lang['quarantine']['check_hash'] = "Hledat hash @ VT souboru";
|
||||||
$lang['quarantine']['qitem'] = "Položka v karanténě";
|
$lang['quarantine']['qitem'] = "Položka v karanténě";
|
||||||
$lang['quarantine']['subj'] = "Předmět";
|
$lang['quarantine']['subj'] = "Předmět";
|
||||||
|
$lang['quarantine']['recipients'] = "Příjemci";
|
||||||
$lang['quarantine']['text_plain_content'] = "Obsah (text/plain)";
|
$lang['quarantine']['text_plain_content'] = "Obsah (text/plain)";
|
||||||
$lang['quarantine']['text_from_html_content'] = "Obsah (konvertované html)";
|
$lang['quarantine']['text_from_html_content'] = "Obsah (konvertované html)";
|
||||||
$lang['quarantine']['atts'] = "Přílohy";
|
$lang['quarantine']['atts'] = "Přílohy";
|
||||||
|
|
|
@ -732,6 +732,7 @@ $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']['subj'] = "Betreff";
|
$lang['quarantine']['subj'] = "Betreff";
|
||||||
|
$lang['quarantine']['recipients'] = "Empfänger";
|
||||||
$lang['quarantine']['text_plain_content'] = "Inhalt (text/plain)";
|
$lang['quarantine']['text_plain_content'] = "Inhalt (text/plain)";
|
||||||
$lang['quarantine']['text_from_html_content'] = "Inhalt (html, konvertiert)";
|
$lang['quarantine']['text_from_html_content'] = "Inhalt (html, konvertiert)";
|
||||||
$lang['quarantine']['atts'] = "Anhänge";
|
$lang['quarantine']['atts'] = "Anhänge";
|
||||||
|
|
|
@ -754,6 +754,7 @@ $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']['subj'] = "Subject";
|
$lang['quarantine']['subj'] = "Subject";
|
||||||
|
$lang['quarantine']['recipients'] = "Recipients";
|
||||||
$lang['quarantine']['text_plain_content'] = "Content (text/plain)";
|
$lang['quarantine']['text_plain_content'] = "Content (text/plain)";
|
||||||
$lang['quarantine']['text_from_html_content'] = "Content (converted html)";
|
$lang['quarantine']['text_from_html_content'] = "Content (converted html)";
|
||||||
$lang['quarantine']['atts'] = "Attachments";
|
$lang['quarantine']['atts'] = "Attachments";
|
||||||
|
|
|
@ -494,6 +494,7 @@ $lang['quarantine']['show_item'] = "Parādīt vienumus";
|
||||||
$lang['quarantine']['check_hash'] = "Meklēt faila hašu @ VT";
|
$lang['quarantine']['check_hash'] = "Meklēt faila hašu @ VT";
|
||||||
$lang['quarantine']['qitem'] = "Karantīnas vienumi";
|
$lang['quarantine']['qitem'] = "Karantīnas vienumi";
|
||||||
$lang['quarantine']['subj'] = "Priekšmets";
|
$lang['quarantine']['subj'] = "Priekšmets";
|
||||||
|
$lang['quarantine']['recipients'] = "Adresāts";
|
||||||
$lang['quarantine']['text_plain_content'] = "Saturs (teksts/vienkāršs)";
|
$lang['quarantine']['text_plain_content'] = "Saturs (teksts/vienkāršs)";
|
||||||
$lang['quarantine']['text_from_html_content'] = "Saturs (konvertēts html)";
|
$lang['quarantine']['text_from_html_content'] = "Saturs (konvertēts html)";
|
||||||
$lang['quarantine']['atts'] = "Pielikumi";
|
$lang['quarantine']['atts'] = "Pielikumi";
|
||||||
|
|
|
@ -731,6 +731,7 @@ $lang['quarantine']['show_item'] = "Laat item zien";
|
||||||
$lang['quarantine']['check_hash'] = "Zoek bestandshash op in VT";
|
$lang['quarantine']['check_hash'] = "Zoek bestandshash op in VT";
|
||||||
$lang['quarantine']['qitem'] = "Quarantaine-item";
|
$lang['quarantine']['qitem'] = "Quarantaine-item";
|
||||||
$lang['quarantine']['subj'] = "Onderwerp";
|
$lang['quarantine']['subj'] = "Onderwerp";
|
||||||
|
$lang['quarantine']['recipients'] = "Ontvangers";
|
||||||
$lang['quarantine']['text_plain_content'] = "Inhoud (tekst)";
|
$lang['quarantine']['text_plain_content'] = "Inhoud (tekst)";
|
||||||
$lang['quarantine']['text_from_html_content'] = "Inhoud (geconverteerde html)";
|
$lang['quarantine']['text_from_html_content'] = "Inhoud (geconverteerde html)";
|
||||||
$lang['quarantine']['atts'] = "Bijlagen";
|
$lang['quarantine']['atts'] = "Bijlagen";
|
||||||
|
|
|
@ -17,6 +17,10 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
|
||||||
<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>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="qid_detail_recipients"><h4><?=$lang['quarantine']['recipients'];?>:</h4></label>
|
||||||
|
<p id="qid_detail_recipients"></p>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="qid_detail_text"><h4><?=$lang['quarantine']['text_plain_content'];?>:</h4></label>
|
<label for="qid_detail_text"><h4><?=$lang['quarantine']['text_plain_content'];?>:</h4></label>
|
||||||
<pre id="qid_detail_text"></pre>
|
<pre id="qid_detail_text"></pre>
|
||||||
|
|
Loading…
Reference in New Issue