CForumTopic::SetReadLabelsNew($res["ID"], false, false, array("UPDATE_TOPIC_VIEWS" => "N")); } while ($res = $db_res->Fetch()); } $url = $APPLICATION->GetCurPageParam("", array("ACTION", "sessid", "TID", "find_forum", "find_date1", "find_date1_DAYS_TO_BACK", "find_date2", "set_filter", "del_filter")); LocalRedirect($url); } } /******************************************************************** /Action ********************************************************************/ /*******************************************************************/ CPageOption::SetOptionString("main", "nav_page_in_session", "N"); if (!$USER->IsAuthorized()) { $rsTopics = CForumTopic::GetListEx(array($by => $order, "POSTS" => "DESC"), $arFilter, false, 500, array("sNameTemplate" => $arParams["NAME_TEMPLATE"])); while ($arTopic = $rsTopics->Fetch()) { if (!NewMessageTopic($arTopic["FORUM_ID"], $arTopic["ID"], $arTopic["LAST_POST_DATE"], false)) { continue; } $arrTOPICS[] = $arTopic; } $rsTopics = new CDBResult(); $rsTopics->InitFromArray($arrTOPICS); } else { $rsTopics = CForumTopic::GetListEx(array($by => $order, "POSTS" => "DESC"), $arFilter, false, 0, array("bDescPageNumbering" => false, "nPageSize" => $arParams["TOPICS_PER_PAGE"], "bShowAll" => false, "sNameTemplate" => $arParams["NAME_TEMPLATE"])); } $rsTopics->nPageWindow = $arParams["PAGE_NAVIGATION_WINDOW"]; $rsTopics->NavStart($arParams["TOPICS_PER_PAGE"], false); $arResult["NAV_RESULT"] = $rsTopics; $arResult["NAV_STRING"] = $rsTopics->GetPageNavStringEx($navComponentObject, GetMessage("FL_TOPIC_LIST"), $arParams["PAGE_NAVIGATION_TEMPLATE"]); while ($res = $rsTopics->GetNext()) { if (!$USER->IsAuthorized()) {
CACHE *******************************************************************/ if ($PAGEN == null && $arParams["CACHE_TIME"] > 0 && defined("BX_COMP_MANAGED_CACHE")) { $cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path); CForumCacheManager::SetTag($cache_path, "forum_msg_count" . $arParams['FID']); CForumCacheManager::SetTag($cache_path, "forum_" . $arParams['FID']); $cache->EndDataCache(array("Topics" => $arResult["Topics"], "NAV_STRING" => $arResult['NAV_STRING'], "NAV_PAGE" => $arResult['NAV_PAGE'])); } /******************************************************************* / CACHE *******************************************************************/ } $topicCount = sizeof($arResult['Topics']); for ($topicID = 0; $topicID < $topicCount; $topicID++) { $tres =& $arResult['Topics'][$topicID]; if ($tres["TopicStatus"] == "OLD" && NewMessageTopic($tres["FORUM_ID"], $tres["ID"], $arResult["PERMISSION"] < "Q" ? $tres["LAST_POST_DATE"] : $tres["ABS_LAST_POST_DATE"], $tres["LAST_VISIT"])) { $tres["TopicStatus"] = "NEW"; } } $arResult["TOPICS"] = $arResult["Topics"]; /************** Navigation *****************************************/ if (intVal($arResult["FORUM"]["FORUM_GROUP_ID"]) > 0) { $PARENT_ID = intVal($arResult["FORUM"]["FORUM_GROUP_ID"]); while ($PARENT_ID > 0) { $res = $arResult["GROUPS"][$PARENT_ID]; $res["URL"] = array("GROUP" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_FORUMS"], array("GID" => $PARENT_ID)), "~GROUP" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_FORUMS"], array("GID" => $PARENT_ID))); $arResult["GROUP_NAVIGATION"][] = $res; $PARENT_ID = intVal($arResult["GROUPS"][$PARENT_ID]["PARENT_ID"]); } $arResult["GROUP_NAVIGATION"] = array_reverse($arResult["GROUP_NAVIGATION"]); }
$arFilter["OWNER_ID"] = $arParams["USER_ID"]; $arFilter["FORUM_ID"] = $arParams["FID"]; } $db_res = CForumTopic::GetListEx(array("SORT" => "ASC", $by => $order), $arFilter, false, false, array("bDescPageNumbering" => $arParams["USE_DESC_PAGE"] == "Y" ? true : false, "nPageSize" => $arParams["TOPICS_PER_PAGE"], "bShowAll" => false, "sNameTemplate" => $arParams["NAME_TEMPLATE"])); $db_res->NavStart($arParams["TOPICS_PER_PAGE"], false); //******************************************************************/ $arResult["NAV_RESULT"] = $db_res; $arResult["NAV_STRING"] = $db_res->GetPageNavStringEx($navComponentObject, GetMessage("F_TOPIC_LIST"), $arParams["PAGE_NAVIGATION_TEMPLATE"]); while ($res = $db_res->GetNext()) { $res["STATUS"] = "OLD"; if ($res["APPROVED"] != "Y") { $res["STATUS"] = "NA"; } elseif ($res["STATE"] == "L") { $res["STATUS"] = "MOVED"; $res["URL"]["READ"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_TOPIC"], array("FID" => $res["FORUM_ID"], "TID" => $res["TOPIC_ID"], "MID" => "s")); } elseif (NewMessageTopic($res["FORUM_ID"], $res["ID"], $arParams["PERMISSION"] < "Q" ? $res["LAST_POST_DATE"] : $res["ABS_LAST_POST_DATE"], $res["LAST_VISIT"])) { $res["STATUS"] = "NEW"; } $res["TopicStatus"] = $res["STATUS"]; $res["numMessages"] = $res["POSTS"]; /*******************************************************************/ if ($arParams["PERMISSION"] >= "Q") { $res["LAST_POSTER_ID"] = $res["ABS_LAST_POSTER_ID"]; $res["LAST_POST_DATE"] = $res["ABS_LAST_POST_DATE"]; $res["LAST_POSTER_NAME"] = $res["ABS_LAST_POSTER_NAME"]; $res["LAST_MESSAGE_ID"] = $res["ABS_LAST_MESSAGE_ID"]; $res["mCnt"] = intVal($res["POSTS_UNAPPROVED"]); $res["numMessages"] += $res["mCnt"]; $res["mCntURL"] = $res["URL"]["MODERATE_MESSAGE"]; } /*******************************************************************/