Esempio n. 1
0
function newsletter_footer($html)
{
    $superCage = Inspekt::makeSuperCage();
    if (function_exists('newsletter_mailqueue') && $superCage->get->getRaw('file') != 'newsletter/send') {
        newsletter_mailqueue();
        // Trigger the sending of emails at the end of the page
    }
    return $html;
}
Esempio n. 2
0
$output_array = array();
if (!GALLERY_ADMIN_MODE) {
    cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
}
// Populate the stats defaults
if ($superCage->get->keyExists('time')) {
    $timestamp_start = $superCage->get->getInt('time');
} else {
    $timestamp_start = time();
}
if ($superCage->get->keyExists('counter')) {
    $processed_records_counter = $superCage->get->getInt('counter');
} else {
    $processed_records_counter = 0;
}
$output_array = newsletter_mailqueue();
$processed_records_counter = $processed_records_counter + count($output_array);
// Get the number of records to process
$remaining_records_count = newsletter_mailings_to_process();
$max_attempts = $CONFIG['plugin_newsletter_retries'] + 1;
$result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PREFIX']}plugin_newsletter_queue WHERE attempts > {$max_attempts}");
list($failed_records_count) = mysql_fetch_row($result);
mysql_free_result($result);
if ($failed_records_count > 0) {
    $timed_out_mailings = '<br /><a href="index.php?file=newsletter/queue">' . sprintf($lang_plugin_newsletter['timed_out_mailings'], $failed_records_count) . '</a>';
} else {
    $timed_out_mailings = '';
}
$remaining_queued_mailings = sprintf($lang_plugin_newsletter['remaining_queued_mailings'], $remaining_records_count);
if ($processed_records_counter != 0) {
    $remaining_timestamp = $remaining_records_count * (time() - $timestamp_start) / $processed_records_counter;