check whether an email account is to be deleted when re-adding an email account with the same name, fixes #1519
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -412,10 +412,11 @@ if ($page == 'overview') {
|
||||
standard_error('notallowedtouseaccounts');
|
||||
}
|
||||
|
||||
$stmt = Database::prepare("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid`, `domainid` FROM `" . TABLE_MAIL_VIRTUAL . "`
|
||||
WHERE `customerid`= :cid
|
||||
AND `id`= :id"
|
||||
);
|
||||
$stmt = Database::prepare("
|
||||
SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid`, `domainid`
|
||||
FROM `" . TABLE_MAIL_VIRTUAL . "`
|
||||
WHERE `customerid`= :cid AND `id`= :id
|
||||
");
|
||||
$result = Database::pexecute_first($stmt, array("cid" => $userinfo['customerid'], "id" => $id));
|
||||
|
||||
if (isset($result['email']) && $result['email'] != '' && $result['popaccountid'] == '0') {
|
||||
@@ -595,7 +596,7 @@ if ($page == 'overview') {
|
||||
|
||||
if ($_mailerror) {
|
||||
$log->logAction(USR_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
|
||||
standard_error(array('errorsendingmail', $alternative_email));
|
||||
standard_error(array('errorsendingmail'), $alternative_email);
|
||||
}
|
||||
|
||||
$mail->ClearAddresses();
|
||||
@@ -604,6 +605,11 @@ if ($page == 'overview') {
|
||||
redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
|
||||
}
|
||||
} else {
|
||||
|
||||
if (checkMailAccDeletionState($result['email_full'])) {
|
||||
standard_error(array('mailaccistobedeleted'), $result['email_full']);
|
||||
}
|
||||
|
||||
$result['email_full'] = $idna_convert->decode($result['email_full']);
|
||||
$result = htmlentities_array($result);
|
||||
$quota = Settings::Get('system.mail_quota');
|
||||
|
||||
43
lib/functions/froxlor/function.checkMailAccDeletionState.php
Normal file
43
lib/functions/froxlor/function.checkMailAccDeletionState.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2016 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* check whether an email account is to be deleted
|
||||
* reference: #1519
|
||||
*
|
||||
* @return bool true if the domain is to be deleted, false otherwise
|
||||
*
|
||||
*/
|
||||
function checkMailAccDeletionState($email_addr = null)
|
||||
{
|
||||
// example data of task 7: a:2:{s:9:"loginname";s:4:"webX";s:5:"email";s:20:"deleteme@example.tld";}
|
||||
|
||||
// check for task
|
||||
$result_tasks_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_TASKS . "` WHERE `type` = '7' AND `data` LIKE :emailaddr
|
||||
");
|
||||
Database::pexecute($result_tasks_stmt, array(
|
||||
'emailaddr' => "%" . $email_addr . "%"
|
||||
));
|
||||
$num_results = Database::num_rows();
|
||||
|
||||
// is there a task for deleting this email account?
|
||||
if ($num_results > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1973,3 +1973,4 @@ $lng['domains']['termination_date'] = 'Date of termination';
|
||||
$lng['domains']['termination_date_overview'] = 'canceled until ';
|
||||
$lng['panel']['set'] = 'Apply';
|
||||
$lng['customer']['selectserveralias_addinfo'] = 'This option can be set when editing the domain. Its initial value is inherited from the parent-domain.';
|
||||
$lng['error']['mailaccistobedeleted'] = "Another account with the same name (%s) is currently being deleted and can therefore not be added at this moment.";
|
||||
|
||||
@@ -1626,3 +1626,4 @@ $lng['domains']['termination_date'] = 'Kündigungsdatum';
|
||||
$lng['domains']['termination_date_overview'] = 'gekündigt zum ';
|
||||
$lng['panel']['set'] = 'Setzen';
|
||||
$lng['customer']['selectserveralias_addinfo'] = 'Diese Option steht beim Bearbeiten der Domain zur Verfügung. Als Initial-Wert wird die Einstellung der Hauptdomain vererbt.';
|
||||
$lng['error']['mailaccistobedeleted'] = "Ein vorheriges Konto mit dem gleichen Namen (%s) wird aktuell noch gelöscht und kann daher derzeit nicht angelegt werden";
|
||||
|
||||
Reference in New Issue
Block a user