Exemple #1
0
<?php

/**
 * @package reblog
 * @subpackage functions
 */
/**
 * required setup
 */
global $gFeed;
require_once REBLOG_PKG_PATH . 'BitReBlog.php';
// if we already have a gContent, we assume someone else created it for us, and has properly loaded everything up.
if (empty($gFeed) || !is_object($gFeed) || !$gFeed->isValid()) {
    if (@BitBase::verifyId($_REQUEST['feed_id'])) {
        $gFeed = new BitReBlog($_REQUEST['feed_id']);
        $gFeed->load();
    } else {
        $gFeed = new BitReBlog();
    }
    $gBitSmarty->assign_by_ref('gFeed', $gFeed);
}
Exemple #2
0
require_once REBLOG_PKG_PATH . 'BitReBlog.php';
// add some protection for arbitrary thumbail execution.
// if argc is present, we will trust it was exec'ed command line.
if (empty($argc) && !$gBitUser->isAdmin()) {
    $gBitSystem->fatalError(tra('You do not have permission to access this page.'));
}
$reblog = new BitReBlog();
$_REQUEST['auto_only'] = TRUE;
$feedsList = $reblog->getList($_REQUEST);
$log = array();
$total = date('U');
$currTime = $gBitSystem->getUTCTime();
foreach (array_keys($feedsList) as $key) {
    $feedHash = $feedsList[$key];
    if ($feedHash['last_updated'] + $feedHash['refresh'] <= $currTime) {
        $feed = new BitReBlog($feedHash['feed_id']);
        $feed->load();
        $begin = date('U');
        if (!$feed->updateFeed()) {
            $error = TRUE;
            $log[$key]['message'] = ' ERROR: ' . implode(',', $feed->mErrors['reblog']);
        }
        $log[$key]['time'] = date('d/M/Y:H:i:s O');
        $log[$key]['duration'] = date('U') - $begin;
        $log[$key]['delay'] = date('U') - $total;
    }
}
foreach (array_keys($log) as $feedHash) {
    // generate something that kinda looks like apache common log format
    $logLine = $feedHash . ' - - [' . $log[$feedHash]['time'] . '] "' . $log[$feedHash]['message'] . '" ' . $log[$feedHash]['duration'] . "seconds <br/>\n";
    if (isset($log[$feedHash['message']]) and strpos($log[$feedHash['message']], 'ERROR') !== FALSE) {