$cache_path = $cache_path_main . "forums";
 if ($arParams["CACHE_TIME"] > 0 && $cache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path)) {
     $res = $cache->GetVars();
     $arForums = CForumCacheManager::Expand($res["arForums"]);
 }
 $arForums = is_array($arForums) ? $arForums : array();
 if (empty($arForums)) {
     $db_res = CForumNew::GetListEx(array("FORUM_GROUP_SORT" => "ASC", "FORUM_GROUP_ID" => "ASC", "SORT" => "ASC", "NAME" => "ASC"), $arFilter);
     if ($db_res && ($res = $db_res->GetNext())) {
         do {
             $arForums[$res["ID"]] = $res;
         } while ($res = $db_res->GetNext());
     }
     if ($arParams["CACHE_TIME"] > 0) {
         $cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path);
         $cache->EndDataCache(array("arForums" => CForumCacheManager::Compress($arForums)));
     }
 }
 $arResult["FORUMS"] = $arForums;
 $arGroupsForums = array();
 $arGroups = array();
 foreach ($arResult["FORUMS"] as $key => $res) {
     $arGroupsForums[$res["FORUM_GROUP_ID"]][$key] = $res;
 }
 foreach ($arGroupsForums as $PARENT_ID => $res) {
     $bResult = true;
     $res = array("FORUMS" => $res);
     while ($PARENT_ID > 0) {
         if (!array_key_exists($PARENT_ID, $arResult["GROUPS"])) {
             $bResult = false;
             $PARENT_ID = false;
Esempio n. 2
0
            $arResult["NAV_RESULT"] = $db_res;
            while ($res = $db_res->GetNext()) {
                if (strLen(trim($res["LAST_POST_DATE"])) > 0) {
                    $res["LAST_POST_DATE"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["LAST_POST_DATE"], CSite::GetDateFormat()));
                }
                $res["URL"] = array("AUTHOR" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["USER_START_ID"])), "~AUTHOR" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["USER_START_ID"])), "READ" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "MID" => intVal($res["LAST_MESSAGE_ID"]))) . "#message" . intVal($res["LAST_MESSAGE_ID"]), "~READ" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "MID" => intVal($res["LAST_MESSAGE_ID"]))) . "#message" . intVal($res["LAST_MESSAGE_ID"]));
                $res["user_start_id_profile"] = $res["URL"]["AUTHOR"];
                // For custom
                $res["read"] = $res["URL"]["READ"];
                // For custom
                $arTopics[] = $res;
            }
        }
    }
    $arResult['TOPICS'] = CForumCacheManager::Compress($arTopics);
    $arResult['FORUMS'] = CForumCacheManager::Compress($arForums);
    $this->EndResultCache();
    $arResult['TOPICS'] = $arTopics;
    $arResult['FORUMS'] = $arForums;
} else {
    $arResult['TOPICS'] = CForumCacheManager::Expand($arResult['TOPICS']);
    $arResult['FORUMS'] = CForumCacheManager::Expand($arResult['FORUMS']);
}
$arResult["TOPIC"] = $arResult["TOPICS"];
// For custom
$arResult["FORUM"] = $arResult["FORUMS"];
// For custom
$this->IncludeComponentTemplate();
/********************************************************************
			Data
********************************************************************/