From 897af06af9522ded99b1e0f46730299e89856ffe Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Mon, 11 Jun 2012 05:00:57 -0400
Subject: [PATCH] Updated version number to 3.0.4.6

---
 interface/lib/classes/functions.inc.php |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/interface/lib/classes/functions.inc.php b/interface/lib/classes/functions.inc.php
index 8071429..7f4f31c 100644
--- a/interface/lib/classes/functions.inc.php
+++ b/interface/lib/classes/functions.inc.php
@@ -45,6 +45,7 @@
 			$content = file_get_contents($filepath);
 			$content = chunk_split(base64_encode($content));
 			$uid = strtoupper(md5(uniqid(time())));
+			$subject      = "=?utf-8?B?".base64_encode($subject)."?=";
 			
 			if($filename == '') {
 				$path_parts = pathinfo($filepath);
@@ -52,7 +53,7 @@
 				unset($path_parts);
 			}
 
-			$header = "From: $from\nReply-To: $from\n";
+			$header = "Return-Path: $form\nFrom: $from\nReply-To: $from\n";
 			$header .= "MIME-Version: 1.0\n";
 			$header .= "Content-Type: multipart/mixed; boundary=$uid\n";
 
@@ -73,6 +74,9 @@
 			mail($to, $subject, "", $header);
 		} else {
 			$header = "From: $from\nReply-To: $from\n";
+			$header .= "Content-Type: text/plain;\n\tcharset=\"UTF-8\"\n";
+			$header .= "Content-Transfer-Encoding: 8bit\n\n";
+			$subject      = "=?utf-8?B?".base64_encode($subject)."?=";
 			mail($to, $subject, $text, $header);
 		}
 
@@ -97,7 +101,7 @@
 	}
 	
 	public function get_ispconfig_url() {
-		$url = (stristr($_SERVER['SERVER_PROTOCOL'],'HTTPS'))?'https':'http';
+		$url = (stristr($_SERVER['SERVER_PROTOCOL'],'HTTPS') || stristr($_SERVER['HTTPS'],'on'))?'https':'http';
 		$url .= '://'.$_SERVER['SERVER_NAME'];
 		if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
 			$url .= ':'.$_SERVER['SERVER_PORT'];

--
Gitblit v1.9.1