Example #1
0
    }
    if (strtolower($TYPE) == "atom") {
        $TYPE = "Atom .03";
    }
    $CACHE_TIME = IntVal($CACHE_TIME);
    $cache = new CPHPCache();
    $cache_id = "blog_rss_out_" . $BLOG_URL . "_" . $NUM_POSTS . "_" . $TYPE;
    $cache_path = "/" . SITE_ID . "/blog/" . $BLOG_URL . "/rss_out/" . strtolower($TYPE_CACHE) . "/";
    global $APPLICATION;
    $APPLICATION->RestartBuffer();
    header("Content-Type: text/xml");
    header("Pragma: no-cache");
    if ($CACHE_TIME > 0 && $cache->InitCache($CACHE_TIME, $cache_id, $cache_path)) {
        $cache->Output();
    } else {
        $dbBlog = CBlog::GetList(array(), array("URL" => $BLOG_URL), false, false, array("ID"));
        if ($arBlog = $dbBlog->Fetch()) {
            if ($textRSS = CBlog::BuildRSS($arBlog["ID"], $TYPE, $NUM_POSTS)) {
                if ($CACHE_TIME > 0) {
                    $cache->StartDataCache($CACHE_TIME, $cache_id, $cache_path);
                }
                echo $textRSS;
                if ($CACHE_TIME > 0) {
                    $cache->EndDataCache(array());
                }
            }
        }
    }
    die;
    //*******************************************************
}
Example #2
0
     $arFeedParams["PATH_TO_BLOG"] = $arParams["PATH_TO_BLOG"];
     $arFeedParams["PATH_TO_POST"] = $arParams["PATH_TO_POST"];
     $arFeedParams["PATH_TO_USER"] = $arParams["PATH_TO_USER"];
     $arFeedParams["NO_URL_IN_COMMENTS"] = $arParams["NO_URL_IN_COMMENTS"];
     $arFeedParams["NO_URL_IN_COMMENTS_AUTHORITY_CHECK"] = $arParams["NO_URL_IN_COMMENTS_AUTHORITY_CHECK"];
     $arFeedParams["NO_URL_IN_COMMENTS_AUTHORITY"] = $arParams["NO_URL_IN_COMMENTS_AUTHORITY"];
 }
 if ($arParams["MODE"] == "C" && !empty($arPost) || $arParams["MODE"] == "P") {
     $APPLICATION->RestartBuffer();
     header("Content-Type: text/xml");
     header("Pragma: no-cache");
     if ($arParams["CACHE_TIME"] > 0 && $cache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path)) {
         $cache->Output();
     } else {
         if ($arParams["MODE"] == "P") {
             $textRSS = CBlog::BuildRSS($arBlog["ID"], $arResult["TYPE"], $arParams["MESSAGE_COUNT"], $arParams["PATH_TO_BLOG"], $arParams["PATH_TO_POST"], $arParams["PATH_TO_USER"], $bSoNet, $arFeedParams);
         } else {
             $textRSS = CBlogComment::BuildRSS($arPost["ID"], $arBlog["ID"], $arResult["TYPE"], $arParams["MESSAGE_COUNT"], $arFeedParams);
         }
         if ($arParams["CACHE_TIME"] > 0) {
             $cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path);
         }
         echo $textRSS;
         if ($arParams["CACHE_TIME"] > 0) {
             $cache->EndDataCache(array());
         }
     }
     die;
 } else {
     ShowError(GetMessage("BLOG_RSS_NO_BLOG_POST"));
     CHTTP::SetStatus("404 Not Found");