Skip to content

Commit 66c3bc2

Browse files
committed
Implemented: FS#757 - Add "custom" option to transports
1 parent 8829e1c commit 66c3bc2

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

interface/web/mail/mail_transport_edit.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,21 @@ function onShowEnd() {
7171
global $app, $conf;
7272

7373
$tmp_parts = explode(":",$this->dataRecord["transport"]);
74-
if(empty($this->id) && empty($tmp_parts[0])) {
75-
$rec["type"] = 'smtp';
74+
if(!empty($this->id) && !stristr($this->dataRecord["transport"],':')) {
75+
$rec["type"] = 'custom';
7676
} else {
77-
$rec["type"] = $tmp_parts[0];
77+
if(empty($this->id) && empty($tmp_parts[0])) {
78+
$rec["type"] = 'smtp';
79+
} else {
80+
$rec["type"] = $tmp_parts[0];
81+
}
7882
}
7983
if(@$tmp_parts[2] != '') {
8084
$dest = @$tmp_parts[1].':'.@$tmp_parts[2];
81-
} else {
85+
} elseif($tmp_parts[1] != '') {
8286
$dest = $tmp_parts[1];
87+
} else {
88+
$dest = $this->dataRecord["transport"];
8389
}
8490
if(@substr($dest,0,1) == '[') {
8591
$rec["mx"] = 'checked="CHECKED"';
@@ -89,7 +95,7 @@ function onShowEnd() {
8995
$rec["destination"] = @$dest;
9096
}
9197

92-
$types = array('smtp' => 'smtp','uucp' => 'uucp','slow' => 'slow', 'error' => 'error', '' => 'null');
98+
$types = array('smtp' => 'smtp','uucp' => 'uucp','slow' => 'slow', 'error' => 'error', 'custom' => 'custom','' => 'null');
9399
$type_select = '';
94100
if(is_array($types)) {
95101
foreach( $types as $key => $val) {
@@ -151,7 +157,13 @@ function onSubmit() {
151157
} else {
152158
$transport = $this->dataRecord["destination"];
153159
}
154-
$this->dataRecord["transport"] = $this->dataRecord["type"].':'.$transport;
160+
161+
if($this->dataRecord["type"] == 'custom') {
162+
$this->dataRecord["transport"] = $transport;
163+
} else {
164+
$this->dataRecord["transport"] = $this->dataRecord["type"].':'.$transport;
165+
}
166+
155167
unset($this->dataRecord["type"]);
156168
unset($this->dataRecord["mx"]);
157169
unset($this->dataRecord["destination"]);

0 commit comments

Comments
 (0)