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/maildeliver_plugin.inc.php | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/server/plugins-available/maildeliver_plugin.inc.php b/server/plugins-available/maildeliver_plugin.inc.php
index 4c0ebd4..35001a4 100644
--- a/server/plugins-available/maildeliver_plugin.inc.php
+++ b/server/plugins-available/maildeliver_plugin.inc.php
@@ -138,7 +138,7 @@
$tpl->setVar('move_junk', $data["new"]["move_junk"]);
// Check autoresponder dates
- if($data["new"]["autoresponder_start_date"] == '0000-00-00 00:00:00' && $data["new"]["autoresponder_end_date"] == '0000-00-00 00:00:00') {
+ if((!$data['new']['autoresponder_start_date'] || $data["new"]["autoresponder_start_date"] == '0000-00-00 00:00:00') && (!$data['new']['autoresponder_end_date'] || $data["new"]["autoresponder_end_date"] == '0000-00-00 00:00:00')) {
$tpl->setVar('autoresponder_date_limit', 0);
} else {
$tpl->setVar('autoresponder_date_limit', 1);
@@ -165,8 +165,8 @@
$tpl->setVar('autoresponder_text', $data["new"]["autoresponder_text"]);
//* Set alias addresses for autoresponder
- $sql = "SELECT * FROM mail_forwarding WHERE type = 'alias' AND destination = '".$app->db->quote($data["new"]["email"])."'";
- $records = $app->db->queryAllRecords($sql);
+ $sql = "SELECT * FROM mail_forwarding WHERE type = 'alias' AND destination = ?";
+ $records = $app->db->queryAllRecords($sql, $data["new"]["email"]);
$addresses = array();
$addresses[] = $data["new"]["email"];
@@ -181,8 +181,8 @@
$alias_addresses = array();
$email_parts = explode('@', $data["new"]["email"]);
- $sql = "SELECT * FROM mail_forwarding WHERE type = 'aliasdomain' AND destination = '@".$app->db->quote($email_parts[1])."'";
- $records = $app->db->queryAllRecords($sql);
+ $sql = "SELECT * FROM mail_forwarding WHERE type = 'aliasdomain' AND destination = ?";
+ $records = $app->db->queryAllRecords($sql, '@'.$email_parts[1]);
if(is_array($records) && count($records) > 0) {
$app->log("Found " . count($records) . " records (aliasdomains).", LOGLEVEL_DEBUG);
foreach($records as $rec) {
@@ -219,17 +219,18 @@
file_put_contents($sieve_file_isp, $tpl->grab()) or $app->log("Unable to write sieve filter file", LOGLEVEL_WARN);
if ( is_file($sieve_file_isp) ) {
- chown($sieve_file_isp,$mail_config['mailuser_name']);
- chgrp($sieve_file_isp,$mail_config['mailuser_group']);
+ $app->system->chown($sieve_file_isp,$mail_config['mailuser_name'],false);
+ $app->system->chgrp($sieve_file_isp,$mail_config['mailuser_group'],false);
}
chdir($data["new"]["maildir"]);
//* create symlink to activate sieve script
symlink("sieve/ispconfig.sieve", ".sieve") or $app->log("Unable to create symlink to active sieve filter", LOGLEVEL_WARN);
if (is_link(".sieve")) {
- lchown(".sieve",$mail_config['mailuser_name']);
- lchgrp(".sieve",$mail_config['mailuser_group']);
+ $app->system->chown(".sieve",$mail_config['mailuser_name'],true);
+ $app->system->chgrp(".sieve",$mail_config['mailuser_group'],true);
}
- exec('chown '.$mail_config['mailuser_name'].':'.$mail_config['mailuser_group'].' '.escapeshellcmd($sieve_file));
+ $app->system->chown($sieve_file,$mail_config['mailuser_name'],true);
+ $app->system->chgrp($sieve_file,$mail_config['mailuser_group'],true);
unset($tpl);
--
Gitblit v1.9.1