本文整理汇总了PHP中CSocNetLogTools::FindFeatureByEventID方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogTools::FindFeatureByEventID方法的具体用法?PHP CSocNetLogTools::FindFeatureByEventID怎么用?PHP CSocNetLogTools::FindFeatureByEventID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetLogTools
的用法示例。
在下文中一共展示了CSocNetLogTools::FindFeatureByEventID方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
}
if (!$GLOBALS["USER"]->IsAuthorized())
$arResult[0] = "*";
elseif (!check_bitrix_sessid())
$arResult[0] = "*";
elseif ($action == "add_comment")
{
$log_id = $_REQUEST["log_id"];
if ($arLog = CSocNetLog::GetByID($log_id))
{
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($arLog["EVENT_ID"]);
if ($arCommentEvent)
{
$feature = CSocNetLogTools::FindFeatureByEventID($arCommentEvent["EVENT_ID"]);
if ($feature && array_key_exists("OPERATION_ADD", $arCommentEvent) && strlen($arCommentEvent["OPERATION_ADD"]) > 0)
$bCanAddComments = CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arLog["ENTITY_TYPE"], $arLog["ENTITY_ID"], ($feature == "microblog" ? "blog" : $feature), $arCommentEvent["OPERATION_ADD"], $bCurrentUserIsAdmin);
else
$bCanAddComments = true;
if ($bCanAddComments)
{
// add source object and get source_id, $source_url
$arParams = array(
"PATH_TO_SMILE" => $_REQUEST["p_smile"],
"PATH_TO_USER_BLOG_POST" => $_REQUEST["p_ubp"],
"PATH_TO_GROUP_BLOG_POST" => $_REQUEST["p_gbp"],
"PATH_TO_USER_MICROBLOG_POST" => $_REQUEST["p_umbp"],
"PATH_TO_GROUP_MICROBLOG_POST" => $_REQUEST["p_gmbp"],
示例2: __SLEGetLogRecord
//.........这里部分代码省略.........
}
$arEvent["MESSAGE_FORMAT"] = htmlspecialcharsback($arEvent["MESSAGE"]);
if (StrLen($arEvent["CALLBACK_FUNC"]) > 0) {
if (StrLen($arEvent["MODULE_ID"]) > 0) {
CModule::IncludeModule($arEvent["MODULE_ID"]);
}
$arEvent["MESSAGE_FORMAT"] = call_user_func($arEvent["CALLBACK_FUNC"], $arEvent);
}
$arEvent["FIELDS_FORMATTED"]["LOG_TIME_FORMAT"] = $timeFormated;
$arEvent["FIELDS_FORMATTED"]["LOG_UPDATE_TS"] = MakeTimeStamp($arEvent["LOG_UPDATE"]);
$arEvent["FIELDS_FORMATTED"]["LOG_DATE_TS"] = MakeTimeStamp($arEvent["LOG_DATE"]);
$arEvent["FIELDS_FORMATTED"]["LOG_DATE_DAY"] = ConvertTimeStamp(MakeTimeStamp($arEvent["LOG_DATE"]), "SHORT");
$arEvent["FIELDS_FORMATTED"]["LOG_UPDATE_DAY"] = ConvertTimeStamp(MakeTimeStamp($arEvent["LOG_UPDATE"]), "SHORT");
$arEvent["FIELDS_FORMATTED"]["COMMENTS_COUNT"] = $arEvent["COMMENTS_COUNT"];
$arEvent["FIELDS_FORMATTED"]["TMP_ID"] = $arEvent["TMP_ID"];
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $dateTimeFormated;
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($arEvent["EVENT_ID"]);
if (!array_key_exists("HAS_COMMENTS", $arEvent["FIELDS_FORMATTED"]) || $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] != "N") {
$arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] = $arCommentEvent && (!array_key_exists("ENABLE_COMMENTS", $arEvent) || $arEvent["ENABLE_COMMENTS"] != "N") ? "Y" : "N";
}
}
}
if (is_object($cache)) {
$arCacheData = array("FIELDS_FORMATTED" => $arEvent["FIELDS_FORMATTED"]);
$cache->EndDataCache($arCacheData);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
}
}
if ($bEmpty) {
return false;
}
$feature = CSocNetLogTools::FindFeatureByEventID($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]);
if ($feature && (!array_key_exists($feature, $arSocNetFeaturesSettings) || array_key_exists("allowed", $arSocNetFeaturesSettings[$feature]) && is_array($arSocNetFeaturesSettings[$feature]["allowed"]) && !in_array($arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_TYPE"], $arSocNetFeaturesSettings[$feature]["allowed"]))) {
return false;
}
if (!array_key_exists("COMMENTS_PARAMS", $arEvent["FIELDS_FORMATTED"])) {
$arForumMetaData = CSocNetLogTools::GetForumCommentMetaData($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]);
if ($arForumMetaData && $arEvent["FIELDS_FORMATTED"]["EVENT"]["SOURCE_ID"] > 0) {
$arEvent["FIELDS_FORMATTED"]["COMMENTS_PARAMS"] = array("ENTITY_TYPE" => $arForumMetaData[1], "ENTITY_XML_ID" => $arForumMetaData[0] . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["SOURCE_ID"], "NOTIFY_TAGS" => $arForumMetaData[2]);
} else {
$arEvent["FIELDS_FORMATTED"]["COMMENTS_PARAMS"] = array("ENTITY_TYPE" => substr(strtoupper($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]) . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["ID"], 0, 2), "ENTITY_XML_ID" => strtoupper($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]) . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["ID"], "NOTIFY_TAGS" => "");
}
}
foreach (GetModuleEvents("socialnetwork", "OnSonetLogEntryMenuCreate", true) as $arModuleEvent) {
if (!array_key_exists("FIELDS_FORMATTED", $arEvent)) {
$arEvent["FIELDS_FORMATTED"] = array();
}
if (!array_key_exists("MENU", $arEvent["FIELDS_FORMATTED"])) {
$arEvent["FIELDS_FORMATTED"]["MENU"] = array();
}
$arMenuItems = ExecuteModuleEventEx($arModuleEvent, array($arEvent));
if (!empty($arMenuItems)) {
$arEvent["FIELDS_FORMATTED"]["MENU"] = array_merge($arEvent["FIELDS_FORMATTED"]["MENU"], $arMenuItems);
}
}
if (is_array($arCurrentUserSubscribe)) {
$arEvent["FIELDS_FORMATTED"]["TRANSPORT"] = __SLEGetTransport($arEvent, $arCurrentUserSubscribe);
}
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]);
if (!$GLOBALS["USER"]->IsAuthorized()) {
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = "N";
} elseif ($arCommentEvent && array_key_exists("OPERATION_ADD", $arCommentEvent) && $arCommentEvent["OPERATION_ADD"] == "log_rights") {
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = CSocNetLogRights::CheckForUser($arEvent["FIELDS_FORMATTED"]["EVENT"]["ID"], $GLOBALS["USER"]->GetID()) ? "Y" : "N";
} else {
示例3: array
break;
case "system_friends":
$operation = "viewfriends";
break;
}
$perm = CSocNetUserPerms::GetOperationPerms($arLog["ENTITY_ID"], $operation);
if (in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_FRIENDS))) {
CSocNetLogRights::Add($arLog["ID"], array("SA", "U" . $arLog["ENTITY_ID"], "SU" . $arLog["ENTITY_ID"] . "_" . $perm));
} elseif ($perm == SONET_RELATIONS_TYPE_NONE) {
CSocNetLogRights::Add($arLog["ID"], array("SA", "U" . $arLog["ENTITY_ID"]));
} elseif ($perm == SONET_RELATIONS_TYPE_AUTHORIZED) {
CSocNetLogRights::Add($arLog["ID"], array("SA", "AU"));
} elseif ($perm == SONET_RELATIONS_TYPE_ALL) {
CSocNetLogRights::Add($arLog["ID"], array("SA", "G2"));
}
} elseif ($featureID = CSocNetLogTools::FindFeatureByEventID($arLog["EVENT_ID"])) {
CSocNetLogRights::SetForSonet($arLog["ID"], $arLog["ENTITY_TYPE"], $arLog["ENTITY_ID"], $featureID, $GLOBALS["arSocNetFeaturesSettings"][$featureID]["subscribe_events"][$arLog["EVENT_ID"]]["OPERATION"]);
} elseif ($arLog["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP) {
CSocNetLogRights::Add($arLog["ID"], array("SA", "SG" . $arLog["ENTITY_ID"] . "_" . SONET_ROLES_OWNER, "SG" . $arLog["ENTITY_ID"] . "_" . SONET_ROLES_MODERATOR, "SG" . $arLog["ENTITY_ID"] . "_" . SONET_ROLES_USER));
} elseif ($arLog["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_USER) {
$perm = CSocNetUserPerms::GetOperationPerms($arLog["ENTITY_ID"], "viewprofile");
if (in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_FRIENDS))) {
CSocNetLogRights::Add($arLog["ID"], array("SA", "U" . $arLog["ENTITY_ID"], "SU" . $arLog["ENTITY_ID"] . "_" . $perm));
} elseif ($perm == SONET_RELATIONS_TYPE_NONE) {
CSocNetLogRights::Add($arLog["ID"], array("SA", "U" . $arLog["ENTITY_ID"]));
} elseif ($perm == SONET_RELATIONS_TYPE_AUTHORIZED) {
CSocNetLogRights::Add($arLog["ID"], array("SA", "AU"));
} elseif ($perm == SONET_RELATIONS_TYPE_ALL) {
CSocNetLogRights::Add($arLog["ID"], array("SA", "G2"));
}
// tasks!!!
示例4: __SLMGetLogRecord
//.........这里部分代码省略.........
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
}
}
if (!array_key_exists("COMMENTS_PARAMS", $arEvent["FIELDS_FORMATTED"])) {
$entities_xml_id = array("tasks" => array("TASK", "TK", "FORUM|COMMENT"), "forum" => array("FORUM", "FM", "FORUM|COMMENT"), "photo_photo" => array("PHOTO", "PH", "FORUM|COMMENT"), "sonet" => array("SOCNET", "SC", ""), "lists_new_element" => array("WF", "WF", ""));
if (array_key_exists($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"], $entities_xml_id) && intval($arEvent["FIELDS_FORMATTED"]["EVENT"]["SOURCE_ID"]) > 0) {
$arEvent["FIELDS_FORMATTED"]["COMMENTS_PARAMS"] = array("ENTITY_TYPE" => $entities_xml_id[$arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]][1], "ENTITY_XML_ID" => $entities_xml_id[$arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]][0] . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["SOURCE_ID"], "NOTIFY_TAGS" => $entities_xml_id[$arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]][2]);
} else {
$arEvent["FIELDS_FORMATTED"]["COMMENTS_PARAMS"] = array("ENTITY_TYPE" => substr(strtoupper($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]) . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["ID"], 0, 2), "ENTITY_XML_ID" => strtoupper($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]) . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["ID"], "NOTIFY_TAGS" => "");
}
}
$timestamp = MakeTimeStamp(isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"]) ? $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"] : (isset($arParams["FIELDS_FORMATTED"]["EVENT"]["LOG_DATE_FORMAT"]) ? $arEvent["FIELDS_FORMATTED"]["EVENT"]["LOG_DATE_FORMAT"] : $arParams["EVENT"]["LOG_DATE"]));
$timeFormated = FormatDate(GetMessage("SONET_SLM_FORMAT_TIME"), $timestamp);
if (strlen($arParams["DATE_TIME_FORMAT"]) <= 0) {
$dateTimeFormated = __SMLFormatDate($timestamp);
} else {
$dateTimeFormated = FormatDate($arParams["DATE_TIME_FORMAT"] == "FULL" ? $GLOBALS["DB"]->DateFormatToPHP(str_replace(":SS", "", FORMAT_DATETIME)) : $arParams["DATE_TIME_FORMAT"], $timestamp);
}
if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
$dateTimeFormated = ToLower($dateTimeFormated);
}
// strip current year
if (!empty($arParams["DATE_TIME_FORMAT"]) && ($arParams["DATE_TIME_FORMAT"] == "j F Y G:i" || $arParams["DATE_TIME_FORMAT"] == "j F Y g:i a")) {
$dateTimeFormated = ltrim($dateTimeFormated, "0");
$curYear = date("Y");
$dateTimeFormated = str_replace(array("-" . $curYear, "/" . $curYear, " " . $curYear, "." . $curYear), "", $dateTimeFormated);
}
$arEvent["FIELDS_FORMATTED"]["LOG_TIME_FORMAT"] = $timeFormated;
if (strlen($arParams["DATE_TIME_FORMAT"]) <= 0) {
if (array_key_exists("EVENT_FORMATTED", $arEvent["FIELDS_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && array_key_exists("LOG_DATE_FORMAT", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"])) {
$bToday = ConvertTimeStamp(MakeTimeStamp($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"]), "SHORT") == ConvertTimeStamp();
if ($bToday) {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $timeFormated;
} else {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $dateTimeFormated;
}
} else {
$bToday = $arEvent["FIELDS_FORMATTED"]["LOG_DATE_DAY"] == ConvertTimeStamp();
if ($bToday) {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $timeFormated;
} else {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $dateTimeFormated;
}
}
} else {
$arFormat = array("tommorow" => "tommorow, " . GetMessage("SONET_SLM_FORMAT_TIME"), "today" => "today, " . GetMessage("SONET_SLM_FORMAT_TIME"), "yesterday" => "yesterday, " . GetMessage("SONET_SLM_FORMAT_TIME"), "" => date("Y", $timestamp) == date("Y") ? GetMessage("SONET_SLM_FORMAT_DATE") : GetMessage("SONET_SLM_FORMAT_DATE_YEAR"));
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = FormatDate($arFormat, $timestamp);
}
if (is_array($arEvent["FIELDS_FORMATTED"]["EVENT"])) {
if ($arCommentEvent && array_key_exists("OPERATION_ADD", $arCommentEvent) && $arCommentEvent["OPERATION_ADD"] == "log_rights") {
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = CSocNetLogRights::CheckForUser($arEvent["FIELDS_FORMATTED"]["EVENT"]["ID"], $GLOBALS["USER"]->GetID()) ? "Y" : "N";
} else {
$array_key = $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_TYPE"] . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_ID"] . "_" . $arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"];
if (array_key_exists($array_key, $GLOBALS["CurUserCanAddComments"])) {
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = $GLOBALS["CurUserCanAddComments"][$array_key] == "Y" && $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] == "Y" ? "Y" : "N";
} else {
$feature = CSocNetLogTools::FindFeatureByEventID($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]);
if ($feature && $arCommentEvent && array_key_exists("OPERATION_ADD", $arCommentEvent) && strlen($arCommentEvent["OPERATION_ADD"]) > 0) {
$GLOBALS["CurUserCanAddComments"][$array_key] = CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_TYPE"], $arEvent["FIELDS_FORMATTED"]["EVENT"]["ENTITY_ID"], $feature == "microblog" ? "blog" : $feature, $arCommentEvent["OPERATION_ADD"]) ? "Y" : "N";
} else {
$GLOBALS["CurUserCanAddComments"][$array_key] = "Y";
}
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = $GLOBALS["CurUserCanAddComments"][$array_key] == "Y" && $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] == "Y" ? "Y" : "N";
}
}
}
$arEvent["FIELDS_FORMATTED"]["FAVORITES"] = $arParams["EVENT"]["FAVORITES"];
if ($arParams["USE_FOLLOW"] == "Y") {
$arEvent["FIELDS_FORMATTED"]["EVENT"]["FOLLOW"] = $arParams["EVENT"]["FOLLOW"];
$arEvent["FIELDS_FORMATTED"]["EVENT"]["DATE_FOLLOW_X1"] = $arParams["EVENT"]["DATE_FOLLOW_X1"];
$arEvent["FIELDS_FORMATTED"]["EVENT"]["DATE_FOLLOW"] = $arParams["EVENT"]["DATE_FOLLOW"];
}
if ($arParams["CHECK_PERMISSIONS_DEST"] == "N" && is_object($GLOBALS["USER"]) && (array_key_exists("DESTINATION", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) || array_key_exists("DESTINATION_CODE", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_CODE"]))) {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"] = 0;
$bExtranetUser = CModule::IncludeModule("extranet") && !CExtranet::IsIntranetUser();
$arGroupID = CSocNetLogTools::GetAvailableGroups($bExtranetUser ? "Y" : "N");
if (array_key_exists("DESTINATION", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"] as $key => $arDestination) {
if (array_key_exists("TYPE", $arDestination) && array_key_exists("ID", $arDestination) && ($arDestination["TYPE"] == "SG" && !in_array(intval($arDestination["ID"]), $arGroupID) || $arDestination["TYPE"] == "DR" && $bExtranetUser)) {
unset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"][$key]);
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"]++;
}
}
if (intval($arParams["DESTINATION_LIMIT_SHOW"]) > 0 && count($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) > $arParams["DESTINATION_LIMIT_SHOW"]) {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_MORE"] = count($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) + $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"] - $arParams["DESTINATION_LIMIT_SHOW"];
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"] = array_slice($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"], 0, $arParams["DESTINATION_LIMIT_SHOW"]);
}
}
}
if ($arParams["SHOW_RATING"] == "Y" && strlen($arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_TYPE_ID"]) > 0 && intval($arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_ENTITY_ID"]) > 0) {
$arEvent["FIELDS_FORMATTED"]["RATING"] = CRatings::GetRatingVoteResult($arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_TYPE_ID"], $arEvent["FIELDS_FORMATTED"]["EVENT"]["RATING_ENTITY_ID"]);
}
if (array_key_exists("FAVORITES_USER_ID", $arEvent) && intval($arEvent["FAVORITES_USER_ID"]) > 0) {
$arEvent["FIELDS_FORMATTED"]["FAVORITES"] = "Y";
} else {
$arEvent["FIELDS_FORMATTED"]["FAVORITES"] = "N";
}
return $arEvent["FIELDS_FORMATTED"];
}
示例5: SetSonetLogRights
function SetSonetLogRights($logID, $entity_type, $entity_id, $event_id)
{
if (!CModule::IncludeModule("socialnetwork")) {
return;
}
if (in_array($entity_type, array(SONET_SUBSCRIBE_ENTITY_USER, SONET_SUBSCRIBE_ENTITY_GROUP))) {
if (in_array($event_id, array("blog_post", "forum", "photo", "blog_post_micro", "files", "wiki"))) {
$arLogEventTmp = CSocNetLogTools::FindLogEventByID($event_id);
CSocNetLogRights::SetForSonet($logID, $entity_type, $entity_id, CSocNetLogTools::FindFeatureByEventID($event_id), $arLogEventTmp["OPERATION"]);
} elseif (in_array($event_id, array("data", "system")) && $entity_type == SONET_SUBSCRIBE_ENTITY_GROUP) {
CSocNetLogRights::Add($logID, array("SA", "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id, "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_OWNER, "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_MODERATOR, "S" . SONET_SUBSCRIBE_ENTITY_GROUP . $entity_id . "_" . SONET_ROLES_USER));
} elseif (in_array($event_id, array("data", "system")) && $entity_type == SONET_SUBSCRIBE_ENTITY_USER) {
$perm = CSocNetUserPerms::GetOperationPerms($entity_id, "viewprofile");
if (in_array($perm, array(SONET_RELATIONS_TYPE_FRIENDS2, SONET_RELATIONS_TYPE_FRIENDS))) {
CSocNetLogRights::Add($logID, array("SA", "U" . $entity_id, "S" . SONET_SUBSCRIBE_ENTITY_USER . $entity_id . "_" . $perm));
} elseif ($perm == SONET_RELATIONS_TYPE_AUTHORIZED) {
CSocNetLogRights::Add($logID, array("SA", "AU"));
} elseif ($perm == SONET_RELATIONS_TYPE_ALL) {
CSocNetLogRights::Add($logID, array("SA", "G2"));
}
}
} elseif ($entity_type == SONET_SUBSCRIBE_ENTITY_PROVIDER) {
$arRights = array("SA");
$rsSchemeRights = CXDILFSchemeRights::GetList(array(), array("SCHEME_ID" => $entity_id));
while ($arSchemeRights = $rsSchemeRights->Fetch()) {
if (substr($arSchemeRights["GROUP_CODE"], 0, 1) == "U") {
if (substr($arSchemeRights["GROUP_CODE"], 1) == "A") {
$arRights[] = "AU";
break;
} elseif (substr($arSchemeRights["GROUP_CODE"], 1) == "N") {
$arRights[] = "G2";
break;
} elseif (intval(substr($arSchemeRights["GROUP_CODE"], 1)) > 0) {
$arRights[] = "U" . substr($arSchemeRights["GROUP_CODE"], 1);
}
}
}
if (count($arRights) > 0) {
CSocNetLogRights::Add($logID, $arRights);
}
} elseif (defined("SONET_SUBSCRIBE_ENTITY_NEWS") && $entity_type == SONET_SUBSCRIBE_ENTITY_NEWS) {
CSocNetLogRights::Add($logID, array("SA", "G2"));
}
}
示例6: __SLEGetLogRecord
//.........这里部分代码省略.........
$arEvent["FIELDS_FORMATTED"]["TMP_ID"] = $arEvent["TMP_ID"];
if (array_key_exists("EVENT_FORMATTED", $arEvent["FIELDS_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && array_key_exists("LOG_DATE_FORMAT", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"])) {
if (ConvertTimeStamp(MakeTimeStamp($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"]), "SHORT") == ConvertTimeStamp()) {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $timeFormated;
} else {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $dateTimeFormated;
}
} elseif ($arEvent["FIELDS_FORMATTED"]["LOG_DATE_DAY"] == ConvertTimeStamp()) {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $timeFormated;
} else {
$arEvent["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $dateTimeFormated;
}
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($arEvent["EVENT_ID"]);
if (!array_key_exists("HAS_COMMENTS", $arEvent["FIELDS_FORMATTED"]) || $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] != "N") {
$arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] = $arCommentEvent && (!array_key_exists("ENABLE_COMMENTS", $arEvent) || $arEvent["ENABLE_COMMENTS"] != "N") ? "Y" : "N";
}
}
if (is_object($cache)) {
$arCacheData = array("FIELDS_FORMATTED" => $arEvent["FIELDS_FORMATTED"]);
$cache->EndDataCache($arCacheData);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->EndTagCache();
}
}
}
$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();
if (is_array($arCurrentUserSubscribe)) {
$arEvent["FIELDS_FORMATTED"]["TRANSPORT"] = __SLEGetTransport($arEvent, $arCurrentUserSubscribe);
}
$array_key = $arEvent["ENTITY_TYPE"] . "_" . $arEvent["ENTITY_ID"] . "_" . $arEvent["EVENT_ID"];
if (array_key_exists($array_key, $GLOBALS["CurUserCanAddComments"])) {
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = $GLOBALS["CurUserCanAddComments"][$array_key] == "Y" && $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] == "Y" ? "Y" : "N";
} else {
$feature = CSocNetLogTools::FindFeatureByEventID($arEvent["EVENT_ID"]);
if ($feature && $arCommentEvent && array_key_exists("OPERATION_ADD", $arCommentEvent) && strlen($arCommentEvent["OPERATION_ADD"]) > 0) {
$GLOBALS["CurUserCanAddComments"][$array_key] = CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arEvent["ENTITY_TYPE"], $arEvent["ENTITY_ID"], $feature == "microblog" ? "blog" : $feature, $arCommentEvent["OPERATION_ADD"], $bCurrentUserIsAdmin) ? "Y" : "N";
} else {
$GLOBALS["CurUserCanAddComments"][$array_key] = "Y";
}
$arEvent["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = $GLOBALS["CurUserCanAddComments"][$array_key] == "Y" && $arEvent["FIELDS_FORMATTED"]["HAS_COMMENTS"] == "Y" ? "Y" : "N";
}
$arEvent["FIELDS_FORMATTED"]["FAVORITES"] = $arParams["EVENT"]["FAVORITES"];
if ($arParams["USE_FOLLOW"] == "Y") {
$arEvent["FIELDS_FORMATTED"]["EVENT"]["FOLLOW"] = $arParams["EVENT"]["FOLLOW"];
$arEvent["FIELDS_FORMATTED"]["EVENT"]["DATE_FOLLOW_X1"] = $arParams["EVENT"]["DATE_FOLLOW_X1"];
$arEvent["FIELDS_FORMATTED"]["EVENT"]["DATE_FOLLOW"] = $arParams["EVENT"]["DATE_FOLLOW"];
}
if ($arParams["CHECK_PERMISSIONS_DEST"] == "N" && !$bCurrentUserIsAdmin && is_object($GLOBALS["USER"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && (array_key_exists("DESTINATION", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION"]) || array_key_exists("DESTINATION_CODE", $arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_CODE"]))) {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["DESTINATION_HIDDEN"] = 0;
$arGroupID = array();
if (!empty($GLOBALS["SONET_GROUPS_ID_AVAILABLE"])) {
$arGroupID = $GLOBALS["SONET_GROUPS_ID_AVAILABLE"];
} else {
// get tagged cached available groups and intersect
$cache = new CPHPCache();
$cache_id = $GLOBALS["USER"]->GetID();
$cache_path = "/sonet/groups_available/";
if ($cache->InitCache($cache_time, $cache_id, $cache_path)) {
$arCacheVars = $cache->GetVars();
$arGroupID = $arCacheVars["arGroupID"];
} else {
$cache->StartDataCache($cache_time, $cache_id, $cache_path);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
$GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_user2group_U" . $GLOBALS["USER"]->GetID());
$GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group");
示例7: __SLMGetLogRecord
function __SLMGetLogRecord($arEvents, $arParams, $arCurrentUserSubscribe, $arMyEntities, &$arTmpEventsNew)
{
static $arSiteWorkgroupsPage;
$arParams["MOBILE"] = "Y";
$arParams["NEW_TEMPLATE"] = "Y";
if ($arTmpEvents == false) {
$arTmpEvents = array();
}
$arEventTmp = CSocNetLogTools::FindLogEventByID($arEvents["EVENT_ID"]);
if ($arEventTmp && array_key_exists("CLASS_FORMAT", $arEventTmp) && array_key_exists("METHOD_FORMAT", $arEventTmp)) {
$arEvents["FIELDS_FORMATTED"] = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arEvents, $arParams);
}
$path2Entity = $arEvents["ENTITY_TYPE"] == SONET_ENTITY_USER ? CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arEvents["ENTITY_ID"])) : "";
$timestamp = MakeTimeStamp(is_array($arEvents["FIELDS_FORMATTED"]) && array_key_exists("EVENT_FORMATTED", $arEvents["FIELDS_FORMATTED"]) && is_array($arEvents["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && array_key_exists("LOG_DATE_FORMAT", $arEvents["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) ? $arEvents["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"] : (array_key_exists("LOG_DATE_FORMAT", $arEvents) ? $arEvents["LOG_DATE_FORMAT"] : $arEvents["LOG_DATE"]));
$timeFormated = FormatDate(GetMessage("SONET_SLM_FORMAT_TIME"), $timestamp);
if (strlen($arParams["DATE_TIME_FORMAT"]) <= 0) {
$dateTimeFormated = __SMLFormatDate($timestamp);
} else {
$dateTimeFormated = FormatDate($arParams["DATE_TIME_FORMAT"] == "FULL" ? $GLOBALS["DB"]->DateFormatToPHP(str_replace(":SS", "", FORMAT_DATETIME)) : $arParams["DATE_TIME_FORMAT"], $timestamp);
}
if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
$dateTimeFormated = ToLower($dateTimeFormated);
$dateFormated = ToLower($dateFormated);
}
// strip current year
if (!empty($arParams['DATE_TIME_FORMAT']) && ($arParams['DATE_TIME_FORMAT'] == 'j F Y G:i' || $arParams['DATE_TIME_FORMAT'] == 'j F Y g:i a')) {
$dateTimeFormated = ltrim($dateTimeFormated, '0');
$curYear = date('Y');
$dateTimeFormated = str_replace(array('-' . $curYear, '/' . $curYear, ' ' . $curYear, '.' . $curYear), '', $dateTimeFormated);
}
$arTmpUser = array("NAME" => $arEvents["~USER_NAME"], "LAST_NAME" => $arEvents["~USER_LAST_NAME"], "SECOND_NAME" => $arEvents["~USER_SECOND_NAME"], "LOGIN" => $arEvents["~USER_LOGIN"]);
$arEvents["FIELDS_FORMATTED"]["LOG_TIME_FORMAT"] = $timeFormated;
$arEvents["FIELDS_FORMATTED"]["LOG_UPDATE_TS"] = MakeTimeStamp($arEvents["LOG_UPDATE"]);
$arEvents["FIELDS_FORMATTED"]["LOG_DATE_TS"] = MakeTimeStamp($arEvents["LOG_DATE"]);
$arEvents["FIELDS_FORMATTED"]["LOG_DATE_DAY"] = ConvertTimeStamp(MakeTimeStamp($arEvents["LOG_DATE"]), "SHORT");
$arEvents["FIELDS_FORMATTED"]["LOG_UPDATE_DAY"] = ConvertTimeStamp(MakeTimeStamp($arEvents["LOG_UPDATE"]), "SHORT");
$arEvents["FIELDS_FORMATTED"]["COMMENTS_COUNT"] = $arEvents["COMMENTS_COUNT"];
$arEvents["FIELDS_FORMATTED"]["TMP_ID"] = $arEvents["TMP_ID"];
if (strlen($arParams["DATE_TIME_FORMAT"]) <= 0) {
if (array_key_exists("EVENT_FORMATTED", $arEvents["FIELDS_FORMATTED"]) && is_array($arEvents["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && array_key_exists("LOG_DATE_FORMAT", $arEvents["FIELDS_FORMATTED"]["EVENT_FORMATTED"])) {
$bToday = ConvertTimeStamp(MakeTimeStamp($arEvents["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["LOG_DATE_FORMAT"]), "SHORT") == ConvertTimeStamp();
if ($bToday || intval((time() - $timestamp) / 60 / 60) < 24) {
$arEvents["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $timeFormated;
} else {
$arEvents["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $dateTimeFormated;
}
} else {
$bToday = $arEvents["FIELDS_FORMATTED"]["LOG_DATE_DAY"] == ConvertTimeStamp();
if ($bToday || intval((time() - $timestamp) / 60 / 60) < 24) {
$arEvents["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $timeFormated;
} else {
$arEvents["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = $dateTimeFormated;
}
}
} else {
$arFormat = array("tommorow" => "tommorow, " . GetMessage("SONET_SLM_FORMAT_TIME"), "today" => "today, " . GetMessage("SONET_SLM_FORMAT_TIME"), "yesterday" => "yesterday, " . GetMessage("SONET_SLM_FORMAT_TIME"), "" => date("Y", $timestamp) == date("Y") ? GetMessage("SONET_SLM_FORMAT_DATE") : GetMessage("SONET_SLM_FORMAT_DATE_YEAR"));
$arEvents["FIELDS_FORMATTED"]["DATETIME_FORMATTED"] = FormatDate($arFormat, $timestamp);
}
if (is_array($arCurrentUserSubscribe)) {
$arEvents["FIELDS_FORMATTED"]["VISIBLE"] = __SLMGetVisible($arEvents, $arCurrentUserSubscribe, $arMyEntities);
}
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($arEvents["EVENT_ID"]);
if (!array_key_exists("HAS_COMMENTS", $arEvents["FIELDS_FORMATTED"]) || $arEvents["FIELDS_FORMATTED"]["HAS_COMMENTS"] != "N") {
$arEvents["FIELDS_FORMATTED"]["HAS_COMMENTS"] = $arCommentEvent && ($arCommentEvent["EVENT_ID"] == "blog_comment_micro" || !array_key_exists("ENABLE_COMMENTS", $arEvents) || $arEvents["ENABLE_COMMENTS"] != "N") ? "Y" : "N";
}
if (intval($arParams["LOG_ID"]) > 0) {
if (array_key_exists("OPERATION_ADD", $arCommentEvent) && $arCommentEvent["OPERATION_ADD"] == "log_rights") {
$arEvents["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = CSocNetLogRights::CheckForUser($arEvents["ID"], $GLOBALS["USER"]->GetID());
} else {
$array_key = $arEvents["ENTITY_TYPE"] . "_" . $arEvents["ENTITY_ID"] . "_" . $arEvents["EVENT_ID"];
if (array_key_exists($array_key, $GLOBALS["CurUserCanAddComments"])) {
$arEvents["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = $GLOBALS["CurUserCanAddComments"][$array_key] == "Y" && $arEvents["FIELDS_FORMATTED"]["HAS_COMMENTS"] == "Y" ? "Y" : "N";
} else {
$feature = CSocNetLogTools::FindFeatureByEventID($arEvents["EVENT_ID"]);
if ($feature && $arCommentEvent && array_key_exists("OPERATION_ADD", $arCommentEvent) && strlen($arCommentEvent["OPERATION_ADD"]) > 0) {
$GLOBALS["CurUserCanAddComments"][$array_key] = CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arEvents["ENTITY_TYPE"], $arEvents["ENTITY_ID"], $feature == "microblog" ? "blog" : $feature, $arCommentEvent["OPERATION_ADD"]) ? "Y" : "N";
} else {
$GLOBALS["CurUserCanAddComments"][$array_key] = "Y";
}
$arEvents["FIELDS_FORMATTED"]["CAN_ADD_COMMENTS"] = $GLOBALS["CurUserCanAddComments"][$array_key] == "Y" && $arEvents["FIELDS_FORMATTED"]["HAS_COMMENTS"] == "Y" ? "Y" : "N";
}
}
}
if (array_key_exists("FAVORITES_USER_ID", $arEvents) && intval($arEvents["FAVORITES_USER_ID"]) > 0) {
$arEvents["FIELDS_FORMATTED"]["FAVORITES"] = "Y";
} else {
$arEvents["FIELDS_FORMATTED"]["FAVORITES"] = "N";
}
$arTmpEventsNew[] = $arEvents["FIELDS_FORMATTED"];
}