From b82bf5073bd4306aa95d5a3eb8add786328fad30 Mon Sep 17 00:00:00 2001 From: andryyy Date: Fri, 19 Mar 2021 09:28:45 +0100 Subject: [PATCH] [Web] Feature: Expand alias over alias domains --- data/web/inc/functions.mailbox.inc.php | 17 +++++++++++++++++ data/web/js/site/mailbox.js | 2 +- data/web/lang/lang.de.json | 1 + data/web/lang/lang.en.json | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php index 30eae5b6..dca40a75 100644 --- a/data/web/inc/functions.mailbox.inc.php +++ b/data/web/inc/functions.mailbox.inc.php @@ -1935,6 +1935,23 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { continue; } if ($_data['expand_alias'] === true || $_data['expand_alias'] == 1) { + $stmt = $pdo->prepare("SELECT `address` FROM `alias` + WHERE `address` = :address + AND `domain` NOT IN ( + SELECT `alias_domain` FROM `alias_domain` + )"); + $stmt->execute(array( + ':address' => $address, + )); + $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); + if ($num_results == 0) { + $_SESSION['return'][] = array( + 'type' => 'warning', + 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr), + 'msg' => array('is_not_primary_alias', htmlspecialchars($address)) + ); + continue; + } $stmt = $pdo->prepare("SELECT `goto`, GROUP_CONCAT(CONCAT(SUBSTRING(`alias`.`address`, 1, LOCATE('@', `alias`.`address`) - 1), '@', `alias_domain`.`alias_domain`)) AS `missing_alias` FROM `alias` JOIN `alias_domain` ON `alias_domain`.`target_domain` = `alias`.`domain` WHERE CONCAT(SUBSTRING(`alias`.`address`, 1, LOCATE('@', `alias`.`address`) - 1), '@', `alias_domain`.`alias_domain`) NOT IN ( diff --git a/data/web/js/site/mailbox.js b/data/web/js/site/mailbox.js index ace75d49..6f1cb8d5 100644 --- a/data/web/js/site/mailbox.js +++ b/data/web/js/site/mailbox.js @@ -772,7 +772,7 @@ jQuery(function($){ {"name":"domain","title":lang.domain,"breakpoints":"xs sm"}, {"name":"public_comment","title":lang.public_comment,"breakpoints":"all"}, {"name":"private_comment","title":lang.private_comment,"breakpoints":"all"}, - {"name":"sogo_visible","title":lang.sogo_visible,"breakpoints":"all"}, + {"name":"sogo_visible","title":lang.sogo_visible,"formatter": function(value){return 1==value?'✓':0==value&&'✕';},"breakpoints":"all"}, {"name":"active","filterable": false,"style":{"maxWidth":"80px","width":"80px"},"title":lang.active,"formatter": function(value){return 1==value?'✓':0==value&&'✕';}}, {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"180px","width":"180px"},"type":"html","title":lang.action,"breakpoints":"xs sm"} ], diff --git a/data/web/lang/lang.de.json b/data/web/lang/lang.de.json index c4e5205d..f35a0738 100644 --- a/data/web/lang/lang.de.json +++ b/data/web/lang/lang.de.json @@ -1110,6 +1110,7 @@ "fuzzy_learn_error": "Fuzzy Lernfehler: %s", "hash_not_found": "Hash nicht gefunden. Möglicherweise wurde dieser bereits gelöscht.", "ip_invalid": "Ungültige IP übersprungen: %s", + "is_not_primary_alias": "Überspringe nicht-primären Alias %s", "no_active_admin": "Kann letzten aktiven Administrator nicht deaktivieren", "quota_exceeded_scope": "Domain-Quota erschöpft: Es können nur noch unlimiterte Mailboxen in dieser Domain erstellt werden.", "session_token": "Formular-Token ungültig: Token stimmt nicht überein", diff --git a/data/web/lang/lang.en.json b/data/web/lang/lang.en.json index 737faf90..981979d2 100644 --- a/data/web/lang/lang.en.json +++ b/data/web/lang/lang.en.json @@ -1108,6 +1108,7 @@ "fuzzy_learn_error": "Fuzzy hash learn error: %s", "hash_not_found": "Hash not found or already deleted", "ip_invalid": "Skipped invalid IP: %s", + "is_not_primary_alias": "Skipped non-primary alias %s", "no_active_admin": "Cannot deactivate last active admin", "quota_exceeded_scope": "Domain quota exceeded: Only unlimited mailboxes can be created in this domain scope.", "session_token": "Form token invalid: Token mismatch",