本文整理汇总了PHP中CUserCounter类的典型用法代码示例。如果您正苦于以下问题:PHP CUserCounter类的具体用法?PHP CUserCounter怎么用?PHP CUserCounter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CUserCounter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Update
public static function Update($id, $arFields)
{
global $DB;
$id = intval($id);
if ($id <= 0) {
throw new Exception("id");
}
self::ParseFields($arFields, $id);
$strUpdate = $DB->PrepareUpdate("b_bp_task", $arFields);
$strSql = "UPDATE b_bp_task SET " . "\t" . $strUpdate . ", " . "\tMODIFIED = " . $DB->CurrentTimeFunction() . " " . "WHERE ID = " . intval($id) . " ";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if (is_set($arFields, "USERS")) {
$DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = " . intval($id) . " ");
CUserCounter::ClearByTag($id, 'bp_tasks', '**');
$ar = array();
foreach ($arFields["USERS"] as $userId) {
$userId = intval($userId);
if (in_array($userId, $ar)) {
continue;
}
$DB->Query("INSERT INTO b_bp_task_user (USER_ID, TASK_ID) " . "VALUES (" . intval($userId) . ", " . intval($id) . ") ");
CUserCounter::Increment($userId, 'bp_tasks', '**');
$ar[] = $userId;
}
}
$events = GetModuleEvents("bizproc", "OnTaskUpdate");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($id, $arFields));
}
return $id;
}
示例2: Update
public static function Update($id, $arFields)
{
global $DB;
$id = intval($id);
if ($id <= 0) {
throw new Exception("id");
}
self::ParseFields($arFields, $id);
$strUpdate = $DB->PrepareUpdate("b_bp_task", $arFields);
$strSql = "UPDATE b_bp_task SET " . "\t" . $strUpdate . ", " . "\tMODIFIED = " . $DB->CurrentTimeFunction() . " " . "WHERE ID = " . intval($id) . " ";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$removedUsers = array();
if (is_set($arFields, "USERS")) {
$dbResUser = $DB->Query("SELECT USER_ID FROM b_bp_task_user WHERE TASK_ID = " . intval($id) . " ");
while ($arResUser = $dbResUser->Fetch()) {
CUserCounter::Decrement($arResUser["USER_ID"], 'bp_tasks', '**');
$removedUsers[] = $arResUser["USER_ID"];
}
$DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = " . intval($id) . " ");
$ar = array();
foreach ($arFields["USERS"] as $userId) {
$userId = intval($userId);
if (in_array($userId, $ar)) {
continue;
}
$DB->Query("INSERT INTO b_bp_task_user (USER_ID, TASK_ID, ORIGINAL_USER_ID) " . "VALUES (" . intval($userId) . ", " . intval($id) . ", " . intval($userId) . ") ");
CUserCounter::Increment($userId, 'bp_tasks', '**');
$ar[] = $userId;
}
}
$userStatuses = array();
if (isset($arFields['STATUS']) && $arFields['STATUS'] > CBPTaskStatus::Running) {
$dbResUser = $DB->Query("SELECT USER_ID FROM b_bp_task_user WHERE TASK_ID = " . $id . " AND STATUS = " . CBPTaskUserStatus::Waiting);
while ($arResUser = $dbResUser->Fetch()) {
CUserCounter::Decrement($arResUser["USER_ID"], 'bp_tasks', '**');
if ($arFields['STATUS'] == CBPTaskStatus::Timeout) {
$userStatuses[$arResUser["USER_ID"]] = CBPTaskUserStatus::No;
} else {
$removedUsers[] = $arResUser["USER_ID"];
}
}
if ($arFields['STATUS'] == CBPTaskStatus::Timeout) {
$DB->Query("UPDATE b_bp_task_user SET STATUS = " . CBPTaskUserStatus::No . ", DATE_UPDATE = " . $DB->CurrentTimeFunction() . " WHERE TASK_ID = " . $id . " AND STATUS = " . CBPTaskUserStatus::Waiting);
} else {
$DB->Query("DELETE FROM b_bp_task_user WHERE TASK_ID = " . $id . " AND STATUS = " . CBPTaskUserStatus::Waiting);
}
}
foreach (GetModuleEvents("bizproc", "OnTaskUpdate", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($id, $arFields));
}
if ($removedUsers) {
$arFields['USERS_REMOVED'] = $removedUsers;
}
if ($userStatuses) {
$arFields['USERS_STATUSES'] = $userStatuses;
}
self::onTaskChange($id, $arFields, CBPTaskChangedStatus::Update);
return $id;
}
示例3: array
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
$arResult["urlToOwnBlog"] = "";
$arResult["urlToOwnProfile"] = "";
if (CModule::IncludeModule("blog") && $GLOBALS["USER"]->IsAuthorized()) {
$arResult["urlToCreateMessageInBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG_NEW_POST"], array("user_id" => $GLOBALS["USER"]->GetID(), "post_id" => "new"));
}
if ($GLOBALS["USER"]->IsAuthorized()) {
$arResult["urlToOwnProfile"] = CComponentEngine::MakePathFromTemplate($arParams["PROFILE_URL"], array("user_id" => $GLOBALS["USER"]->GetID()));
$arCounters = CUserCounter::GetValues($GLOBALS["USER"]->GetID(), SITE_ID);
$arResult["LOG_COUNTER"] = isset($arCounters["**"]) ? intval($arCounters["**"]) : 0;
}
示例4: GetMessage
} else {
$arResult['ID'] = CMailbox::Add($arFields);
$res = $arResult['ID'] > 0;
}
if (!$res) {
$arResult['ERRORS'][] = GetMessage('INTR_MAIL_SAVE_ERROR');
} else {
CUserCounter::Set($USER->GetID(), 'mail_unseen', $unseen, SITE_ID);
CUserOptions::SetOption('global', 'last_mail_check_' . SITE_ID, time());
CUserOptions::SetOption('global', 'last_mail_check_success_' . SITE_ID, $unseen >= 0);
LocalRedirect($APPLICATION->GetCurPage() . '?STEP=confirm&ACT=setup');
}
}
}
break;
case 'remove':
if (check_bitrix_sessid()) {
CMailbox::Delete($arResult['ID']);
CUserCounter::Clear($USER->GetID(), 'mail_unseen', SITE_ID);
CUserOptions::DeleteOption('global', 'last_mail_check_' . SITE_ID);
CUserOptions::DeleteOption('global', 'last_mail_check_success_' . SITE_ID);
LocalRedirect($APPLICATION->GetCurPage() . '?STEP=confirm&ACT=remove');
} else {
LocalRedirect($APPLICATION->GetCurPage() . '?STEP=setup');
}
break;
case 'confirm':
$arResult['ACT'] = isset($_REQUEST['ACT']) ? $_REQUEST['ACT'] : '';
break;
}
$this->IncludeComponentTemplate();
示例5: list
case 'crdomain':
list($acc['login'], $acc['domain']) = explode('@', $acc['LOGIN'], 2);
$crCheckMailbox = CControllerClient::ExecuteEvent('OnMailControllerCheckMemberMailbox', array('DOMAIN' => $acc['domain'], 'NAME' => $acc['login']));
if (isset($crCheckMailbox['result'])) {
$unseen = intval($crCheckMailbox['result']);
} else {
$unseen = -1;
$error = empty($crCheckMailbox['error']) ? GetMessage('INTR_MAIL_CONTROLLER_INVALID') : CMail::getErrorMessage($crCheckMailbox['error']);
}
break;
case 'domain':
$service = \Bitrix\Mail\MailServicesTable::getRowById($acc['SERVICE_ID']);
list($acc['login'], $acc['domain']) = explode('@', $acc['LOGIN'], 2);
$result = CMailDomain2::getUnreadMessagesCount($service['TOKEN'], $acc['domain'], $acc['login'], $error);
if (is_null($result)) {
$unseen = -1;
$error = CMail::getErrorMessage($error);
} else {
$unseen = intval($result);
}
break;
}
CUserCounter::Set($userId, 'mail_unseen', $unseen, $siteId);
CUserOptions::SetOption('global', 'last_mail_check_' . $siteId, time(), false, $userId);
CUserOptions::SetOption('global', 'last_mail_check_success_' . $siteId, $unseen >= 0, false, $userId);
} else {
$unseen = 0;
CUserOptions::SetOption('global', 'last_mail_check_' . $siteId, -1, false, $userId);
}
header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
echo json_encode(array('result' => $error === false ? 'ok' : 'error', 'unseen' => $unseen, 'last_check' => CUserOptions::GetOption('global', 'last_mail_check_' . $siteId, false, $userId), 'error' => $error));
示例6: GetBadge
public static function GetBadge($userId)
{
return 0;
$count = 0;
$count += CUserCounter::GetValue($userId, 'im_notify_v2', '**');
$count += CUserCounter::GetValue($userId, 'im_chat_v2', '**');
$count += CUserCounter::GetValue($userId, 'im_message_v2', '**');
return $count;
}
示例7: MessageUpdate
public static function MessageUpdate($REPORT_ID, $arReport = array(), $arFields = array())
{
global $DB, $USER;
$curUser = $USER->GetID();
if (CModule::IncludeModule("socialnetwork")) {
$dbLog = CSocNetLog::GetList(array(), array("SOURCE_ID" => $REPORT_ID, "EVENT_ID" => "report"));
if (!($arLog = $dbLog->Fetch())) {
$LOG_ID = CReportNotifications::SendMessage($REPORT_ID, false);
} else {
$LOG_ID = $arLog["ID"];
CSocNetLog::Update($LOG_ID, array("USER_ID" => $curUser, "=LOG_DATE" => $DB->CurrentTimeFunction(), "=LOG_UPDATE" => $DB->CurrentTimeFunction()));
CUserCounter::IncrementWithSelect(CSocNetLogCounter::GetSubSelect($LOG_ID, $arLog["ENTITY_TYPE"], $arLog["ENTITY_ID"], $arLog["EVENT_ID"], $arLog["USER_ID"]));
}
if (CModule::IncludeModule("im") && is_array($arFields) && is_array($arReport) && intval($arReport["USER_ID"]) > 0 && $arReport["USER_ID"] != $curUser) {
$date_text = "";
$date_from = FormatDate("j F", MakeTimeStamp($arReport["DATE_FROM"], CSite::GetDateFormat("FULL", SITE_ID)));
$date_to = FormatDate("j F", MakeTimeStamp($arReport["DATE_TO"], CSite::GetDateFormat("FULL", SITE_ID)));
if ($date_from == $date_to) {
$date_text = $date_to;
} else {
$date_text = $date_from . " - " . $date_to;
}
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arReport["USER_ID"], "FROM_USER_ID" => $curUser, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "timeman", "NOTIFY_EVENT" => "report_approve", "NOTIFY_TAG" => "TIMEMAN|REPORT|" . $arReport["ID"] . "_" . $arFields["MARK"]);
$gender_suffix = "";
$dbUser = CUser::GetByID($curUser);
if ($arUser = $dbUser->Fetch()) {
switch ($arUser["PERSONAL_GENDER"]) {
case "M":
$gender_suffix = "_M";
break;
case "F":
$gender_suffix = "_F";
break;
default:
$gender_suffix = "";
}
}
$reports_page = COption::GetOptionString("timeman", "WORK_REPORT_PATH", "/company/work_report.php");
$arTmp = CSocNetLogTools::ProcessPath(array("REPORTS_PAGE" => $reports_page), $arReport["USER_ID"]);
switch ($arFields["MARK"]) {
case "G":
$mark = "G";
break;
case "B":
$mark = "B";
break;
case "X":
$mark = "X";
break;
default:
$mark = "N";
}
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("REPORT_FULL_IM_APPROVE" . $gender_suffix . "_" . $mark, array("#period#" => "<a href=\"" . $arTmp["URLS"]["REPORTS_PAGE"] . "#user_id=" . $arReport["USER_ID"] . "&report=" . $REPORT_ID . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($date_text) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("REPORT_FULL_IM_APPROVE" . $gender_suffix . "_" . $mark, array("#period#" => htmlspecialcharsbx($date_text))) . " ( " . $arTmp["SERVER_NAME"] . $arTmp["URLS"]["REPORTS_PAGE"] . "#user_id=" . $arReport["USER_ID"] . "&report=" . $REPORT_ID . " )";
CIMNotify::Add($arMessageFields);
}
$dbLogRights = CSocNetLogRights::GetList(array(), array("LOG_ID" => $LOG_ID));
while ($arRight = $dbLogRights->Fetch()) {
$arRights[] = $arRight["GROUP_CODE"];
}
if (!in_array("U" . $curUser, $arRights)) {
CSocNetLogRights::Add($LOG_ID, "U" . $curUser);
}
return $LOG_ID;
} else {
return false;
}
}
示例8: Delete
function Delete($ID)
{
global $DB;
$ID = IntVal($ID);
$db_msg = CMailMessage::GetList(Array(), Array("MAILBOX_ID"=>$ID));
while($msg = $db_msg->Fetch())
{
if(!CMailMessage::Delete($msg["ID"]))
return false;
}
$db_flt = CMailFilter::GetList(Array(), Array("MAILBOX_ID"=>$ID));
while($flt = $db_flt->Fetch())
{
if(!CMailFilter::Delete($flt["ID"]))
return false;
}
$db_log = CMailLog::GetList(Array(), Array("MAILBOX_ID"=>$ID));
while($log = $db_log->Fetch())
{
if(!CMailLog::Delete($log["ID"]))
return false;
}
$db_mbox = CMailbox::GetList(array('ID' => $ID, 'ACTIVE' => 'Y', '!USER_ID' => 0));
if ($mbox = $db_mbox->fetch())
{
CUserCounter::Clear($mbox['USER_ID'], 'mail_unseen', $mbox['LID']);
CUserOptions::DeleteOption('global', 'last_mail_check_'.$mbox['LID'], false, $mbox['USER_ID']);
CUserOptions::DeleteOption('global', 'last_mail_check_success_'.$mbox['LID'], false, $mbox['USER_ID']);
}
CAgent::RemoveAgent("CMailbox::CheckMailAgent(".$ID.");", "mail");
$strSql = "DELETE FROM b_mail_message_uid WHERE MAILBOX_ID=".$ID;
if(!$DB->Query($strSql, true))
return false;
CMailbox::SMTPReload();
$strSql = "DELETE FROM b_mail_mailbox WHERE ID=".$ID;
return $DB->Query($strSql, true);
}
示例9: CounterDecrement
public static function CounterDecrement($log_id, $event_id = false, $type = "L", $bForAllAccess = false)
{
if (intval($log_id) <= 0) {
return false;
}
CUserCounter::IncrementWithSelect(CSocNetLogCounter::GetSubSelect2($log_id, array("TYPE" => $type, "DECREMENT" => true, "FOR_ALL_ACCESS" => $bForAllAccess)));
if ($event_id == "blog_post_important") {
CUserCounter::IncrementWithSelect(CSocNetLogCounter::GetSubSelect2($log_id, array("TYPE" => "L", "CODE" => "'BLOG_POST_IMPORTANT'", "DECREMENT" => true, "FOR_ALL_ACCESS" => $bForAllAccess)));
}
}
示例10: DeleteByCode
public static function DeleteByCode($code)
{
global $DB, $APPLICATION, $CACHE_MANAGER;
if (strlen($code) <= 0) {
return false;
}
$pullMessage = array();
$bPullEnabled = false;
if (self::CheckLiveMode()) {
$db_lock = $DB->Query("SELECT GET_LOCK('" . $APPLICATION->GetServerUniqID() . "_pull', 0) as L");
$ar_lock = $db_lock->Fetch();
if ($ar_lock["L"] > 0) {
$bPullEnabled = true;
$arSites = array();
$res = CSite::GetList($b = "", $o = "", array("ACTIVE" => "Y"));
while ($row = $res->Fetch()) {
$arSites[] = $row['ID'];
}
$strSQL = "\n\t\t\t\t\tSELECT distinct pc.CHANNEL_ID, uc.USER_ID, uc.SITE_ID, uc.CODE, uc.CNT\n\t\t\t\t\tFROM b_user_counter uc\n\t\t\t\t\tINNER JOIN b_pull_channel pc ON pc.USER_ID = uc.USER_ID\n\t\t\t\t\tWHERE uc.CODE LIKE '**%'\n\t\t\t\t";
$res = $DB->Query($strSQL, false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
while ($row = $res->Fetch()) {
if ($row["CODE"] == $code) {
continue;
}
CUserCounter::addValueToPullMessage($row, $arSites, $pullMessage);
}
}
}
$DB->Query("DELETE FROM b_user_counter WHERE CODE = '" . $code . "'", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
self::$counters = false;
$CACHE_MANAGER->CleanDir("user_counter");
if ($bPullEnabled) {
$DB->Query("SELECT RELEASE_LOCK('" . $APPLICATION->GetServerUniqID() . "_pull')");
}
foreach ($pullMessage as $channelId => $arMessage) {
CPullStack::AddByChannel($channelId, array('module_id' => 'main', 'command' => 'user_counter', 'params' => $arMessage));
}
}
示例11: ConvertTimeStamp
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 {
示例12: define
define("NOT_CHECK_PERMISSIONS", true);
define("PUBLIC_AJAX_MODE", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/bx_root.php";
$cuid = IntVal($_REQUEST["cuid"]);
$site_id = isset($_REQUEST["site"]) && is_string($_REQUEST["site"]) ? trim($_REQUEST["site"]) : "";
if (isset($_REQUEST["is"])) {
$ImageSize = intval($_REQUEST["is"]);
} else {
$ImageSize = 0;
}
if ($ImageSize <= 0) {
$ImageSize = 42;
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
if ($GLOBALS["USER"]->IsAuthorized()) {
$log_cnt = CUserCounter::GetValueByUserID($GLOBALS["USER"]->GetID(), $site);
}
if ($CACHE_MANAGER->Read(86400 * 30, "socnet_cm_" . $cuid) && $CACHE_MANAGER->Read(86400 * 30, "socnet_cf_" . $cuid) && $CACHE_MANAGER->Read(86400 * 30, "socnet_cg_" . $cuid)) {
if (intval($log_cnt) > 0) {
$arData = array(array("LOG_CNT" => $log_cnt));
echo CUtil::PhpToJSObject($arData);
define('PUBLIC_AJAX_MODE', true);
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
die;
}
$rsSites = CSite::GetByID($site);
if ($arSite = $rsSites->Fetch()) {
$DateTimeFormat = $arSite["FORMAT_DATETIME"];
__IncludeLang(dirname(__FILE__) . "/lang/" . $arSite["LANGUAGE_ID"] . "/get_message_2.php");
} else {
示例13: isset
return;
else
define("IM_COMPONENT_INIT", true);
if (intval($USER->GetID()) <= 0)
return;
if (!CModule::IncludeModule('im'))
return;
$arParams["DESKTOP"] = isset($arParams['DESKTOP']) && $arParams['DESKTOP'] == 'Y'? 'Y': 'N';
$arResult = Array();
// Counters
$arResult["COUNTERS"] = CUserCounter::GetValues($USER->GetID(), SITE_ID);
CIMContactList::SetOnline(null, true);
if ($arParams['DESKTOP'] == 'Y')
{
$GLOBALS["APPLICATION"]->SetPageProperty("BodyClass", "im-desktop");
CIMMessenger::SetDesktopStatusOnline();
}
$arParams["INIT"] = 'Y';
$arParams["DESKTOP_LINK_OPEN"] = 'N';
// Exchange
$arResult["PATH_TO_USER_MAIL"] = "";
$arResult["MAIL_COUNTER"] = 0;
示例14: foreach
}
}
}
}
}
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();
示例15: intval
}
$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;