} $arResult["WORKGROUPS_PAGE"] = $folderWorkgroups; if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_COUNTER"] == "Y") { $arCounters = CUserCounter::GetValues($user_id, SITE_ID); if (isset($arCounters[$arResult["COUNTER_TYPE"]])) { $arResult["LOG_COUNTER"] = intval($arCounters[$arResult["COUNTER_TYPE"]]); } else { $bEmptyCounter = true; $arResult["LOG_COUNTER"] = 0; } } else { $arParams["SHOW_UNREAD"] = "N"; } if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_COUNTER"] == "Y" && (intval($arResult["LOG_COUNTER"]) > 0 || $bEmptyCounter)) { CUserCounter::ClearByUser($user_id, array(SITE_ID, "**"), $arResult["COUNTER_TYPE"], true); CUserCounter::ClearByUser($user_id, SITE_ID, "BLOG_POST_IMPORTANT"); } if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_PAGE_CACHE"] == "Y" && $dateLastPage && (!$dateLastPageStart || $dateLastPageStart != $dateLastPage || $bNeedSetLogPage)) { $groupCode = strlen($arResult["COUNTER_TYPE"]) > 0 ? $arResult["COUNTER_TYPE"] : "**"; $bNeedSetTraffic = CSocNetLogComponent::isSetTrafficNeeded(array("PAGE_NUMBER" => $arResult["PAGE_NUMBER"], "GROUP_CODE" => $groupCode, "TRAFFIC_LAST_DATE_TS" => $arLastPageStart['TRAFFIC_LAST_DATE_TS'])); CSocNetLogPages::Set($user_id, $dateLastPage, $arParams["PAGE_SIZE"], $arResult["PAGE_NUMBER"], SITE_ID, $groupCode, $bNeedSetTraffic ? ($arLastPageStart['TRAFFIC_AVG'] + $dateFirstPageTS - $arResult["dateLastPageTS"]) / ($arLastPageStart['TRAFFIC_CNT'] + 1) : false, $bNeedSetTraffic ? $arLastPageStart['TRAFFIC_CNT'] + 1 : false); } } else { $arResult["NEED_AUTH"] = "Y"; } if (!isset($arResult["FatalError"]) && $GLOBALS["USER"]->IsAuthorized() && !$arResult["AJAX_CALL"]) { $cache = new CPHPCache(); $cache_id = "log_form_comments" . serialize($arParams["COMMENT_PROPERTY"]); $cache_path = "/sonet/log_form/comments"; if (defined("BX_COMP_MANAGED_CACHE")) { $ttl = 2592000;
} } } } } foreach ($arTmpEventsNew as $arTmpEvent) { if (!is_array($_SESSION["SONET_LOG_ID"]) || !in_array($arTmpEvent["EVENT"]["ID"], $_SESSION["SONET_LOG_ID"])) { $_SESSION["SONET_LOG_ID"][] = $arTmpEvent["EVENT"]["ID"]; } $arResult["EventsNew"][] = $arTmpEvent; } if ($arTmpEvent["EVENT"]["DATE_FOLLOW"]) { $dateLastPage = ConvertTimeStamp(MakeTimeStamp($arTmpEvent["EVENT"]["DATE_FOLLOW"], CSite::GetDateFormat("FULL")), "FULL"); } $arResult["WORKGROUPS_PAGE"] = COption::GetOptionString("socialnetwork", "workgroups_page", "/workgroups/", SITE_ID); if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_COUNTER"] == "Y") { CUserCounter::ClearByUser($GLOBALS["USER"]->GetID(), SITE_ID, $arResult["COUNTER_TYPE"]); CUserCounter::ClearByUser($GLOBALS["USER"]->GetID(), "**", $arResult["COUNTER_TYPE"]); } if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_PAGE_CACHE"] == "Y" && $dateLastPage) { CSocNetLogPages::Set($GLOBALS["USER"]->GetID(), $dateLastPage, $arParams["PAGE_SIZE"], $arResult["PAGE_NUMBER"], SITE_ID); } if ($GLOBALS["USER"]->IsAuthorized() && $arParams["USE_FOLLOW"] == "Y") { $rsFollow = CSocNetLogFollow::GetList(array("USER_ID" => $GLOBALS["USER"]->GetID(), "CODE" => "**"), array("TYPE")); if ($arFollow = $rsFollow->Fetch()) { $arResult["FOLLOW_DEFAULT"] = $arFollow["TYPE"]; } else { $arResult["FOLLOW_DEFAULT"] = COption::GetOptionString("socialnetwork", "follow_default_type", "Y"); } } $this->IncludeComponentTemplate();
if ($arTmpEvent["DATE_FOLLOW"]) { $dateLastPage = ConvertTimeStamp(MakeTimeStamp($arTmpEvent["DATE_FOLLOW"], CSite::GetDateFormat("FULL")), "FULL"); } elseif ($arParams["USE_FOLLOW"] == "N" && $arTmpEvent["LOG_UPDATE"]) { $dateLastPage = ConvertTimeStamp(MakeTimeStamp($arTmpEvent["LOG_UPDATE"], CSite::GetDateFormat("FULL")), "FULL"); } if ($arParams["LOG_ID"] <= 0 && intval($arParams["NEW_LOG_ID"]) <= 0 && $GLOBALS["USER"]->IsAuthorized()) { $arCounters = CUserCounter::GetValues($GLOBALS["USER"]->GetID(), SITE_ID); if (isset($arCounters[$arResult["COUNTER_TYPE"]])) { $arResult["LOG_COUNTER"] = intval($arCounters[$arResult["COUNTER_TYPE"]]); } else { $bEmptyCounter = true; $arResult["LOG_COUNTER"] = 0; } } if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_COUNTER"] == "Y" && (intval($arResult["LOG_COUNTER"]) > 0 || $bEmptyCounter)) { CUserCounter::ClearByUser($GLOBALS["USER"]->GetID(), array(SITE_ID, "**"), $arResult["COUNTER_TYPE"]); } if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_PAGE_CACHE"] == "Y" && $dateLastPage && (!$dateLastPageStart || $dateLastPageStart != $dateLastPage || $bNeedSetLogPage)) { CSocNetLogPages::Set($GLOBALS["USER"]->GetID(), $dateLastPage, $arParams["PAGE_SIZE"], $arResult["PAGE_NUMBER"], SITE_ID, strlen($arResult["COUNTER_TYPE"]) > 0 ? $arResult["COUNTER_TYPE"] : "**"); } } else { $rsCurrentUser = CUser::GetByID($GLOBALS["USER"]->GetID()); if ($arCurrentUser = $rsCurrentUser->Fetch()) { $arResult["EmptyComment"] = array("AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arCurrentUser, $arParams, ""), "AUTHOR_NAME" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arCurrentUser, $bUseLogin)); } } if ($GLOBALS["USER"]->IsAuthorized() && $arParams["USE_FOLLOW"] == "Y") { $rsFollow = CSocNetLogFollow::GetList(array("USER_ID" => $GLOBALS["USER"]->GetID(), "CODE" => "**"), array("TYPE")); if ($arFollow = $rsFollow->Fetch()) { $arResult["FOLLOW_DEFAULT"] = $arFollow["TYPE"]; } else {
$arParams["SHOW_UNREAD"] = "N"; if ( $GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_COUNTER"] == "Y" && (intval($arResult["LOG_COUNTER"]) > 0 || $bEmptyCounter) ) { CUserCounter::ClearByUser( $GLOBALS["USER"]->GetID(), array(SITE_ID, "**"), $arResult["COUNTER_TYPE"] ); CUserCounter::ClearByUser( $GLOBALS["USER"]->GetID(), SITE_ID, "BLOG_POST_IMPORTANT" ); } if ( $GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_PAGE_CACHE"] == "Y" && $dateLastPage && ( !$dateLastPageStart || $dateLastPageStart != $dateLastPage || $bNeedSetLogPage ) ) {