[Web] Feature: Expand alias over alias domains

master
andryyy 2021-03-19 09:28:45 +01:00
parent a3c6c51b35
commit b82bf5073b
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
4 changed files with 20 additions and 1 deletions

View File

@ -1935,6 +1935,23 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
continue; continue;
} }
if ($_data['expand_alias'] === true || $_data['expand_alias'] == 1) { 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` $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` 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 ( WHERE CONCAT(SUBSTRING(`alias`.`address`, 1, LOCATE('@', `alias`.`address`) - 1), '@', `alias_domain`.`alias_domain`) NOT IN (

View File

@ -772,7 +772,7 @@ jQuery(function($){
{"name":"domain","title":lang.domain,"breakpoints":"xs sm"}, {"name":"domain","title":lang.domain,"breakpoints":"xs sm"},
{"name":"public_comment","title":lang.public_comment,"breakpoints":"all"}, {"name":"public_comment","title":lang.public_comment,"breakpoints":"all"},
{"name":"private_comment","title":lang.private_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":"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"} {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"180px","width":"180px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}
], ],

View File

@ -1110,6 +1110,7 @@
"fuzzy_learn_error": "Fuzzy Lernfehler: %s", "fuzzy_learn_error": "Fuzzy Lernfehler: %s",
"hash_not_found": "Hash nicht gefunden. Möglicherweise wurde dieser bereits gelöscht.", "hash_not_found": "Hash nicht gefunden. Möglicherweise wurde dieser bereits gelöscht.",
"ip_invalid": "Ungültige IP übersprungen: %s", "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", "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.", "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", "session_token": "Formular-Token ungültig: Token stimmt nicht überein",

View File

@ -1108,6 +1108,7 @@
"fuzzy_learn_error": "Fuzzy hash learn error: %s", "fuzzy_learn_error": "Fuzzy hash learn error: %s",
"hash_not_found": "Hash not found or already deleted", "hash_not_found": "Hash not found or already deleted",
"ip_invalid": "Skipped invalid IP: %s", "ip_invalid": "Skipped invalid IP: %s",
"is_not_primary_alias": "Skipped non-primary alias %s",
"no_active_admin": "Cannot deactivate last active admin", "no_active_admin": "Cannot deactivate last active admin",
"quota_exceeded_scope": "Domain quota exceeded: Only unlimited mailboxes can be created in this domain scope.", "quota_exceeded_scope": "Domain quota exceeded: Only unlimited mailboxes can be created in this domain scope.",
"session_token": "Form token invalid: Token mismatch", "session_token": "Form token invalid: Token mismatch",