From 0baa5d4d41c79e841dfc35a35a377f7316a145bb Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Mon, 10 Sep 2012 10:37:31 -0400
Subject: [PATCH] Do not process sub templates if no main template (master template) is present!

---
 interface/lib/classes/functions.inc.php |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/interface/lib/classes/functions.inc.php b/interface/lib/classes/functions.inc.php
index fe02f14..e109650 100644
--- a/interface/lib/classes/functions.inc.php
+++ b/interface/lib/classes/functions.inc.php
@@ -39,6 +39,28 @@
 		
 		if($conf['demo_mode'] == true) $app->error("Mail sending disabled in demo mode.");
 		
+        $app->uses('getconf,ispcmail');
+		$mail_config = $app->getconf->get_global_config('mail');
+		if($mail_config['smtp_enabled'] == 'y') {
+			$mail_config['use_smtp'] = true;
+			$app->ispcmail->setOptions($mail_config);
+		}
+		$app->ispcmail->setSender($from);
+		$app->ispcmail->setSubject($subject);
+		$app->ispcmail->setMailText($text);
+		
+		if($filepath != '') {
+			if(!file_exists($filepath)) $app->error("Mail attachement does not exist ".$filepath);
+			$app->ispcmail->readAttachFile($filepath);
+		}
+		
+		if($cc != '') $app->ispcmail->setHeader('Cc', $cc);
+		if($bcc != '') $app->ispcmail->setHeader('Bcc', $bcc);
+		
+		$app->ispcmail->send($to);
+		$app->ispcmail->finish();
+		
+		/* left in here just for the case...
 		if($filepath != '') {
 			if(!file_exists($filepath)) $app->error("Mail attachement does not exist ".$filepath);
 			
@@ -83,7 +105,7 @@
 			$subject      = "=?utf-8?B?".base64_encode($subject)."?=";
 			mail($to, $subject, $text, $header);
 		}
-
+		*/
 		return true;
 	}
 	

--
Gitblit v1.9.1