From d89b69488891f5c5ee80337691b72f2120d4f83c Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Fri, 01 Aug 2008 14:51:11 -0400
Subject: [PATCH] Fixed 2 bugs in mail transports when a port is assigned.

---
 interface/web/mail/mail_transport_edit.php |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/interface/web/mail/mail_transport_edit.php b/interface/web/mail/mail_transport_edit.php
index 8075a1d..9b6c4e3 100644
--- a/interface/web/mail/mail_transport_edit.php
+++ b/interface/web/mail/mail_transport_edit.php
@@ -82,12 +82,17 @@
 		} else {
 			$rec["type"] = $tmp_parts[0];
 		}
-		if(@substr($tmp_parts[1],0,1) == '[') {
+		if(@$tmp_parts[2] != '') {
+			$dest = @$tmp_parts[1].':'.@$tmp_parts[2];
+		} else {
+			$dest = $tmp_parts[1];
+		}
+		if(@substr($dest,0,1) == '[') {
 			$rec["mx"] = 'checked="CHECKED"';
-			$rec["destination"] = @substr($tmp_parts[1],1,-1);
+			$rec["destination"] = @str_replace(']','',@str_replace('[','',$dest));
 		} else {
 			$rec["mx"] = '';
-			$rec["destination"] = @$tmp_parts[1];
+			$rec["destination"] = @$dest;
 		}
 		
 		$types = array('smtp' => 'smtp','uucp' => 'uucp','slow' => 'slow', 'error' => 'error', '' => 'null');
@@ -127,7 +132,12 @@
 		
 		//* Compose transport field
 		if($this->dataRecord["mx"] == 'y') {
-			$transport = '['.$this->dataRecord["destination"].']';
+			if(stristr($this->dataRecord["destination"],':')) {
+				$tmp_parts = explode(":",$this->dataRecord["destination"]);
+				$transport = '['.$tmp_parts[0].']:'.$tmp_parts[1];
+			} else {
+				$transport = '['.$this->dataRecord["destination"].']';
+			}
 		} else {
 			$transport = $this->dataRecord["destination"];
 		}

--
Gitblit v1.9.1