[Web] Allow to rename alias to Alias

master
andryyy 2019-05-05 20:01:53 +02:00
parent f7e5f8b51f
commit 05a2301ea6
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
1 changed files with 21 additions and 19 deletions

View File

@ -1695,25 +1695,27 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
); );
continue; continue;
} }
$stmt = $pdo->prepare("SELECT `address` FROM `alias` if (strtolower($is_now['address']) != strtolower($address)) {
WHERE `address`= :address OR `address` IN ( $stmt = $pdo->prepare("SELECT `address` FROM `alias`
SELECT `username` FROM `mailbox`, `alias_domain` WHERE `address`= :address OR `address` IN (
WHERE ( SELECT `username` FROM `mailbox`, `alias_domain`
`alias_domain`.`alias_domain` = :address_d WHERE (
AND `mailbox`.`username` = CONCAT(:address_l, '@', alias_domain.target_domain)))"); `alias_domain`.`alias_domain` = :address_d
$stmt->execute(array( AND `mailbox`.`username` = CONCAT(:address_l, '@', alias_domain.target_domain)))");
':address' => $address, $stmt->execute(array(
':address_l' => $local_part, ':address' => $address,
':address_d' => $domain ':address_l' => $local_part,
)); ':address_d' => $domain
$num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC)); ));
if ($num_results != 0) { $num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
$_SESSION['return'][] = array( if ($num_results != 0) {
'type' => 'danger', $_SESSION['return'][] = array(
'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr), 'type' => 'danger',
'msg' => array('is_alias_or_mailbox', htmlspecialchars($address)) 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr),
); 'msg' => array('is_alias_or_mailbox', htmlspecialchars($address))
continue; );
continue;
}
} }
$stmt = $pdo->prepare("SELECT `domain` FROM `domain` $stmt = $pdo->prepare("SELECT `domain` FROM `domain`
WHERE `domain`= :domain1 OR `domain` = (SELECT `target_domain` FROM `alias_domain` WHERE `alias_domain` = :domain2)"); WHERE `domain`= :domain1 OR `domain` = (SELECT `target_domain` FROM `alias_domain` WHERE `alias_domain` = :domain2)");