コード例 #1
0
 /**
  * Deliver blog as rss feed
  * 
  * @param int $a_wsp_id
  */
 static function deliverRSS($a_wsp_id)
 {
     global $tpl, $ilSetting;
     if (!$ilSetting->get('enable_global_profiles')) {
         return;
     }
     // #10827
     if (substr($a_wsp_id, -4) != "_cll") {
         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
         $wsp_id = new ilWorkspaceTree(0);
         $obj_id = $wsp_id->lookupObjectId($a_wsp_id);
         $is_wsp = "_wsp";
     } else {
         $a_wsp_id = substr($a_wsp_id, 0, -4);
         $obj_id = ilObject::_lookupObjId($a_wsp_id);
         $is_wsp = null;
     }
     if (!$obj_id) {
         return;
     }
     $blog = new self($obj_id, false);
     if (!$blog->hasRSS()) {
         return;
     }
     include_once "Services/Feeds/classes/class.ilFeedWriter.php";
     $feed = new ilFeedWriter();
     include_once "Services/Link/classes/class.ilLink.php";
     $url = ilLink::_getStaticLink($a_wsp_id, "blog", true, $is_wsp);
     $url = str_replace("&", "&", $url);
     $feed->setChannelTitle($blog->getTitle());
     $feed->setChannelDescription($blog->getDescription());
     $feed->setChannelLink($url);
     // needed for blogpostinggui / pagegui
     $tpl = new ilTemplate("tpl.main.html", true, true);
     include_once "./Modules/Blog/classes/class.ilBlogPosting.php";
     include_once "./Modules/Blog/classes/class.ilBlogPostingGUI.php";
     foreach (ilBlogPosting::getAllPostings($obj_id) as $item) {
         $id = $item["id"];
         // only published items
         $is_active = ilBlogPosting::_lookupActive($id, "blp");
         if (!$is_active) {
             continue;
         }
         $snippet = strip_tags(ilBlogPostingGUI::getSnippet($id));
         $snippet = str_replace("&", "&", $snippet);
         $url = ilLink::_getStaticLink($a_wsp_id, "blog", true, "_" . $id . $is_wsp);
         $url = str_replace("&", "&", $url);
         $feed_item = new ilFeedItem();
         $feed_item->setTitle($item["title"]);
         $feed_item->setDate($item["created"]->get(IL_CAL_DATETIME));
         $feed_item->setDescription($snippet);
         $feed_item->setLink($url);
         $feed_item->setAbout($url);
         $feed->addItem($feed_item);
     }
     $feed->showFeed();
     exit;
 }
コード例 #2
0
ファイル: privfeed.php プロジェクト: arlendotcn/ilias
     $writer->showFeed();
 } else {
     // send appropriate header, if password is wrong, otherwise
     // there is no chance to re-enter it (unless, e.g. the browser is closed)
     if (md5($_SERVER['PHP_AUTH_PW']) != ilObjUser::_getFeedPass(ilObjUser::_lookupId($_SERVER['PHP_AUTH_USER']))) {
         Header("WWW-Authenticate: Basic realm=\"ILIAS Newsfeed\"");
         Header("HTTP/1.0 401 Unauthorized");
         exit;
     }
     include_once "./Services/Feeds/classes/class.ilFeedItem.php";
     include_once "./Services/Feeds/classes/class.ilFeedWriter.php";
     $blankFeedWriter = new ilFeedWriter();
     $feed_item = new ilFeedItem();
     $lng->loadLanguageModule("news");
     if ($ilSetting->get('short_inst_name') != "") {
         $blankFeedWriter->setChannelTitle($ilSetting->get('short_inst_name'));
     } else {
         $blankFeedWriter->setChannelTitle("ILIAS");
     }
     if (!$feed_set->get("enable_private_feed")) {
         $blankFeedWriter->setChannelAbout(ILIAS_HTTP_PATH);
         $blankFeedWriter->setChannelLink(ILIAS_HTTP_PATH);
         // title
         $feed_item->setTitle($lng->txt("priv_feed_no_access_title"));
         // description
         $feed_item->setDescription($lng->txt("priv_feed_no_access_body"));
         $feed_item->setLink(ILIAS_HTTP_PATH);
     } else {
         $blankFeedWriter->setChannelAbout(ILIAS_HTTP_PATH);
         $blankFeedWriter->setChannelLink(ILIAS_HTTP_PATH);
         // title