Skip to content

Commit d89b694

Browse files
committed
Fixed 2 bugs in mail transports when a port is assigned.
1 parent 387e24d commit d89b694

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

interface/web/mail/mail_transport_edit.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,17 @@ function onShowEnd() {
8282
} else {
8383
$rec["type"] = $tmp_parts[0];
8484
}
85-
if(@substr($tmp_parts[1],0,1) == '[') {
85+
if(@$tmp_parts[2] != '') {
86+
$dest = @$tmp_parts[1].':'.@$tmp_parts[2];
87+
} else {
88+
$dest = $tmp_parts[1];
89+
}
90+
if(@substr($dest,0,1) == '[') {
8691
$rec["mx"] = 'checked="CHECKED"';
87-
$rec["destination"] = @substr($tmp_parts[1],1,-1);
92+
$rec["destination"] = @str_replace(']','',@str_replace('[','',$dest));
8893
} else {
8994
$rec["mx"] = '';
90-
$rec["destination"] = @$tmp_parts[1];
95+
$rec["destination"] = @$dest;
9196
}
9297

9398
$types = array('smtp' => 'smtp','uucp' => 'uucp','slow' => 'slow', 'error' => 'error', '' => 'null');
@@ -127,7 +132,12 @@ function onSubmit() {
127132

128133
//* Compose transport field
129134
if($this->dataRecord["mx"] == 'y') {
130-
$transport = '['.$this->dataRecord["destination"].']';
135+
if(stristr($this->dataRecord["destination"],':')) {
136+
$tmp_parts = explode(":",$this->dataRecord["destination"]);
137+
$transport = '['.$tmp_parts[0].']:'.$tmp_parts[1];
138+
} else {
139+
$transport = '['.$this->dataRecord["destination"].']';
140+
}
131141
} else {
132142
$transport = $this->dataRecord["destination"];
133143
}

0 commit comments

Comments
 (0)