예제 #1
0
            $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;
    } else {
        $ttl = 600;
    }
    if ($cache->InitCache($ttl, $cache_id, $cache_path)) {
        $Vars = $cache->GetVars();
예제 #2
0
        $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 {
        $arResult["FOLLOW_DEFAULT"] = COption::GetOptionString("socialnetwork", "follow_default_type", "Y");
    }
}
예제 #3
0
파일: component.php 프로젝트: vim84/b-markt
        $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"]);
        CUserCounter::ClearByUser($user_id, SITE_ID, "BLOG_POST_IMPORTANT");
    }
    if ($GLOBALS["USER"]->IsAuthorized() && $arParams["SET_LOG_PAGE_CACHE"] == "Y" && $dateLastPage && (!$dateLastPageStart || $dateLastPageStart != $dateLastPage || $bNeedSetLogPage)) {
        CSocNetLogPages::Set($user_id, $dateLastPage, $arParams["PAGE_SIZE"], $arResult["PAGE_NUMBER"], SITE_ID, strlen($arResult["COUNTER_TYPE"]) > 0 ? $arResult["COUNTER_TYPE"] : "**");
    }
} else {
    $arResult["NEED_AUTH"] = "Y";
}
if ($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;
    } else {
        $ttl = 600;
    }
    if ($cache->InitCache($ttl, $cache_id, $cache_path)) {
        $Vars = $cache->GetVars();
예제 #4
0
                }
            }
        }
    }
}
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();
예제 #5
0
$arResult["MODE"] = isset($_REQUEST["SONET_FILTER_MODE"]) && $_REQUEST["SONET_FILTER_MODE"] == "AJAX" ? "AJAX" : false;
if ($GLOBALS["USER"]->IsAuthorized() || $arParams["AUTH"] == "Y" || $arParams["SUBSCRIBE_ONLY"] != "Y") {
    $arResult["DATE_FILTER"] = array("" => GetMessage("SONET_C30_DATE_FILTER_NO_NO_NO_1"), "today" => GetMessage("SONET_C30_DATE_FILTER_TODAY"), "yesterday" => GetMessage("SONET_C30_DATE_FILTER_YESTERDAY"), "week" => GetMessage("SONET_C30_DATE_FILTER_WEEK"), "week_ago" => GetMessage("SONET_C30_DATE_FILTER_WEEK_AGO"), "month" => GetMessage("SONET_C30_DATE_FILTER_MONTH"), "month_ago" => GetMessage("SONET_C30_DATE_FILTER_MONTH_AGO"), "days" => GetMessage("SONET_C30_DATE_FILTER_LAST"), "exact" => GetMessage("SONET_C30_DATE_FILTER_EXACT"), "after" => GetMessage("SONET_C30_DATE_FILTER_LATER"), "before" => GetMessage("SONET_C30_DATE_FILTER_EARLIER"), "interval" => GetMessage("SONET_C30_DATE_FILTER_INTERVAL"));
}
$arResult["FOLLOW_TYPE"] = "";
if ($GLOBALS["USER"]->IsAuthorized()) {
    $arParams["SHOW_SMART_FILTER_MYGROUPS"] = $arParams["USE_SMART_FILTER"];
    if (array_key_exists("set_follow_type", $_GET)) {
        CSocNetLogFollow::Set($GLOBALS["USER"]->GetID(), "**", $_GET["set_follow_type"] == "Y" ? "Y" : "N", false);
        if ($_GET["set_follow_type"] != "Y") {
            $_SESSION["SL_SHOW_FOLLOW_HINT"] = "Y";
        }
        LocalRedirect("");
    } elseif ($arParams["USE_SMART_FILTER"] == "Y" && array_key_exists("set_smart_filter_mygroups", $_GET)) {
        CSocNetLogSmartFilter::Set($GLOBALS["USER"]->GetID(), $_GET["set_smart_filter_mygroups"] == "Y" ? "Y" : "N");
        CSocNetLogPages::DeleteEx($GLOBALS["USER"]->GetID(), SITE_ID);
        LocalRedirect("");
    }
    $arResult["FOLLOW_TYPE"] = CSocNetLogFollow::GetDefaultValue($GLOBALS["USER"]->GetID());
}
$arResult["flt_created_by_string"] = "";
if (strlen($_REQUEST["flt_created_by_string"]) > 0) {
    $arResult["flt_created_by_string"] = $_REQUEST["flt_created_by_string"];
} else {
    if (is_array($_REQUEST["flt_created_by_id"]) && intval($_REQUEST["flt_created_by_id"][0]) > 0) {
        $user_id_tmp = $_REQUEST["flt_created_by_id"][0];
    } elseif (intval($_REQUEST["flt_created_by_id"]) > 0) {
        $user_id_tmp = $_REQUEST["flt_created_by_id"];
    }
    if (intval($user_id_tmp) > 0) {
        $rsUser = CUser::GetByID($user_id_tmp);