public function execute(HTTPRequestCustom $request)
 {
     $module_id = $request->get_getstring('module_id', '');
     if (empty($module_id)) {
         AppContext::get_response()->redirect(Environment::get_home_page());
     }
     $this->init();
     $module_category_id = $request->get_getint('module_category_id', 0);
     $feed_name = $request->get_getstring('feed_name', Feed::DEFAULT_FEED_NAME);
     $feed = new RSS($module_id, $feed_name, $module_category_id);
     if ($feed !== null && $feed->is_in_cache()) {
         $this->tpl->put('SYNDICATION', $feed->read());
     } else {
         $eps = AppContext::get_extension_provider_service();
         if ($eps->provider_exists($module_id, FeedProvider::EXTENSION_POINT)) {
             $provider = $eps->get_provider($module_id);
             $feeds = $provider->feeds();
             $data = $feeds->get_feed_data_struct($module_category_id, $feed_name);
             if ($data === null) {
                 AppContext::get_response()->set_header('content-type', 'text/html');
                 DispatchManager::redirect(PHPBoostErrors::unexisting_element());
             } else {
                 $feed->load_data($data);
                 $feed->cache();
                 $this->tpl->put('SYNDICATION', $feed->export());
             }
         } else {
             DispatchManager::redirect(PHPBoostErrors::module_not_installed());
         }
     }
     return $this->build_response($this->tpl);
 }
Beispiel #2
0
$module_id = retrieve(GET, 'm', '');
if (!empty($module_id)) {
    $feed_name = retrieve(GET, 'name', DEFAULT_FEED_NAME);
    $category_id = retrieve(GET, 'cat', 0);
    $feed = null;
    switch (retrieve(GET, 'feed', 'rss')) {
        case 'atom':
            import('content/syndication/atom');
            $feed = new ATOM($module_id, $feed_name, $category_id);
            break;
        default:
            import('content/syndication/rss');
            $feed = new RSS($module_id, $feed_name, $category_id);
            break;
    }
    if ($feed != null && $feed->is_in_cache()) {
        echo $feed->read();
    } else {
        import('modules/modules_discovery_service');
        $modules_discovery_service = new ModulesDiscoveryService();
        $module = $modules_discovery_service->get_module($module_id);
        if (is_object($module) && $module->got_error() == 0 && $module->has_functionality('get_feed_data_struct')) {
            $feed->load_data($module->get_feed_data_struct($category_id, $feed_name));
            $feed->cache();
            echo $feed->export();
        } else {
            redirect('member/error.php?e=e_uninstalled_module');
        }
    }
}
require_once PATH_TO_ROOT . '/kernel/footer_no_display.php';