示例#1
0
    max(um.viewed) as lastview, count(um.viewed) as viewcount,
    abs(unix_timestamp(um.entered) - unix_timestamp(um.viewed)) as responsetime
    from %s um, %s user, %s msg where um.messageid = %d and um.messageid = msg.id and um.userid = user.id and um.status = "sent" and um.viewed is not null %s
    group by userid %s', $GLOBALS['tables']['usermessage'], $GLOBALS['tables']['user'], $GLOBALS['tables']['message'], $id, $subselect, $limit));
$summary = array();
while ($row = Sql_Fetch_Array($req)) {
    if ($download) {
        ## with download, the 50 per page limit is not there.
        set_time_limit(60);
        $element = $row['email'];
    } else {
        $element = shortenTextDisplay($row['email'], 15);
    }
    $ls->addElement($element, PageUrl2('userhistory&id=' . $row['userid']));
    $ls->setClass($element, 'row1');
    $ls->addRow($element, '<div class="listingsmall gray">' . $GLOBALS['I18N']->get('sent') . ': ' . formatDateTime($row['sent'], 1) . '</div>', '');
    if ($row['viewcount'] > 1) {
        $ls->addColumn($element, $GLOBALS['I18N']->get('firstview'), formatDateTime($row['firstview'], 1));
        $ls->addColumn($element, $GLOBALS['I18N']->get('lastview'), formatDateTime($row['lastview']));
        $ls->addColumn($element, $GLOBALS['I18N']->get('views'), $row['viewcount']);
    } else {
        $ls->addColumn($element, $GLOBALS['I18N']->get('firstview'), formatDateTime($row['firstview'], 1));
        $ls->addColumn($element, $GLOBALS['I18N']->get('responsetime'), secs2time($row['responsetime']));
    }
}
if ($download) {
    ob_end_clean();
    print $ls->tabDelimited();
} else {
    print $ls->display();
}
示例#2
0
        }
    }
    $req = Sql_Query(sprintf('select id,entered,subject,unix_timestamp(now()) - unix_timestamp(entered) as age from %s where status = "draft" %s order by entered desc', $GLOBALS['tables']['message'], $ownership));
    $numdraft = Sql_Num_Rows($req);
    if ($numdraft > 0 && !isset($_GET['id']) && !isset($_GET['new'])) {
        print '<p>' . PageLinkActionButton('send&amp;new=1', $I18N->get('start a new message'), '', '', s('Start a new campaign')) . '</p>';
        print '<p><h3>' . $I18N->get('Choose an existing draft message to work on') . '</h3></p><br/>';
        $ls = new WebblerListing($I18N->get('Draft messages'));
        $ls->noShader();
        while ($row = Sql_Fetch_Array($req)) {
            $element = '<!--' . $row['id'] . '-->' . $row['subject'];
            $ls->addElement($element, PageUrl2('send&amp;id=' . $row['id']));
            $ls->setClass($element, 'row1');
            #    $ls->addColumn($element,$I18N->get('edit'),PageLink2('send&amp;id='.$row['id'],$I18N->get('edit')));
            $ls->addColumn($element, $I18N->get('entered'), $row['entered']);
            $ls->addColumn($element, $I18N->get('age'), secs2time($row['age']));
            $ls->addRow($element, '', '<a class="del" href="' . PageUrl2('send&amp;delete=' . $row['id']) . '" title="' . $I18N->get('del') . '">' . $I18N->get('del') . '</a>');
        }
        $ls->addButton($I18N->get('delete all'), PageUrl2('send&amp;delete=alldraft'));
        print $ls->display();
        return;
    }
}
include "send_core.php";
if ($done) {
    if ($GLOBALS["commandline"]) {
        ob_end_clean();
        print clineSignature();
        print "Message with subject " . $_POST["subject"] . " was sent to " . $lists . "\n";
        exit;
    }
示例#3
0
 }
 if (!empty($msgdata['resetstats'])) {
     resetMessageStatistics($msgdata['id']);
     ## make sure to reset the resetstats flag, so it doesn't clear it every run
     setMessageData($msgdata['id'], 'resetstats', 0);
 }
 ## check the end date of the campaign
 $stopSending = false;
 if (!empty($msgdata['finishsending'])) {
     $finishSendingBefore = mktime($msgdata['finishsending']['hour'], $msgdata['finishsending']['minute'], 0, $msgdata['finishsending']['month'], $msgdata['finishsending']['day'], $msgdata['finishsending']['year']);
     $secondsTogo = $finishSendingBefore - time();
     $stopSending = $secondsTogo < 0;
     if (empty($reload)) {
         ### Hmm, this is probably incredibly confusing. It won't finish then
         if (VERBOSE) {
             processQueueOutput(sprintf($GLOBALS['I18N']->get('sending of this campaign will stop, if it is still going in %s'), secs2time($secondsTogo)));
         }
     }
 }
 $userselection = $msgdata['userselection'];
 ## @@ needs more work
 ## load message in cache
 if (!precacheMessage($messageid)) {
     ## precache may fail on eg invalid remote URL
     ## any reporting needed here?
     # mark the message as suspended
     Sql_Query(sprintf('update %s set status = "suspended" where id = %d', $GLOBALS['tables']['message'], $messageid));
     processQueueOutput(s('Error loading message, please check the eventlog for details'));
     if (MANUALLY_PROCESS_QUEUE) {
         # wait a little, otherwise the message won't show
         sleep(10);
示例#4
0
文件: lib.php 项目: pedru/phplist3
function timeDiff($time1, $time2)
{
    if (!$time1 || !$time2) {
        return $GLOBALS['I18N']->get('Unknown');
    }
    $t1 = strtotime($time1);
    $t2 = strtotime($time2);
    if ($t1 < $t2) {
        $diff = $t2 - $t1;
    } else {
        $diff = $t1 - $t2;
    }
    if ($diff == 0) {
        return $GLOBALS['I18N']->get('very little time');
    }
    return secs2time($diff);
}
示例#5
0
$now = time();
foreach ($cronJobs as $cronJob) {
    $cronID = $cronJob['plugin'] . '|' . $cronJob['page'];
    $lastrun = getConfig(md5($cronID));
    if (empty($lastrun) || $now - $lastrun > $cronJob['frequency'] * 60) {
        cl_output('Need to run ' . $cronJob['plugin'] . ' - ' . $cronJob['page']);
        $cronJob['page'] = basename($cronJob['page'], '.php');
        $cmd_result = '';
        if (isset($GLOBALS['plugins'][$cronJob['plugin']]) && is_file($GLOBALS['plugins'][$cronJob['plugin']]->coderoot . $cronJob['page'] . '.php')) {
            cl_output('running php ' . $argv[0] . ' -c ' . $GLOBALS['configfile'] . ' -m ' . $cronJob['plugin'] . ' -p ' . $cronJob['page']);
            exec('php ' . $argv[0] . ' -c ' . $GLOBALS['configfile'] . ' -m ' . $cronJob['plugin'] . ' -p ' . $cronJob['page'], $cmd_result);
        } elseif (empty($cronJob['plugin']) && is_file(__DIR__ . '/' . $cronJob['page'] . '.php')) {
            cl_output('running php ' . $argv[0] . ' -c ' . $GLOBALS['configfile'] . ' -p ' . $cronJob['page']);
            exec('php ' . $argv[0] . ' -c ' . $GLOBALS['configfile'] . ' -p ' . $cronJob['page'], $cmd_result);
        }
        SaveConfig(md5($cronID), time(), 0);
    } else {
        $nextRun = $lastrun + $cronJob['frequency'] * 60 - $now;
        if ($nextRun > $maxNextRun) {
            $maxNextRun = $nextRun;
        }
        if (VERBOSE) {
            cl_output('Will run ' . $cronJob['plugin'] . ' - ' . $cronJob['page'] . ' in' . secs2time($nextRun));
        }
    }
}
## tell how soon we need to run again, so that the calling system can relax a bit
if ($maxNextRun > 0) {
    cl_output('DELAYUNTIL=' . (int) ($now + $maxNextRun));
}
#var_dump($cronJobs);
示例#6
0
    $timeleft = ($num_users - $sent) * $secpermsg;
    $eta = date('D j M H:i', time() + $timeleft);
} else {
    $msgperhour = 0;
    $secpermsg = 0;
    $timeleft = 0;
    $eta = $GLOBALS['I18N']->get('unknown');
}
## 16850 - convert to string, to avoid an SQL error
$msgperhour = "{$msgperhour} ";
setMessageData($id, 'ETA', $eta);
setMessageData($id, 'msg/hr', $msgperhour);
if ($message['status'] != 'inprocess') {
    $html = $GLOBALS['I18N']->get($message['status']);
    if ($message['secstowait'] > 0) {
        $secstowait = secs2time($message['secstowait']);
        $html .= '<br/>' . sprintf($GLOBALS['I18N']->get('%s left until embargo'), $secstowait);
    }
    foreach ($GLOBALS['plugins'] as $plname => $plugin) {
        $html .= $plugin->messageStatus($id, $message['status']);
    }
    if ($message['status'] != 'submitted' && $message['status'] != 'draft') {
        $html .= '<br/>' . PageLinkButton('messages', $GLOBALS['I18N']->get('requeue'), 'resend=' . $message['id'], '', s('Requeue'));
    }
    if (!empty($messagedata['to process'])) {
        $html .= '<br/>' . $messagedata['to process'] . ' ' . $GLOBALS['I18N']->get('still to process') . '<br/>' . $GLOBALS['I18N']->get('sent') . ': ' . $totalsent;
    }
} else {
    if (empty($messagedata['last msg sent'])) {
        $messagedata['last msg sent'] = 0;
    }