function handleRequest() { $type = param('q', 'tag'); $outputType = param('f', 'html'); switch ($type) { case 'item': //refresh: always from cache $zf_aggregator = new Aggregator(); $item = $zf_aggregator->getItem(param('itemid')); $view = zf_createView($outputType); $view->renderArticle($item); break; case 'download-item': //refresh: always from cache $zf_aggregator = new Aggregator(); $item = $zf_aggregator->downloadItem(param('itemid')); $view = zf_createView($outputType); $view->renderArticle($item); break; case 'save-item': //refresh: always from cache $zf_aggregator = new Aggregator(); $item = $zf_aggregator->saveItem(param('itemid'), param('save', 1)); $view = zf_createView($outputType); $view->renderArticle($item); break; case 'summary': //refresh: always from cache $zf_aggregator = new Aggregator(); $item = $zf_aggregator->getItem(param('itemid')); $view = zf_createView($outputType); $view->renderSummary($item); break; case 'channel': //refresh: user defined $zf_aggregator = new Aggregator(); $feed = $zf_aggregator->getPublisherFeed(param('id'), param('mode', ZF_REFRESHMODE == 'automatic' ? 'auto' : 'none'), param('trim', 'auto'), int_param('onlynew', ZF_ONLYNEW == 'no' ? 0 : 1)); $view = zf_createView($outputType); $view->renderFeed($feed, array('groupbyday' => false, 'decoration' => int_param('decoration'), 'summary' => param('sum', 1) == 1)); break; case 'tag': //refresh: always auto refresh for tag view // if html output & sorted by feed, trim every single item // according to subcription's settings $sort = param('sort', ZF_SORT); if ($sort == 'feed' && strstr($outputType, 'html')) { $groupbyday = false; $aggregate = false; } else { // otherwise just aggregate in a single feed $groupbyday = true; $aggregate = true; } $zf_aggregator = new Aggregator(); $tag = param('tag', ZF_HOMETAG); $feeds = $zf_aggregator->getFeedsForTag($tag, $aggregate, $trim = param('trim', 'auto'), int_param('onlynew', ZF_ONLYNEW == 'no' ? 0 : 1)); zf_debugRuntime("before rendering"); $view = zf_createView($outputType); $view->renderFeedList($feeds, array('groupbyday' => $groupbyday, 'summary' => int_param('sum', 1) == 1, 'tag' => $tag)); break; case 'subs': //only JSON $subs = SubscriptionStorage::getInstance()->getSortedActiveSubscriptions(param('tag', '')); if (!headers_sent()) { header('Content-Type: application/json; charset=' . ZF_ENCODING); } echo json_encode($subs, JSON_FORCE_OBJECT); break; case 'tags': $tags = SubscriptionStorage::getInstance()->getTags(); if (!headers_sent()) { header('Content-Type: application/json; charset=' . ZF_ENCODING); } echo json_encode($tags, JSON_FORCE_OBJECT); break; case 'force-refresh': // only internal use // TODO: check API key $sub = SubscriptionStorage::getInstance()->getSubscription(param('id')); FeedCache::getInstance()->updateSingle($sub->source); echo $sub->source->title . ' DONE. '; break; case 'refresh-all': $subs = SubscriptionStorage::getInstance()->getActiveSubscriptions(param('tag', '')); FeedCache::getInstance()->update($subs); echo ' DONE. '; break; } }
<!DOCTYPE html> <html> <head> <title>ZebraFeeds jobs</title> </head> <body> <?php require_once __DIR__ . '/../init.php'; if ($_GET['key'] != md5(ZF_ADMINNAME . ZF_ADMINPASS)) { echo "No authorization<br/>"; exit; } $subs = SubscriptionStorage::getInstance()->getActiveSubscriptions(); FeedCache::getInstance()->update($subs, 'auto'); echo 'complete'; ?> </body> </html>
public function __construct() { $this->cache = FeedCache::getInstance(); }
case 'subscriptions': include 'includes/subscriptions.php'; break; case 'addnew': include 'includes/addnewfeed.php'; break; case 'config': include 'includes/changeconfig.php'; break; case 'compact': FeedCache::getInstance()->compact(); echo '<div id="core"><h3>Compact</h3>'; echo 'Cache compacted</div>'; break; case 'flush': FeedCache::getInstance()->flush(); echo '<div id="core"><h3>Clean up</h3>'; echo "Flushed cache"; echo '<br/><br/></div>'; break; case 'store': Header('Content-Type: text/html; charset=' . ZF_ENCODING); $storage = SubscriptionStorage::getInstance(); $id = $_POST['id']; $sub = $storage->getSubscription($id); if ($sub) { $sub->title = $_POST['title']; $sub->xmlurl = $_POST['xmlurl']; $sub->description = $_POST['description']; $sub->position = $_POST['position']; $sub->shownItems = $_POST['shownitems'];