fixed syscp-bug #1210 (add start- and endtime to autoresponder);
This commit is contained in:
@@ -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.= "<option value=\"" . $row['email'] . "\">" . $row['email'] . "</option>";
|
||||
}
|
||||
|
||||
$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") . "\";");
|
||||
}
|
||||
|
||||
@@ -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\'');
|
||||
|
||||
@@ -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`),
|
||||
|
||||
@@ -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\'';
|
||||
|
||||
@@ -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.<br /><b>Attention:</b>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';
|
||||
|
||||
?>
|
||||
|
||||
@@ -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<br /><b>Achtung:</b>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';
|
||||
|
||||
?>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
$header
|
||||
<table cellpadding="5" cellspacing="0" border="0" align="center" class="maintable">
|
||||
<tr>
|
||||
<td class="maintitle_search_left" colspan="4"><b><img src="images/title.gif" alt="" /> {$lng['menue']['email']['autoresponder']}</b></td>
|
||||
<td class="maintitle" colspan="5"><b><img src="images/title.gif" alt="" /> {$lng['menue']['email']['autoresponder']}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="field_display_border_left">{$lng['emails']['emailaddress']}</td>
|
||||
<td class="field_display">{$lng['autoresponder']['active']}</td>
|
||||
<td class="field_display">{$lng['autoresponder']['startenddate']}</td>
|
||||
<td class="field_display"> </td>
|
||||
<td class="field_display"> </td>
|
||||
</tr>
|
||||
$autoresponder
|
||||
<tr>
|
||||
<td class="field_display_border_left" colspan="6"><a href="$filename?&action=add&s=$s">{$lng['autoresponder']['autoresponder_add']}</a></td>
|
||||
<td class="field_display_border_left" colspan="5"><a href="$filename?&action=add&s=$s">{$lng['autoresponder']['autoresponder_add']}</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
|
||||
@@ -14,6 +14,14 @@ $header
|
||||
<td class="main_field_name">{$lng['autoresponder']['active']}:</td>
|
||||
<td class="main_field_display" nowrap="nowrap"><input type="checkbox" name="active" value="1" checked="checked" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="main_field_name">{$lng['autoresponder']['date_from']}:</td>
|
||||
<td class="main_field_display" nowrap="nowrap"><input type="text" name="date_from" maxlength="10" /> {$date_from_off}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="main_field_name">{$lng['autoresponder']['date_until']}:</td>
|
||||
<td class="main_field_display" nowrap="nowrap"><input type="text" name="date_until" maxlength="10" /> {$date_until_off}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="main_field_name">{$lng['autoresponder']['subject']}:</td>
|
||||
<td class="main_field_display" nowrap="nowrap"><input type="text" name="subject" maxlength="70" /></td>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<tr>
|
||||
<td class="field_name_border_left">{$row['email']}</td>
|
||||
<td class="field_name"><if $row['enabled'] != 0>{$lng['panel']['yes']}</if><if $row['enabled'] == 0>{$lng['panel']['no']}</if></td>
|
||||
<td class="field_name">$activated_date</td>
|
||||
<td class="field_name"><a href="$filename?&action=edit&email={$row['email']}&s=$s">{$lng['panel']['edit']}</a></td>
|
||||
<td class="field_name"><a href="$filename?&action=delete&email={$row['email']}&s=$s">{$lng['panel']['delete']}</a></td>
|
||||
</tr>
|
||||
@@ -15,6 +15,14 @@ $header
|
||||
<td class="main_field_name">{$lng['autoresponder']['active']}:</td>
|
||||
<td class="main_field_display" nowrap="nowrap"><input type="checkbox" name="active" value="1"{$checked} /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="main_field_name">{$lng['autoresponder']['date_from']}:</td>
|
||||
<td class="main_field_display" nowrap="nowrap"><input type="text" name="date_from" maxlength="10" value="{$date_from}" /> {$date_from_off}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="main_field_name">{$lng['autoresponder']['date_until']}:</td>
|
||||
<td class="main_field_display" nowrap="nowrap"><input type="text" name="date_until" maxlength="10" value="{$date_until}" /> {$date_until_off}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="main_field_name">{$lng['autoresponder']['subject']}:</td>
|
||||
<td class="main_field_display" nowrap="nowrap"><input type="text" name="subject" maxlength="70" value="{$subject}" /></td>
|
||||
|
||||
Reference in New Issue
Block a user