Skip to content

Commit b658fe8

Browse files
committed
Fixed: Module > Email > Email Mailbox > Mailfilter custom_mailfilter is missing in English
Fixed: Several php notices for undefined indexes.
1 parent cc0a1a5 commit b658fe8

File tree

2 files changed

+75
-69
lines changed

2 files changed

+75
-69
lines changed
Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1-
<?php
2-
$wb["custom_mailfilter_txt"] = 'custom_mailfilter';
3-
$wb["btn_save_txt"] = 'Save';
4-
$wb["btn_cancel_txt"] = 'Cancel';
5-
$wb["email_txt"] = 'Email';
6-
$wb["cryptpwd_txt"] = 'Password';
7-
$wb["active_txt"] = 'Active';
8-
$wb["email_error_isemail"] = 'Email address is invalid.';
9-
$wb["email_error_unique"] = 'Duplicate Emailaddress.';
10-
$wb["autoresponder_text_txt"] = 'Text';
11-
$wb["autoresponder_txt"] = 'Autoresponder';
12-
$wb["no_domain_perm"] = 'You have no permission for this domain.';
13-
$wb["error_no_pwd"] = 'Password is empty.';
14-
$wb["quota_error_isint"] = 'Mailbox size must be a number.';
15-
$wb["quota_txt"] = 'quota';
16-
$wb["server_id_txt"] = 'server_id';
17-
$wb["password_txt"] = 'password';
18-
$wb["maildir_txt"] = 'maildir';
19-
$wb["postfix_txt"] = 'Enable Receiving';
20-
$wb["access_txt"] = 'Enable Access';
21-
$wb["policy_txt"] = 'Spamfilter';
22-
$wb["no_policy"] = '- not enabled -';
23-
$wb["limit_mailbox_txt"] = 'The max. number of mailboxes for your account is reached.';
24-
$wb["limit_mailquota_txt"] = 'The max space for mailboxes is reached. The max. available space in MB is';
25-
$wb["welcome_mail_subject"] = 'Welcome to your new email account.';
26-
$wb["welcome_mail_message"] = 'Welcome to your new email account.
27-
28-
Your webmaster.';
1+
<?php
2+
$wb["custom_mailfilter_txt"] = 'custom_mailfilter';
3+
$wb["btn_save_txt"] = 'Save';
4+
$wb["btn_cancel_txt"] = 'Cancel';
5+
$wb["email_txt"] = 'Email';
6+
$wb["cryptpwd_txt"] = 'Password';
7+
$wb["active_txt"] = 'Active';
8+
$wb["email_error_isemail"] = 'Email address is invalid.';
9+
$wb["email_error_unique"] = 'Duplicate Emailaddress.';
10+
$wb["autoresponder_text_txt"] = 'Text';
11+
$wb["autoresponder_txt"] = 'Autoresponder';
12+
$wb["no_domain_perm"] = 'You have no permission for this domain.';
13+
$wb["error_no_pwd"] = 'Password is empty.';
14+
$wb["quota_error_isint"] = 'Mailbox size must be a number.';
15+
$wb["quota_txt"] = 'quota';
16+
$wb["server_id_txt"] = 'server_id';
17+
$wb["password_txt"] = 'password';
18+
$wb["maildir_txt"] = 'maildir';
19+
$wb["postfix_txt"] = 'Enable Receiving';
20+
$wb["access_txt"] = 'Enable Access';
21+
$wb["policy_txt"] = 'Spamfilter';
22+
$wb["no_policy"] = '- not enabled -';
23+
$wb["limit_mailbox_txt"] = 'The max. number of mailboxes for your account is reached.';
24+
$wb["limit_mailquota_txt"] = 'The max space for mailboxes is reached. The max. available space in MB is';
25+
$wb["welcome_mail_subject"] = 'Welcome to your new email account.';
26+
$wb["welcome_mail_message"] = 'Welcome to your new email account.\n\nYour webmaster.';
27+
$wb['custom_mailfilter_txt'] = 'Custom mail filter recipe';
2928
?>

interface/web/mail/mail_user_edit.php

Lines changed: 48 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@ function onSubmit() {
123123
global $app, $conf;
124124

125125
// Check if Domain belongs to user
126-
$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
127-
if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
126+
if(isset($_POST["email_domain"])) {
127+
$domain = $app->db->queryOneRecord("SELECT server_id, domain FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
128+
if($domain["domain"] != $_POST["email_domain"]) $app->tform->errorMessage .= $app->tform->wordbook["no_domain_perm"];
129+
}
128130

129131

130132
// if its an insert, check that the password is not empty
@@ -166,25 +168,28 @@ function onSubmit() {
166168

167169

168170
// compose the email field
169-
$this->dataRecord["email"] = $_POST["email_local_part"]."@".$_POST["email_domain"];
170-
// Set the server id of the mailbox = server ID of mail domain.
171-
$this->dataRecord["server_id"] = $domain["server_id"];
171+
if(isset($_POST["email_local_part"]) && isset($_POST["email_domain"])) {
172+
$this->dataRecord["email"] = $_POST["email_local_part"]."@".$_POST["email_domain"];
173+
174+
// Set the server id of the mailbox = server ID of mail domain.
175+
$this->dataRecord["server_id"] = $domain["server_id"];
172176

173-
unset($this->dataRecord["email_local_part"]);
174-
unset($this->dataRecord["email_domain"]);
177+
unset($this->dataRecord["email_local_part"]);
178+
unset($this->dataRecord["email_domain"]);
175179

176-
// Convert quota from MB to Bytes
177-
$this->dataRecord["quota"] = $this->dataRecord["quota"] * 1024 * 1024;
180+
// Convert quota from MB to Bytes
181+
$this->dataRecord["quota"] = $this->dataRecord["quota"] * 1024 * 1024;
178182

179-
// setting Maildir, Homedir, UID and GID
180-
$app->uses('getconf');
181-
$mail_config = $app->getconf->get_server_config($domain["server_id"],'mail');
182-
$maildir = str_replace("[domain]",$domain["domain"],$mail_config["maildir_path"]);
183-
$maildir = str_replace("[localpart]",$_POST["email_local_part"],$maildir);
184-
$this->dataRecord["maildir"] = $maildir;
185-
$this->dataRecord["homedir"] = $mail_config["homedir_path"];
186-
$this->dataRecord["uid"] = $mail_config["mailuser_uid"];
187-
$this->dataRecord["gid"] = $mail_config["mailuser_gid"];
183+
// setting Maildir, Homedir, UID and GID
184+
$app->uses('getconf');
185+
$mail_config = $app->getconf->get_server_config($domain["server_id"],'mail');
186+
$maildir = str_replace("[domain]",$domain["domain"],$mail_config["maildir_path"]);
187+
$maildir = str_replace("[localpart]",$_POST["email_local_part"],$maildir);
188+
$this->dataRecord["maildir"] = $maildir;
189+
$this->dataRecord["homedir"] = $mail_config["homedir_path"];
190+
$this->dataRecord["uid"] = $mail_config["mailuser_uid"];
191+
$this->dataRecord["gid"] = $mail_config["mailuser_gid"];
192+
}
188193

189194

190195
parent::onSubmit();
@@ -222,30 +227,32 @@ function onAfterUpdate() {
222227
global $app, $conf;
223228

224229
// Set the domain owner as mailbox owner
225-
$domain = $app->db->queryOneRecord("SELECT sys_groupid, server_id FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
226-
$app->db->query("UPDATE mail_user SET sys_groupid = ".$domain["sys_groupid"]." WHERE mailuser_id = ".$this->id);
230+
if(isset($_POST["email_domain"])) {
231+
$domain = $app->db->queryOneRecord("SELECT sys_groupid, server_id FROM mail_domain WHERE domain = '".$app->db->quote($_POST["email_domain"])."' AND ".$app->tform->getAuthSQL('r'));
232+
$app->db->query("UPDATE mail_user SET sys_groupid = ".$domain["sys_groupid"]." WHERE mailuser_id = ".$this->id);
227233

228-
// Spamfilter policy
229-
$policy_id = intval($this->dataRecord["policy"]);
230-
$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".addslashes($this->dataRecord["email"])."'");
231-
if($policy_id > 0) {
232-
if($tmp_user["id"] > 0) {
233-
// There is already a record that we will update
234-
$sql = "UPDATE spamfilter_users SET policy_id = $policy_id WHERE id = ".$tmp_user["id"];
235-
$app->db->query($sql);
236-
} else {
237-
// We create a new record
238-
$sql = "INSERT INTO `spamfilter_users` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`)
239-
VALUES (".$_SESSION["s"]["user"]["userid"].", ".$domain["sys_groupid"].", 'riud', 'riud', '', ".$domain["server_id"].", 1, ".$policy_id.", '".addslashes($this->dataRecord["email"])."', '".addslashes($this->dataRecord["email"])."', 'Y')";
240-
$app->db->query($sql);
241-
}
242-
}else {
243-
if($tmp_user["id"] > 0) {
244-
// There is already a record but the user shall have no policy, so we delete it
245-
$sql = "DELETE FROM spamfilter_users WHERE id = ".$tmp_user["id"];
246-
$app->db->query($sql);
247-
}
248-
} // endif spamfilter policy
234+
// Spamfilter policy
235+
$policy_id = intval($this->dataRecord["policy"]);
236+
$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".addslashes($this->dataRecord["email"])."'");
237+
if($policy_id > 0) {
238+
if($tmp_user["id"] > 0) {
239+
// There is already a record that we will update
240+
$sql = "UPDATE spamfilter_users SET policy_id = $policy_id WHERE id = ".$tmp_user["id"];
241+
$app->db->query($sql);
242+
} else {
243+
// We create a new record
244+
$sql = "INSERT INTO `spamfilter_users` (`sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `server_id`, `priority`, `policy_id`, `email`, `fullname`, `local`)
245+
VALUES (".$_SESSION["s"]["user"]["userid"].", ".$domain["sys_groupid"].", 'riud', 'riud', '', ".$domain["server_id"].", 1, ".$policy_id.", '".addslashes($this->dataRecord["email"])."', '".addslashes($this->dataRecord["email"])."', 'Y')";
246+
$app->db->query($sql);
247+
}
248+
}else {
249+
if($tmp_user["id"] > 0) {
250+
// There is already a record but the user shall have no policy, so we delete it
251+
$sql = "DELETE FROM spamfilter_users WHERE id = ".$tmp_user["id"];
252+
$app->db->query($sql);
253+
}
254+
} // endif spamfilter policy
255+
}
249256

250257
}
251258

0 commit comments

Comments
 (0)