Some minor changes to Aliases handling (#3572)

* Allows to get mailbox Aliases by both ID and address
Returns ID within the msg for newly created Aliases

* Uses different query for get Aliases

* Allows to get mailbox Aliases by both ID and address
Returns ID within the msg for newly created Aliases

* Uses different query for get Aliases

* Allows to delete aliases by address

* Update lang files
Reflect id information when adding an alias

Co-authored-by: programmierus <programmierus@icloud.com>
master
Programmierus 2020-05-25 16:20:59 +02:00 committed by GitHub
parent b6933fdb96
commit e3d9a53eeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 14 additions and 12 deletions

View File

@ -777,10 +777,11 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
':active' => $active ':active' => $active
)); ));
} }
$id = $pdo->lastInsertId();
$_SESSION['return'][] = array( $_SESSION['return'][] = array(
'type' => 'success', 'type' => 'success',
'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr), 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
'msg' => array('alias_added', $address) 'msg' => array('alias_added', $address, $id)
); );
} }
break; break;
@ -3119,9 +3120,10 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
`created`, `created`,
`modified` `modified`
FROM `alias` FROM `alias`
WHERE `id` = :id AND `address` != `goto`"); WHERE (`id` = :id OR `address` = :address) AND `address` != `goto`");
$stmt->execute(array( $stmt->execute(array(
':id' => intval($_data), ':id' => $_data,
':address' => $_data,
)); ));
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt = $pdo->prepare("SELECT `target_domain` FROM `alias_domain` WHERE `alias_domain` = :domain"); $stmt = $pdo->prepare("SELECT `target_domain` FROM `alias_domain` WHERE `alias_domain` = :domain");
@ -3823,7 +3825,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
} }
$stmt = $pdo->prepare("DELETE FROM `alias` WHERE `id` = :id"); $stmt = $pdo->prepare("DELETE FROM `alias` WHERE `id` = :id");
$stmt->execute(array( $stmt->execute(array(
':id' => $id ':id' => $alias_data['id']
)); ));
$stmt = $pdo->prepare("DELETE FROM `sender_acl` WHERE `send_as` = :alias_address"); $stmt = $pdo->prepare("DELETE FROM `sender_acl` WHERE `send_as` = :alias_address");
$stmt->execute(array( $stmt->execute(array(

View File

@ -695,7 +695,7 @@
"admin_api_modified": "Změna API uložena", "admin_api_modified": "Změna API uložena",
"admin_modified": "Změny správce uloženy", "admin_modified": "Změny správce uloženy",
"admin_removed": "Správce %s odebrán", "admin_removed": "Správce %s odebrán",
"alias_added": "Byl přidán alias %s", "alias_added": "Byl přidán alias %s (%d)",
"alias_domain_removed": "Doménový alias %s odebrán", "alias_domain_removed": "Doménový alias %s odebrán",
"alias_modified": "Změny aliasu %s uloženy", "alias_modified": "Změny aliasu %s uloženy",
"alias_removed": "Alias %s odebrán", "alias_removed": "Alias %s odebrán",

View File

@ -779,7 +779,7 @@
"admin_api_modified": "Änderungen an API wurden gespeichert", "admin_api_modified": "Änderungen an API wurden gespeichert",
"admin_modified": "Änderungen am Administrator wurden gespeichert", "admin_modified": "Änderungen am Administrator wurden gespeichert",
"admin_removed": "Administrator %s wurde entfernt", "admin_removed": "Administrator %s wurde entfernt",
"alias_added": "Alias-Adresse %s wurden angelegt", "alias_added": "Alias-Adresse %s (%d) wurde angelegt",
"alias_domain_removed": "Alias-Domain %s wurde entfernt", "alias_domain_removed": "Alias-Domain %s wurde entfernt",
"alias_modified": "Änderungen an Alias %s wurden gespeichert", "alias_modified": "Änderungen an Alias %s wurden gespeichert",
"alias_removed": "Alias-Adresse %s wurde entfernt", "alias_removed": "Alias-Adresse %s wurde entfernt",

View File

@ -778,7 +778,7 @@
"admin_api_modified": "Changes to API have been saved", "admin_api_modified": "Changes to API have been saved",
"admin_modified": "Changes to administrator have been saved", "admin_modified": "Changes to administrator have been saved",
"admin_removed": "Administrator %s has been removed", "admin_removed": "Administrator %s has been removed",
"alias_added": "Alias address %s has been added", "alias_added": "Alias address %s (%d) has been added",
"alias_domain_removed": "Alias domain %s has been removed", "alias_domain_removed": "Alias domain %s has been removed",
"alias_modified": "Changes to alias address %s have been saved", "alias_modified": "Changes to alias address %s have been saved",
"alias_removed": "Alias %s has been removed", "alias_removed": "Alias %s has been removed",

View File

@ -696,7 +696,7 @@
"admin_api_modified": "API-muutokset on tallennettu", "admin_api_modified": "API-muutokset on tallennettu",
"admin_modified": "Järjestelmänvalvojan muutokset on tallennettu", "admin_modified": "Järjestelmänvalvojan muutokset on tallennettu",
"admin_removed": "Ylläpitäjä %s on poistettu", "admin_removed": "Ylläpitäjä %s on poistettu",
"alias_added": "Alias osoite %s on lisätty", "alias_added": "Alias osoite %s (%d) on lisätty",
"alias_domain_removed": "Alias verkkotunnus %s on poistettu", "alias_domain_removed": "Alias verkkotunnus %s on poistettu",
"alias_modified": "Muutokset alias osoitteseen %s on tallennettu", "alias_modified": "Muutokset alias osoitteseen %s on tallennettu",
"alias_removed": "Alias %s on poistettu", "alias_removed": "Alias %s on poistettu",

View File

@ -774,7 +774,7 @@
"admin_api_modified": "Wijzigingen aan de API zijn opgeslagen", "admin_api_modified": "Wijzigingen aan de API zijn opgeslagen",
"admin_modified": "Wijzigingen aan administrator zijn opgeslagen", "admin_modified": "Wijzigingen aan administrator zijn opgeslagen",
"admin_removed": "Administrator %s is verwijderd", "admin_removed": "Administrator %s is verwijderd",
"alias_added": "Aliasadres %s is toegevoegd", "alias_added": "Aliasadres %s (%d) is toegevoegd",
"alias_domain_removed": "Aliasdomein %s is verwijderd", "alias_domain_removed": "Aliasdomein %s is verwijderd",
"alias_modified": "Wijzigingen aan alias %s zijn opgeslagen", "alias_modified": "Wijzigingen aan alias %s zijn opgeslagen",
"alias_removed": "Alias %s is verwijderd", "alias_removed": "Alias %s is verwijderd",

View File

@ -780,7 +780,7 @@
"admin_api_modified": "Изменения в API сохранены", "admin_api_modified": "Изменения в API сохранены",
"admin_modified": "Изменения администратора сохранены", "admin_modified": "Изменения администратора сохранены",
"admin_removed": "Администратор %s удален", "admin_removed": "Администратор %s удален",
"alias_added": "Псевдоним %s добавлен", "alias_added": "Псевдоним %s (%d) добавлен",
"alias_domain_removed": "Псевдоним домена %s удален", "alias_domain_removed": "Псевдоним домена %s удален",
"alias_modified": "Изменения псевдонима %s сохранены", "alias_modified": "Изменения псевдонима %s сохранены",
"alias_removed": "Псевдоним %s удален", "alias_removed": "Псевдоним %s удален",

View File

@ -771,7 +771,7 @@
"admin_api_modified": "Zmeny v API uložené", "admin_api_modified": "Zmeny v API uložené",
"admin_modified": "Zmeny v administrácii uložené", "admin_modified": "Zmeny v administrácii uložené",
"admin_removed": "Administrátor %s odstránený ", "admin_removed": "Administrátor %s odstránený ",
"alias_added": "Alias adresa %s pridaná", "alias_added": "Alias adresa %s (%d) pridaná",
"alias_domain_removed": "Alias doména %s odstránená ", "alias_domain_removed": "Alias doména %s odstránená ",
"alias_modified": "Zmeny v alias adrese %s uložené", "alias_modified": "Zmeny v alias adrese %s uložené",
"alias_removed": "Alias %s odstránený", "alias_removed": "Alias %s odstránený",

View File

@ -778,7 +778,7 @@
"admin_api_modified": "Ändringarna på API:et har sparats", "admin_api_modified": "Ändringarna på API:et har sparats",
"admin_modified": "Ändringarna för administratören har sparats", "admin_modified": "Ändringarna för administratören har sparats",
"admin_removed": "Administratören %s har tagits bort", "admin_removed": "Administratören %s har tagits bort",
"alias_added": "Aliasadressen %s har lagts till", "alias_added": "Aliasadressen %s (%d) har lagts till",
"alias_domain_removed": "Aliasdomänen %s har tagits bort", "alias_domain_removed": "Aliasdomänen %s har tagits bort",
"alias_modified": "Ändringarna på aliasadressen %s har sparats", "alias_modified": "Ändringarna på aliasadressen %s har sparats",
"alias_removed": "Aliasadressen %s har tagits bort", "alias_removed": "Aliasadressen %s har tagits bort",