diff --git a/customer_autoresponder.php b/customer_autoresponder.php
index 6c4c9d62..4ffbb961 100644
--- a/customer_autoresponder.php
+++ b/customer_autoresponder.php
@@ -32,6 +32,26 @@ if($action == "add")
$account = trim($_POST['account']);
$subject = trim($_POST['subject']);
$message = trim($_POST['message']);
+
+ $date_from_off = isset($_POST['date_from_off']) ? -1 : 0;
+ $date_until_off = isset($_POST['date_from_off']) ? -1 : 0;
+
+ /*
+ * @TODO validate date (DD-MM-YYYY)
+ */
+ $ts_from = -1;
+ $ts_until = -1;
+
+ if($date_from_off > -1)
+ {
+ $date_from = $_POST['date_from'];
+ $ts_from = mktime(0, 0, 0, substr($date_from, 3, 2), substr($date_from, 0, 2), substr($date_from, 6, 4));
+ }
+ if($date_until_off > -1)
+ {
+ $date_until = $_POST['date_until'];
+ $ts_until = mktime(0, 0, 0, substr($date_until, 3, 2), substr($date_until, 0, 2), substr($date_until, 6, 4));
+ }
if(empty($account)
|| empty($subject)
@@ -62,6 +82,8 @@ if($action == "add")
SET `email` = '" . $db->escape($account) . "',
`message` = '" . $db->escape($message) . "',
`enabled` = '" . (int)$_POST['active'] . "',
+ `ts_from` = '" . (int)$ts_from . "',
+ `ts_until` = '" . (int)$ts_until . "',
`subject` = '" . $db->escape($subject) . "',
`customerid` = '" . $db->escape((int)$userinfo['customerid']) . "'
");
@@ -83,6 +105,9 @@ if($action == "add")
{
$accounts.= "";
}
+
+ $date_from_off = makecheckbox('date_from_off', $lng['panel']['not_activated'], '-1', false, '-1', true, true);
+ $date_until_off = makecheckbox('date_from_off', $lng['panel']['not_activated'], '-1', false, '-1', true, true);
eval("echo \"" . getTemplate("email/autoresponder_add") . "\";");
}
@@ -100,6 +125,26 @@ if($action == "edit")
$subject = trim($_POST['subject']);
$message = trim($_POST['message']);
+ $date_from_off = isset($_POST['date_from_off']) ? -1 : 0;
+ $date_until_off = isset($_POST['date_from_off']) ? -1 : 0;
+
+ /*
+ * @TODO validate date (DD-MM-YYYY)
+ */
+ $ts_from = -1;
+ $ts_until = -1;
+
+ if($date_from_off > -1)
+ {
+ $date_from = $_POST['date_from'];
+ $ts_from = mktime(0, 0, 0, substr($date_from, 3, 2), substr($date_from, 0, 2), substr($date_from, 6, 4));
+ }
+ if($date_until_off > -1)
+ {
+ $date_until = $_POST['date_until'];
+ $ts_until = mktime(0, 0, 0, substr($date_until, 3, 2), substr($date_until, 0, 2), substr($date_until, 6, 4));
+ }
+
if(empty($account)
|| empty($subject)
|| empty($message))
@@ -136,6 +181,8 @@ if($action == "edit")
$db->query("UPDATE `" . TABLE_MAIL_AUTORESPONDER . "`
SET `message` = '" . $db->escape($message) . "',
`enabled` = '" . (int)$ResponderActive . "',
+ `ts_from` = '" . (int)$ts_from . "',
+ `ts_until` = '" . (int)$ts_until . "',
`subject` = '" . $db->escape($subject) . "'
WHERE `email` = '" . $db->escape($account) . "'
AND `customerid` = '" . $db->escape((int)$userinfo['customerid']) . "'
@@ -157,6 +204,33 @@ if($action == "edit")
$row = $db->fetch_array($result);
$subject = htmlspecialchars($row['subject']);
$message = htmlspecialchars($row['message']);
+
+ $date_from = (int)$row['date_from'];
+ $date_until = (int)$row['date_until'];
+
+ if($date_from == -1)
+ {
+ $deactivated = '-1';
+ }
+ else
+ {
+ $deactivated = '0';
+ $date_from = date('d-m-Y', $date_from);
+ }
+ $date_from_off = makecheckbox('date_from_off', $lng['panel']['not_activated'], '-1', false, $deactivated, true, true);
+
+ if($date_until == -1)
+ {
+ $deactivated = '-1';
+ $date_until = '-1';
+ }
+ else
+ {
+ $deactivated = '0';
+ $date_until = date('d-m-Y', $date_until);
+ }
+ $date_from_off = makecheckbox('date_until_off', $lng['panel']['not_activated'], '-1', false, $deactivated, true, true);
+
$checked = '';
if($row['enabled'] == 1)
@@ -207,8 +281,24 @@ else
while($row = $db->fetch_array($result))
{
+ if($result['date_from'] == -1 && $result['date_until'] == -1)
+ {
+ $activated_date = $lng['panel']['not_activated'];
+ }
+ elseif($result['date_from'] == -1 && $result['date_until'] != -1)
+ {
+ $activated_date = $lng['autoresponder']['date_until'].': '.date('d-m-Y', $result['date_until']);
+ }
+ elseif($result['date_from'] != -1 && $result['date_until'] == -1)
+ {
+ $activated_date = $lng['autoresponder']['date_from'].': '.date('d-m-Y', $result['date_from']);
+ }
+ else
+ {
+ $activated_date = $date('d-m-Y', $result['date_from']) . ' - ' . date('d-m-Y', $result['date_until']);
+ }
eval("\$autoresponder.=\"" . getTemplate("email/autoresponder_autoresponder") . "\";");
- }
+ }
eval("echo \"" . getTemplate("email/autoresponder") . "\";");
}
diff --git a/customer_email.php b/customer_email.php
index a8d8211d..6fabf954 100644
--- a/customer_email.php
+++ b/customer_email.php
@@ -420,7 +420,7 @@ elseif($page == 'accounts')
'USERNAME' => $username,
'PASSWORD' => $password
);
- $admin = $db->query_first('SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_ADMINS . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\'');
+ $admin = $db->query_first('SELECT `name`, `email` FROM `' . TABLE_PANEL_ADMINS . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\'');
$result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($userinfo['def_language']) . '\' AND `templategroup`=\'mails\' AND `varname`=\'pop_success_subject\'');
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['pop_success']['subject']), $replace_arr));
$result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($userinfo['def_language']) . '\' AND `templategroup`=\'mails\' AND `varname`=\'pop_success_mailbody\'');
diff --git a/install/froxlor.sql b/install/froxlor.sql
index 13affb12..2ba6617d 100644
--- a/install/froxlor.sql
+++ b/install/froxlor.sql
@@ -811,6 +811,8 @@ CREATE TABLE `mail_autoresponder` (
`email` varchar(255) NOT NULL default '',
`message` text NOT NULL,
`enabled` tinyint(1) NOT NULL default '0',
+ `date_from` int(15) NOT NULL default '-1',
+ `date_until` int(15) NOT NULL default '-1',
`subject` varchar(255) NOT NULL default '',
`customerid` int(11) NOT NULL default '0',
PRIMARY KEY (`email`),
diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php
index 09770331..e5e830d6 100644
--- a/install/updates/froxlor/0.9/update_0.9.inc.php
+++ b/install/updates/froxlor/0.9/update_0.9.inc.php
@@ -71,7 +71,9 @@ if($settings['panel']['frontend'] == 'froxlor'
$updatelog->logAction(ADM_ACTION, LOG_WARNING, "Updating from 0.9-r2 to 0.9-r3");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'debug_cron', '0');");
-
+ $db->query("ALTER TABLE `" . TABLE_MAIL_AUTORESPONDER . "` ADD `date_from` int(15) NOT NULL default '-1' AFTER `enabled`");
+ $db->query("ALTER TABLE `" . TABLE_MAIL_AUTORESPONDER . "` ADD `date_until` int(15) NOT NULL default '-1' AFTER `date_from`");
+
// set new version
$query = 'UPDATE `%s` SET `value` = \'0.9-r3\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'';
diff --git a/lng/english.lng.php b/lng/english.lng.php
index 873d549c..2b252c65 100644
--- a/lng/english.lng.php
+++ b/lng/english.lng.php
@@ -1255,5 +1255,9 @@ $lng['panel']['toomanydirs'] = 'Too many subdirectories. Falling back to manual
$lng['panel']['abort'] = 'Abort';
$lng['serversettings']['cron']['debug']['title'] = 'Cronscript debugging';
$lng['serversettings']['cron']['debug']['description'] = 'Activate to keep the lockfile after a cron-run for debugging.
Attention:Keeping the lockfile can cause the next scheduled cron not to run properly.';
+$lng['autoresponder']['date_from'] = 'Start date';
+$lng['autoresponder']['date_until'] = 'End date';
+$lng['autoresponder']['startenddate'] = 'Start/end date';
+$lng['panel']['not_activated'] = 'not activated';
?>
diff --git a/lng/german.lng.php b/lng/german.lng.php
index 12f2591e..5517d8c5 100644
--- a/lng/german.lng.php
+++ b/lng/german.lng.php
@@ -1235,5 +1235,9 @@ $lng['panel']['toomanydirs'] = 'Zu viele Unterverzeichnisse. Weiche auf manuelle
$lng['panel']['abort'] = 'Abbrechen';
$lng['serversettings']['cron']['debug']['title'] = 'Debuggen des Cronscripts';
$lng['serversettings']['cron']['debug']['description'] = 'Wenn aktiviert, wird die Lockdatei nach dem Cronlauf zum Debuggen nicht gelöscht
Achtung:Eine alte Lockdatei kann weitere Cronjobs behindern und dafür sorgen, dass diese nicht vollständig ausgeführt werden.';
+$lng['autoresponder']['date_from'] = 'Start-Datum';
+$lng['autoresponder']['date_until'] = 'End-Datum';
+$lng['autoresponder']['startenddate'] = 'Start/End-Datum';
+$lng['panel']['not_activated'] = 'Nicht aktiviert';
?>
diff --git a/scripts/cron_autoresponder.php b/scripts/cron_autoresponder.php
index c367d74a..0c3c7b53 100644
--- a/scripts/cron_autoresponder.php
+++ b/scripts/cron_autoresponder.php
@@ -68,6 +68,18 @@ if($db->num_rows($result) > 0)
{
while($row = $db->fetch_array($result))
{
+ /*
+ * check if specific autoresponder should be used
+ */
+ $ts_now = time();
+ $ts_start = (int)$row['date_from'];
+ $ts_end = (int)$row['date_until'];
+
+ // not yet
+ if($ts_start != -1 && $ts_start > $ts_now) continue;
+ // already ended
+ if($ts_end != -1 && $ts_end < $ts_now) continue;
+
$path = $row['homedir'] . $row['maildir'] . "new/";
$files = scandir($path);
foreach($files as $entry)
diff --git a/templates/customer/email/autoresponder.tpl b/templates/customer/email/autoresponder.tpl
index 7620351b..8ddde17c 100644
--- a/templates/customer/email/autoresponder.tpl
+++ b/templates/customer/email/autoresponder.tpl
@@ -1,17 +1,18 @@
$header
{$lng['menue']['email']['autoresponder']} |
+ {$lng['menue']['email']['autoresponder']} |
|||||||||
| {$lng['emails']['emailaddress']} | {$lng['autoresponder']['active']} | +{$lng['autoresponder']['startenddate']} | ||||||||
| {$lng['autoresponder']['autoresponder_add']} | +{$lng['autoresponder']['autoresponder_add']} | |||||||||