Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISPConfig
ISPConfig 3
Commits
94a020dd
Commit
94a020dd
authored
Jan 08, 2008
by
tbrehm
Browse files
Email forwardings are renamed when a email domain is renamed.
parent
7ea3df9a
Changes
2
Hide whitespace changes
Inline
Side-by-side
interface/web/mail/mail_alias_edit.php
View file @
94a020dd
...
...
@@ -88,7 +88,7 @@ class page_action extends tform_actions {
$domain_select
=
''
;
if
(
is_array
(
$domains
))
{
foreach
(
$domains
as
$domain
)
{
$selected
=
(
$domain
[
"domain"
]
==
$email_parts
[
1
])
?
'SELECTED'
:
''
;
$selected
=
(
$domain
[
"domain"
]
==
@
$email_parts
[
1
])
?
'SELECTED'
:
''
;
$domain_select
.
=
"<option value='
$domain[domain]
'
$selected
>
$domain[domain]
</option>
\r\n
"
;
}
}
...
...
interface/web/mail/mail_domain_edit.php
View file @
94a020dd
...
...
@@ -221,6 +221,8 @@ class page_action extends tform_actions {
if
(
$this
->
oldDataRecord
[
'domain'
]
!=
$this
->
dataRecord
[
'domain'
])
{
$app
->
uses
(
'getconf'
);
$mail_config
=
$app
->
getconf
->
get_server_config
(
$this
->
dataRecord
[
"server_id"
],
'mail'
);
//* Update the mailboxes
$mailusers
=
$app
->
db
->
queryAllRecords
(
"SELECT * FROM mail_user WHERE email like '%@"
.
addslashes
(
$this
->
oldDataRecord
[
'domain'
])
.
"'"
);
if
(
is_array
(
$mailusers
))
{
foreach
(
$mailusers
as
$rec
)
{
...
...
@@ -229,11 +231,21 @@ class page_action extends tform_actions {
$maildir
=
str_replace
(
"[domain]"
,
$this
->
dataRecord
[
'domain'
],
$mail_config
[
"maildir_path"
]);
$maildir
=
str_replace
(
"[localpart]"
,
$mail_parts
[
0
],
$maildir
);
$maildir
=
addslashes
(
$maildir
);
//$app->db->query("UPDATE mail_user SET maildir = '$maildir' WHERE mailuser_id = ".$rec['mailuser_id']);
//$rec_new = $app->db->queryOneRecord("SELECT * FROM mail_user WHERE mailuser_id = ".$rec['mailuser_id']);
$app
->
db
->
datalogUpdate
(
'mail_user'
,
"maildir = '
$maildir
'"
,
'mailuser_id'
,
$rec
[
'mailuser_id'
]);
$email
=
addslashes
(
$mail_parts
[
0
]
.
'@'
.
$this
->
dataRecord
[
'domain'
]);
$app
->
db
->
datalogUpdate
(
'mail_user'
,
"maildir = '
$maildir
', email = '
$email
'"
,
'mailuser_id'
,
$rec
[
'mailuser_id'
]);
}
}
//* Update the aliases
$forwardings
=
$app
->
db
->
queryAllRecords
(
"SELECT * FROM mail_forwarding WHERE source like '%@"
.
addslashes
(
$this
->
oldDataRecord
[
'domain'
])
.
"' OR destination like '%@"
.
addslashes
(
$this
->
oldDataRecord
[
'domain'
])
.
"'"
);
if
(
is_array
(
$forwardings
))
{
foreach
(
$forwardings
as
$rec
)
{
$destination
=
addslashes
(
str_replace
(
$this
->
oldDataRecord
[
'domain'
],
$this
->
dataRecord
[
'domain'
],
$rec
[
'destination'
]));
$source
=
addslashes
(
str_replace
(
$this
->
oldDataRecord
[
'domain'
],
$this
->
dataRecord
[
'domain'
],
$rec
[
'source'
]));
$app
->
db
->
datalogUpdate
(
'mail_forwarding'
,
"source = '
$source
', destination = '
$destination
'"
,
'forwarding_id'
,
$rec
[
'forwarding_id'
]);
}
}
}
// end if domain name changed
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment