diff --git a/interface/web/mail/lib/lang/en_mail_alias.lng b/interface/web/mail/lib/lang/en_mail_alias.lng index c912bca461483143e67844511e2bd1ce03cd99df..d7c5e7a076d5751aaa9d96d33b94203b5b09957d 100644 --- a/interface/web/mail/lib/lang/en_mail_alias.lng +++ b/interface/web/mail/lib/lang/en_mail_alias.lng @@ -7,4 +7,5 @@ $wb["email_error_unique"] = 'Duplicate Emailaddress.'; $wb["no_domain_perm"] = "You have no permission for this domain."; $wb["destination_error_isemail"] = 'Destination Emailaddress is invalid.'; $wb["limit_mailalias_txt"] = 'The max. number of email aliases for your account is reached.'; +$wb["duplicate_mailbox_txt"] = 'There is already a mailbox with this email address'; ?> \ No newline at end of file diff --git a/interface/web/mail/lib/lang/en_mail_forward.lng b/interface/web/mail/lib/lang/en_mail_forward.lng index ca1764d808f31ab5dbed8b7c434969349eb4112d..dee6271537d2b1b98609fcaa28c5b3140264773f 100644 --- a/interface/web/mail/lib/lang/en_mail_forward.lng +++ b/interface/web/mail/lib/lang/en_mail_forward.lng @@ -3,4 +3,5 @@ $wb["email_txt"] = 'Email'; $wb["destination_txt"] = 'Destination Email'; $wb["active_txt"] = 'Active'; $wb["limit_mailforward_txt"] = 'The max. number of email forwarders for your account is reached.'; +$wb["duplicate_mailbox_txt"] = 'There is already a mailbox with this email address'; ?> \ No newline at end of file diff --git a/interface/web/mail/lib/lang/en_mail_user.lng b/interface/web/mail/lib/lang/en_mail_user.lng index c6db506090f6755f1fcef4cb3c636ffda72d0f1e..65ee78a77fdc0c1ca0eb8089851afdc360b78105 100644 --- a/interface/web/mail/lib/lang/en_mail_user.lng +++ b/interface/web/mail/lib/lang/en_mail_user.lng @@ -27,4 +27,5 @@ $wb["welcome_mail_subject"] = 'Welcome to your new email account.'; $wb["welcome_mail_message"] = "Welcome to your new email account. Your webmaster."; $wb["disableimap_txt"] = 'Disable IMAP'; $wb["disablepop3_txt"] = 'Disable POP3'; +$wb["duplicate_alias_or_forward_txt"] = 'There is already an alias or forwrd with this email address.'; ?> diff --git a/interface/web/mail/mail_alias_edit.php b/interface/web/mail/mail_alias_edit.php index 641d60984db7eee40a315e5e475be17aff7ca4c6..65c05c95e9d7fe17ca7d22c19cb42a3214c452fd 100644 --- a/interface/web/mail/mail_alias_edit.php +++ b/interface/web/mail/mail_alias_edit.php @@ -1,6 +1,6 @@ dataRecord["email_local_part"]); unset($this->dataRecord["email_domain"]); + //* Check if there is no mailbox with this address + $tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE email = '".$app->db->quote($this->dataRecord["source"])."'"); + if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("duplicate_mailbox_txt")."
"; + unset($tmp); + parent::onSubmit(); } diff --git a/interface/web/mail/mail_forward_edit.php b/interface/web/mail/mail_forward_edit.php index b6871aa4ed1c76abebf264596dd80d154e7de30a..efc83da8182c7dbe0340edb39105463efed04533 100644 --- a/interface/web/mail/mail_forward_edit.php +++ b/interface/web/mail/mail_forward_edit.php @@ -1,6 +1,6 @@ dataRecord["email_local_part"]); unset($this->dataRecord["email_domain"]); + //* Check if there is no mailbox with this address + $tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE email = '".$app->db->quote($this->dataRecord["source"])."'"); + if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("duplicate_mailbox_txt")."
"; + unset($tmp); + parent::onSubmit(); } diff --git a/interface/web/mail/mail_user_edit.php b/interface/web/mail/mail_user_edit.php index 5a746bc63234b4d8b5dd6bf7898c0f3a27073f0c..f46a1a505d98aa74da5db1014a4a9bd11d0b9c66 100644 --- a/interface/web/mail/mail_user_edit.php +++ b/interface/web/mail/mail_user_edit.php @@ -1,6 +1,6 @@ db->queryOneRecord("SELECT policy_id FROM spamfilter_users WHERE email = '".$this->dataRecord["email"]."'"); $sql = "SELECT id, policy_name FROM spamfilter_policy WHERE ".$app->tform->getAuthSQL('r'); $policys = $app->db->queryAllRecords($sql); - $policy_select = ""; + $policy_select = ""; if(is_array($policys)) { foreach( $policys as $p) { $selected = ($p["id"] == $tmp_user["policy_id"])?'SELECTED':''; @@ -119,19 +119,19 @@ class page_action extends tform_actions { function onSubmit() { global $app, $conf; - // Check if Domain belongs to user + //* Check if Domain belongs to user if(isset($_POST["email_domain"])) { $domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r')); - if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"]; + if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->lng("no_domain_perm"); } - // if its an insert, check that the password is not empty + //* if its an insert, check that the password is not empty if($this->id == 0 && $_POST["password"] == '') { - $app->tform->errorMessage .= $app->tform->wordbook["error_no_pwd"]."
"; + $app->tform->errorMessage .= $app->tform->lng("error_no_pwd")."
"; } - // Check the client limits, if user is not the admin + //* Check the client limits, if user is not the admin if($_SESSION["s"]["user"]["typ"] != 'admin') { // if user is not admin // Get the limits of the client $client_group_id = $_SESSION["s"]["user"]["default_group"]; @@ -142,7 +142,7 @@ class page_action extends tform_actions { if($this->id == 0 && $client["limit_mailbox"] >= 0) { $tmp = $app->db->queryOneRecord("SELECT count(mailuser_id) as number FROM mail_user WHERE sys_groupid = $client_group_id"); if($tmp["number"] >= $client["limit_mailbox"]) { - $app->tform->errorMessage .= $app->tform->wordbook["limit_mailbox_txt"]."
"; + $app->tform->errorMessage .= $app->tform->lng("limit_mailbox_txt")."
"; } unset($tmp); } @@ -154,7 +154,7 @@ class page_action extends tform_actions { $new_mailbox_quota = intval($this->dataRecord["quota"]); if($mailquota + $new_mailbox_quota > $client["limit_mailquota"]) { $max_free_quota = $client["limit_mailquota"] - $mailquota; - $app->tform->errorMessage .= $app->tform->wordbook["limit_mailquota_txt"].": ".$max_free_quota."
"; + $app->tform->errorMessage .= $app->tform->lng("limit_mailquota_txt").": ".$max_free_quota."
"; // Set the quota field to the max free space $this->dataRecord["quota"] = $max_free_quota; } @@ -164,7 +164,7 @@ class page_action extends tform_actions { } // end if user is not admin - // compose the email field + //* compose the email field if(isset($_POST["email_local_part"]) && isset($_POST["email_domain"])) { $this->dataRecord["email"] = $_POST["email_local_part"]."@".$_POST["email_domain"]; @@ -186,8 +186,13 @@ class page_action extends tform_actions { $this->dataRecord["homedir"] = $mail_config["homedir_path"]; $this->dataRecord["uid"] = $mail_config["mailuser_uid"]; $this->dataRecord["gid"] = $mail_config["mailuser_gid"]; + + //* Check if there is no alias or forward with this address + $tmp = $app->db->queryOneRecord("SELECT count(forwarding_id) as number FROM mail_forwarding WHERE source = '".$app->db->quote($this->dataRecord["email"])."'"); + if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("duplicate_alias_or_forward_txt")."
"; + unset($tmp); + } - parent::onSubmit(); } @@ -203,23 +208,23 @@ class page_action extends tform_actions { // mail($this->dataRecord["email"],$app->tform->wordbook["welcome_mail_subject"],$app->tform->wordbook["welcome_mail_message"]); // tries to detect current charset, and encode subject-header and body from it to ISO-8859-1. - $fromCharset = mb_detect_encoding($app->tform->wordbook["welcome_mail_subject"]); + $fromCharset = mb_detect_encoding($app->tform->lng("welcome_mail_subject")); $iconvPreferences = array("input-charset" => $fromCharset, "output-charset" => "ISO-8859-1", "line-length" => 76, "line-break-chars" => "\n", "scheme" => "Q"); - $welcomeFromName = $app->tform->wordbook["welcome_mail_fromname_txt"]; - $welcomeFromEmail = $app->tform->wordbook["welcome_mail_fromemail_txt"]; + $welcomeFromName = $app->tform->lng("welcome_mail_fromname_txt"); + $welcomeFromEmail = $app->tform->lng("welcome_mail_fromemail_txt"); $mailHeaders = "MIME-Version: 1.0" . "\n"; $mailHeaders .= "Content-type: text/plain; charset=iso-8859-1" . "\n"; $mailHeaders .= "From: $welcomeFromName <$welcomeFromEmail>" . "\n"; $mailHeaders .= "Reply-To: <$welcomeFromEmail>" . "\n"; $mailTarget = $this->dataRecord["email"]; - $mailSubject = iconv_mime_encode("trimoff", $app->tform->wordbook["welcome_mail_subject"], $iconvPreferences); + $mailSubject = iconv_mime_encode("trimoff", $app->tform->lng("welcome_mail_subject"), $iconvPreferences); $mailSubject = str_replace("trimoff: ", "", $mailSubject); - $mailBody = iconv ($fromCharset, "ISO-8859-1", $app->tform->wordbook["welcome_mail_message"]); + $mailBody = iconv ($fromCharset, "ISO-8859-1", $app->tform->lng("welcome_mail_message")); mail($mailTarget, $mailSubject, $mailBody, $mailHeaders);