From 65164295778caa2c4e623e7c8e195f2aa3560121 Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Thu, 07 Apr 2016 13:19:58 -0400
Subject: [PATCH] - Changed 0000-00-00 date and datetime values to NULL (mySQL compatibility), Fixes: #3690

---
 server/plugins-available/maildrop_plugin.inc.php |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/server/plugins-available/maildrop_plugin.inc.php b/server/plugins-available/maildrop_plugin.inc.php
index 37b0306..1ebb677 100644
--- a/server/plugins-available/maildrop_plugin.inc.php
+++ b/server/plugins-available/maildrop_plugin.inc.php
@@ -137,10 +137,14 @@
 				}
 
 				// Load the master template
-				$tpl = file_get_contents($conf["rootpath"].'/conf/autoresponder.master');
+				if(file_exists($conf["rootpath"].'/conf-custom/autoresponder.master')) {
+					$tpl = file_get_contents($conf["rootpath"].'/conf-custom/autoresponder.master');
+				} else {
+					$tpl = file_get_contents($conf["rootpath"].'/conf/autoresponder.master');
+				}
 				$tpl = str_replace('{vmail_mailbox_base}', $mail_config["homedir_path"], $tpl);
 
-				if ($data["new"]["autoresponder_start_date"] != '0000-00-00 00:00:00') { // Dates have been set
+				if ($data['new']['autoresponder_start_date'] && $data["new"]["autoresponder_start_date"] != '0000-00-00 00:00:00') { // Dates have been set
 					$tpl = str_replace('{start_date}', strtotime($data["new"]["autoresponder_start_date"]), $tpl);
 					$tpl = str_replace('{end_date}', strtotime($data["new"]["autoresponder_end_date"]), $tpl);
 				} else {
@@ -201,7 +205,11 @@
 				}
 
 				if($data["new"]["move_junk"] == 'y') {
-					$mailfilter_content .= file_get_contents($conf["rootpath"].'/conf/mailfilter_move_junk.master')."\n";
+					if(file_exists($conf["rootpath"].'/conf-custom/mailfilter_move_junk.master')) {
+						$mailfilter_content .= file_get_contents($conf["rootpath"].'/conf-custom/mailfilter_move_junk.master')."\n";
+					} else {
+						$mailfilter_content .= file_get_contents($conf["rootpath"].'/conf/mailfilter_move_junk.master')."\n";
+					}
 				}
 				$mailfilter_content .= $data["new"]["custom_mailfilter"];
 

--
Gitblit v1.9.1