- bugfixing function getNextCronjobs()
- fixed database-field-names in customer_autoresponder.php - added date-pattern in autoresponder_add and _delete templates - corrected $cronlog->logAction()-calls in cron_autoresponder.php - corrected time-cycle-check in cron_autoresponder.php
This commit is contained in:
@@ -34,7 +34,7 @@ if($action == "add")
|
||||
$message = trim($_POST['message']);
|
||||
|
||||
$date_from_off = isset($_POST['date_from_off']) ? -1 : 0;
|
||||
$date_until_off = isset($_POST['date_from_off']) ? -1 : 0;
|
||||
$date_until_off = isset($_POST['date_until_off']) ? -1 : 0;
|
||||
|
||||
/*
|
||||
* @TODO validate date (DD-MM-YYYY)
|
||||
@@ -82,8 +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 . "',
|
||||
`date_from` = '" . (int)$ts_from . "',
|
||||
`date_until` = '" . (int)$ts_until . "',
|
||||
`subject` = '" . $db->escape($subject) . "',
|
||||
`customerid` = '" . $db->escape((int)$userinfo['customerid']) . "'
|
||||
");
|
||||
@@ -126,7 +126,7 @@ if($action == "edit")
|
||||
$message = trim($_POST['message']);
|
||||
|
||||
$date_from_off = isset($_POST['date_from_off']) ? -1 : 0;
|
||||
$date_until_off = isset($_POST['date_from_off']) ? -1 : 0;
|
||||
$date_until_off = isset($_POST['date_until_off']) ? -1 : 0;
|
||||
|
||||
/*
|
||||
* @TODO validate date (DD-MM-YYYY)
|
||||
@@ -181,8 +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 . "',
|
||||
`date_from` = '" . (int)$ts_from . "',
|
||||
`date_until` = '" . (int)$ts_until . "',
|
||||
`subject` = '" . $db->escape($subject) . "'
|
||||
WHERE `email` = '" . $db->escape($account) . "'
|
||||
AND `customerid` = '" . $db->escape((int)$userinfo['customerid']) . "'
|
||||
@@ -281,21 +281,21 @@ else
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($result['date_from'] == -1 && $result['date_until'] == -1)
|
||||
if($row['date_from'] == -1 && $row['date_until'] == -1)
|
||||
{
|
||||
$activated_date = $lng['panel']['not_activated'];
|
||||
}
|
||||
elseif($result['date_from'] == -1 && $result['date_until'] != -1)
|
||||
elseif($row['date_from'] == -1 && $row['date_until'] != -1)
|
||||
{
|
||||
$activated_date = $lng['autoresponder']['date_until'].': '.date('d-m-Y', $result['date_until']);
|
||||
$activated_date = $lng['autoresponder']['date_until'].': '.date('d-m-Y', $row['date_until']);
|
||||
}
|
||||
elseif($result['date_from'] != -1 && $result['date_until'] == -1)
|
||||
elseif($row['date_from'] != -1 && $row['date_until'] == -1)
|
||||
{
|
||||
$activated_date = $lng['autoresponder']['date_from'].': '.date('d-m-Y', $result['date_from']);
|
||||
$activated_date = $lng['autoresponder']['date_from'].': '.date('d-m-Y', $row['date_from']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$activated_date = $date('d-m-Y', $result['date_from']) . ' - ' . date('d-m-Y', $result['date_until']);
|
||||
$activated_date = date('d-m-Y', $row['date_from']) . ' - ' . date('d-m-Y', $row['date_until']);
|
||||
}
|
||||
eval("\$autoresponder.=\"" . getTemplate("email/autoresponder_autoresponder") . "\";");
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ function getNextCronjobs()
|
||||
if($name == '0') continue;
|
||||
|
||||
if($x == 0) {
|
||||
$query.= 'DATE_ADD(FROM_UNIXTIME(`lastrun`), INTERVAL '.$ival.') <= UTC_TIMESTAMP()';
|
||||
$query.= 'UNIX_TIMESTAMP(DATE_ADD(FROM_UNIXTIME(`lastrun`), INTERVAL '.$ival.')) <= UNIX_TIMESTAMP()';
|
||||
} else {
|
||||
$query.= ' OR DATE_ADD(UNIX_TIMESTAMP(`lastrun`), INTERVAL '.$ival.') <= UTC_TIMESTAMP()';
|
||||
$query.= ' OR UNIX_TIMESTAMP(DATE_ADD(FROM_UNIXTIME(`lastrun`), INTERVAL '.$ival.')) <= UNIX_TIMESTAMP()';
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
|
||||
@@ -79,13 +79,25 @@ if($db->num_rows($result) > 0)
|
||||
if($ts_end != -1 && $ts_end < $ts_now) continue;
|
||||
|
||||
$path = $row['homedir'] . $row['maildir'] . "new/";
|
||||
|
||||
if(!is_dir($paht) || !is_readable($path))
|
||||
{
|
||||
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "Error accessing maildir: " . $path);
|
||||
continue;
|
||||
}
|
||||
|
||||
$files = scandir($path);
|
||||
foreach($files as $entry)
|
||||
{
|
||||
if($entry == '.'
|
||||
|| $entry == '..')continue;
|
||||
|
||||
if(time() - filemtime($path . $entry) - $cycle <= 0)
|
||||
/*
|
||||
* is the time passed between now and
|
||||
* the time we received the mail lower/equal
|
||||
* than our cycle-seconds?
|
||||
*/
|
||||
if(time() - filemtime($path . $entry) <= $cycle)
|
||||
{
|
||||
$content = file($path . $entry);
|
||||
|
||||
@@ -93,7 +105,7 @@ if($db->num_rows($result) > 0)
|
||||
|
||||
if(count($content) == 0)
|
||||
{
|
||||
$cronlog->logAction(LOG_ERROR, LOG_WARNING, "Unable to read mail from maildir: " . $entry);
|
||||
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "Unable to read mail from maildir: " . $entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -174,7 +186,7 @@ if($db->num_rows($result) > 0)
|
||||
if($to == ''
|
||||
|| $from == '')
|
||||
{
|
||||
$cronlog->logAction(LOG_ERROR, LOG_WARNING, "No valid headers found in mail to parse: " . $entry);
|
||||
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "No valid headers found in mail to parse: " . $entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -219,7 +231,7 @@ if($db->num_rows($result) > 0)
|
||||
$mailerr_msg = $from;
|
||||
}
|
||||
|
||||
$cronlog->logAction(LOG_ERROR, LOG_WARNING, "Error sending autoresponder mail: " . $mailerr_msg);
|
||||
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "Error sending autoresponder mail: " . $mailerr_msg);
|
||||
}
|
||||
|
||||
$mail->ClearAddresses();
|
||||
|
||||
@@ -15,11 +15,11 @@ $header
|
||||
<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_name">{$lng['autoresponder']['date_from']} (dd-mm-yyyy):</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_name">{$lng['autoresponder']['date_until']} (dd-mm-yyyy):</td>
|
||||
<td class="main_field_display" nowrap="nowrap"><input type="text" name="date_until" maxlength="10" /> {$date_until_off}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -16,11 +16,11 @@ $header
|
||||
<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_name">{$lng['autoresponder']['date_from']} (dd-mm-yyyy):</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_name">{$lng['autoresponder']['date_until']} (dd-mm-yyyy):</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>
|
||||
|
||||
Reference in New Issue
Block a user