function handleRequest(DevblocksHttpRequest $request) { $translate = DevblocksPlatform::getTranslationService(); // [TODO] Do we want any concept of authentication here? $stack = $request->path; array_shift($stack); // rss $hash = array_shift($stack); $feed = DAO_ViewRss::getByHash($hash); if (empty($feed)) { die($translate->_('rss.bad_feed')); } // Sources $rss_sources = DevblocksPlatform::getExtensions('cerberusweb.rss.source', true); if (isset($rss_sources[$feed->source_extension])) { $rss_source =& $rss_sources[$feed->source_extension]; /* @var $rss_source Extension_RssSource */ header("Content-Type: text/xml"); echo $rss_source->getFeedAsRss($feed); } exit; }
function saveRssAction() { @($id = DevblocksPlatform::importGPC($_POST['id'])); $active_worker = CerberusApplication::getActiveWorker(); if (null != ($feed = DAO_ViewRss::getId($id)) && $feed->worker_id == $active_worker->id) { DAO_ViewRss::delete($id); } DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('preferences', 'rss'))); }
function viewBuildRssAction() { @($view_id = DevblocksPlatform::importGPC($_POST['view_id'])); @($source = DevblocksPlatform::importGPC($_POST['source'])); @($title = DevblocksPlatform::importGPC($_POST['title'])); $active_worker = CerberusApplication::getActiveWorker(); $view = C4_AbstractViewLoader::getView($view_id); $hash = md5($title . $view_id . $active_worker->id . time()); // Restrict to current worker groups $active_worker = CerberusApplication::getActiveWorker(); $params = array('params' => $view->params, 'sort_by' => $view->renderSortBy, 'sort_asc' => $view->renderSortAsc); $fields = array(DAO_ViewRss::TITLE => $title, DAO_ViewRss::HASH => $hash, DAO_ViewRss::CREATED => time(), DAO_ViewRss::WORKER_ID => $active_worker->id, DAO_ViewRss::SOURCE_EXTENSION => $source, DAO_ViewRss::PARAMS => serialize($params)); $feed_id = DAO_ViewRss::create($fields); DevblocksPlatform::redirect(new DevblocksHttpResponse(array('preferences', 'rss'))); }