Esempio n. 1
0
function newsletter_header($html)
{
    require_once './plugins/newsletter/init.inc.php';
    $newsletter_init_array = newsletter_initialize();
    $lang_plugin_newsletter = $newsletter_init_array['language'];
    $newsletter_icon_array = $newsletter_init_array['icon'];
    $remaining_records_count = newsletter_mailings_to_process();
    if ($remaining_records_count > 0) {
        $return .= '<a href="index.php?file=newsletter/send">' . sprintf($lang_plugin_newsletter['x_open_mailings'], $remaining_records_count) . '</a>';
    }
    $timed_out_records_count = newsletter_timed_out_mailings();
    if ($timed_out_records_count > 0) {
        $return .= ' <a href="index.php?file=newsletter/queue">' . sprintf($lang_plugin_newsletter['timed_out_mailings'], $timed_out_records_count) . '</a>';
    }
    $return .= $html;
    return $return;
}
Esempio n. 2
0
}
// 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;
    $remaining_time = '<br />' . sprintf($lang_plugin_newsletter['remaining_time'], date('i:s', $remaining_timestamp));
}
if ($remaining_records_count == 0) {