本文整理汇总了PHP中CSocNetLogTools::FindLogEventByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogTools::FindLogEventByID方法的具体用法?PHP CSocNetLogTools::FindLogEventByID怎么用?PHP CSocNetLogTools::FindLogEventByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetLogTools
的用法示例。
在下文中一共展示了CSocNetLogTools::FindLogEventByID方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendEvent
public static function SendEvent($ID, $mailTemplate = "SONET_NEW_EVENT", $tmp_id = false, $bAgent = false, $bTransport = false)
{
$ID = IntVal($ID);
if ($ID <= 0)
return false;
if (intval($tmp_id) > 0)
$arFilter = array("ID" => $tmp_id);
else
$arFilter = array("ID" => $ID);
$dbLog = CSocNetLog::GetList(
array(),
$arFilter,
false,
false,
array("ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "EVENT_ID", "LOG_DATE", "TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "CALLBACK_FUNC", "SITE_ID", "PARAMS", "SOURCE_ID", "GROUP_NAME", "CREATED_BY_NAME", "CREATED_BY_SECOND_NAME", "CREATED_BY_LAST_NAME", "CREATED_BY_LOGIN", "LOG_SOURCE_ID"),
array("MIN_ID_JOIN" => true)
);
$arLog = $dbLog->Fetch();
if (!$arLog)
return $bAgent;
if (MakeTimeStamp($arLog["LOG_DATE"]) > (time() + CTimeZone::GetOffset()))
{
$agent = "CSocNetLog::SendEventAgent(".$ID.", '".$mailTemplate."', ".($tmp_id ? $tmp_id : 'false').");";
$rsAgents = CAgent::GetList(array("ID"=>"DESC"), array("NAME" => $agent));
if(!$rsAgents->Fetch())
{
$res = CAgent::AddAgent($agent, "socialnetwork", "N", 0, $arLog["LOG_DATE"], "Y", $arLog["LOG_DATE"]);
if(!$res)
$GLOBALS["APPLICATION"]->ResetException();
}
elseif ($bAgent)
{
CAgent::RemoveAgent($agent, "socialnetwork");
CAgent::AddAgent($agent, "socialnetwork", "N", 0, $arLog["LOG_DATE"], "Y", $arLog["LOG_DATE"]);
return true;
}
return false;
}
$arEvent = CSocNetLogTools::FindLogEventByID($arLog["EVENT_ID"], $arLog["ENTITY_TYPE"]);
if (
$arEvent
&& array_key_exists("CLASS_FORMAT", $arEvent)
&& array_key_exists("METHOD_FORMAT", $arEvent)
)
{
$dbSiteCurrent = CSite::GetByID(SITE_ID);
if ($arSiteCurrent = $dbSiteCurrent->Fetch())
if ($arSiteCurrent["LANGUAGE_ID"] != LANGUAGE_ID)
$arLog["MAIL_LANGUAGE_ID"] = $arSiteCurrent["LANGUAGE_ID"];
$arLog["FIELDS_FORMATTED"] = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arLog, array(), true);
}
if (
array_key_exists($arLog["ENTITY_TYPE"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"])
&& array_key_exists("HAS_MY", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]])
&& $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["HAS_MY"] == "Y"
&& array_key_exists("CLASS_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]])
&& array_key_exists("METHOD_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]])
&& strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["CLASS_OF"]) > 0
&& strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["METHOD_OF"]) > 0
&& method_exists($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["METHOD_OF"])
)
$arOfEntities = call_user_func(array($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["METHOD_OF"]), $arLog["ENTITY_ID"]);
if ($bTransport)
{
$arListParams = array(
"USE_SUBSCRIBE" => "Y",
"ENTITY_TYPE" => $arLog["ENTITY_TYPE"],
"ENTITY_ID" => $arLog["ENTITY_ID"],
"EVENT_ID" => $arLog["EVENT_ID"],
"USER_ID" => $arLog["USER_ID"],
"OF_ENTITIES" => $arOfEntities,
"TRANSPORT" => array("M", "X")
);
$arLogSites = array();
$rsLogSite = CSocNetLog::GetSite($ID);
while($arLogSite = $rsLogSite->Fetch())
$arLogSites[] = $arLogSite["LID"];
if (CModule::IncludeModule("extranet"))
{
$arSites = array();
$dbSite = CSite::GetList($by="sort", $order="desc", array("ACTIVE" => "Y"));
while($arSite = $dbSite->Fetch())
$arSites[$arSite["ID"]] = array(
"DIR" => (strlen(trim($arSite["DIR"])) > 0 ? $arSite["DIR"] : "/"),
"SERVER_NAME" => (strlen(trim($arSite["SERVER_NAME"])) > 0 ? $arSite["SERVER_NAME"] : COption::GetOptionString("main", "server_name", $_SERVER["HTTP_HOST"]))
);
$extranet_site_id = CExtranet::GetExtranetSiteID();
$intranet_site_id = CSite::GetDefSite();
//.........这里部分代码省略.........
示例2: __SLEGetLogRecord
function __SLEGetLogRecord($logID, $arParams, $arCurrentUserSubscribe, $current_page_date)
{
static $isExtranetInstalled, $isExtranetSite, $isExtranetUser, $arUserIdVisible, $arAvailableExtranetUserID, $isExtranetAdmin, $bCurrentUserIsAdmin, $arSocNetFeaturesSettings;
if (!$isExtranetInstalled) {
$isExtranetInstalled = CModule::IncludeModule("extranet") ? "Y" : "N";
$isExtranetSite = $isExtranetInstalled == "Y" && CExtranet::IsExtranetSite() ? "Y" : "N";
$isExtranetUser = $isExtranetInstalled == "Y" && !CExtranet::IsIntranetUser() ? "Y" : "N";
$isExtranetAdmin = $isExtranetInstalled == "Y" && CExtranet::IsExtranetAdmin() ? "Y" : "N";
$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin();
$arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
if ($isExtranetUser == "Y") {
$arUserIdVisible = CExtranet::GetMyGroupsUsersSimple(SITE_ID);
} elseif ($isExtranetInstalled == "Y" && $isExtranetUser != "Y") {
if ($isExtranetAdmin == "Y" && $bCurrentUserIsAdmin) {
$arAvailableExtranetUserID = CExtranet::GetMyGroupsUsers(SITE_ID);
} else {
$arAvailableExtranetUserID = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
}
}
}
$cache_time = 31536000;
$arEvent = array();
$cache = new CPHPCache();
$arCacheID = array();
$arKeys = array("AVATAR_SIZE", "DESTINATION_LIMIT", "CHECK_PERMISSIONS_DEST", "NAME_TEMPLATE", "NAME_TEMPLATE_WO_NOBR", "SHOW_LOGIN", "DATE_TIME_FORMAT", "PATH_TO_USER", "PATH_TO_GROUP", "PATH_TO_CONPANY_DEPARTMENT");
foreach ($arKeys as $param_key) {
if (array_key_exists($param_key, $arParams)) {
$arCacheID[$param_key] = $arParams[$param_key];
} else {
$arCacheID[$param_key] = false;
}
}
$cache_id = "log_post_" . $logID . "_" . md5(serialize($arCacheID)) . "_" . SITE_TEMPLATE_ID . "_" . SITE_ID . "_" . LANGUAGE_ID . "_" . FORMAT_DATETIME . "_" . CTimeZone::GetOffset();
$cache_path = "/sonet/log/" . intval(intval($logID) / 1000) . "/" . $logID . "/entry/";
if (is_object($cache) && $cache->InitCache($cache_time, $cache_id, $cache_path)) {
$arCacheVars = $cache->GetVars();
$arEvent["FIELDS_FORMATTED"] = $arCacheVars["FIELDS_FORMATTED"];
if (array_key_exists("CACHED_CSS_PATH", $arEvent["FIELDS_FORMATTED"])) {
if (!is_array($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]) && strlen($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]) > 0) {
$GLOBALS['APPLICATION']->SetAdditionalCSS($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]);
} elseif (is_array($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"] as $css_path) {
$GLOBALS['APPLICATION']->SetAdditionalCSS($css_path);
}
}
}
if (array_key_exists("CACHED_JS_PATH", $arEvent["FIELDS_FORMATTED"])) {
if (!is_array($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"]) && $arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"] !== '') {
$GLOBALS['APPLICATION']->AddHeadScript($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"]);
} elseif (is_array($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"] as $js_path) {
$GLOBALS['APPLICATION']->AddHeadScript($js_path);
}
}
}
} else {
if (is_object($cache)) {
$cache->StartDataCache($cache_time, $cache_id, $cache_path);
}
$arFilter = array("ID" => $logID);
$arListParams = array("CHECK_RIGHTS" => "N", "USE_FOLLOW" => "N", "USE_SUBSCRIBE" => "N");
$arSelect = array("ID", "TMP_ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "EVENT_ID", "LOG_DATE", "LOG_UPDATE", "TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "CALLBACK_FUNC", "EXTERNAL_ID", "SITE_ID", "PARAMS", "COMMENTS_COUNT", "ENABLE_COMMENTS", "SOURCE_ID", "GROUP_NAME", "GROUP_OWNER_ID", "GROUP_INITIATE_PERMS", "GROUP_VISIBLE", "GROUP_OPENED", "GROUP_IMAGE_ID", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "USER_PERSONAL_PHOTO", "USER_PERSONAL_GENDER", "CREATED_BY_NAME", "CREATED_BY_LAST_NAME", "CREATED_BY_SECOND_NAME", "CREATED_BY_LOGIN", "CREATED_BY_PERSONAL_PHOTO", "CREATED_BY_PERSONAL_GENDER", "RATING_TYPE_ID", "RATING_ENTITY_ID", "SOURCE_TYPE");
$dbEvent = CSocNetLog::GetList(array(), $arFilter, false, false, $arSelect, $arListParams);
if ($arEvent = $dbEvent->GetNext()) {
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
$GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_NAME_" . intval($arEvent["USER_ID"]));
$GLOBALS["CACHE_MANAGER"]->RegisterTag("SONET_LOG_" . intval($arEvent["ID"]));
if ($arEvent["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
$GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group_" . $arEvent["ENTITY_ID"]);
}
}
$arEvent["EVENT_ID_FULLSET"] = CSocNetLogTools::FindFullSetEventIDByEventID($arEvent["EVENT_ID"]);
if ($arEvent["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
static $arSiteWorkgroupsPage;
if (!$arSiteWorkgroupsPage && (IsModuleInstalled("extranet") || is_set($arEvent["URL"]) && strpos($arEvent["URL"], "#GROUPS_PATH#") !== false)) {
$rsSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
while ($arSite = $rsSite->Fetch()) {
$arSiteWorkgroupsPage[$arSite["ID"]] = COption::GetOptionString("socialnetwork", "workgroups_page", $arSite["DIR"] . "workgroups/", $arSite["ID"]);
}
}
if (is_set($arEvent["URL"]) && isset($arSiteWorkgroupsPage[SITE_ID])) {
$arEvent["URL"] = str_replace("#GROUPS_PATH#", $arSiteWorkgroupsPage[SITE_ID], $arEvent["URL"]);
}
}
$arEventTmp = CSocNetLogTools::FindLogEventByID($arEvent["EVENT_ID"]);
if ($arEventTmp && isset($arEventTmp["CLASS_FORMAT"]) && isset($arEventTmp["METHOD_FORMAT"])) {
$arEvent["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("SONET_LOG", $arEvent["ID"], LANGUAGE_ID);
$arEvent["FIELDS_FORMATTED"] = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arEvent, $arParams);
if (is_array($arEvent["FIELDS_FORMATTED"])) {
if (isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"])) {
if (in_array($arEvent["EVENT_ID"], array('calendar'))) {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] = htmlspecialcharsback($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"]);
} else {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] = CSocNetTextParser::closetags(htmlspecialcharsback($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"]));
}
}
if (isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"])) {
$arFields2Cache = array("URL", "STYLE", "DESTINATION", "DESTINATION_MORE", "TITLE_24", "TITLE_24_2", "TITLE_24_2_STYLE", "IS_IMPORTANT", "MESSAGE", "FOOTER_MESSAGE", "MESSAGE_TITLE_24", "DATETIME_FORMATTED", "LOG_DATE_FORMAT", "MENU", "COMMENT_URL");
foreach ($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"] as $field => $value) {
//.........这里部分代码省略.........
示例3: array
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
echo "B_PROLOG_INCLUDED error!";
die;
}
if (!CModule::IncludeModule("xdimport") || !CModule::IncludeModule("socialnetwork")) {
echo "Error loading modules!";
return;
}
if (strlen($_POST["hash"]) > 0) {
$rsScheme = CXDILFScheme::GetList(array(), array("ACTIVE" => "Y", "HASH" => $_POST["hash"]));
if ($arScheme = $rsScheme->Fetch()) {
if (strlen($_POST["title"]) > 0 && strlen($_POST["message"]) > 0) {
if (XDI_DEBUG) {
CXDImport::WriteToLog("Successful POST request, scheme ID: " . $arScheme["ID"], "RXML");
}
$arEventTmp = CSocNetLogTools::FindLogEventByID($arScheme["EVENT_ID"]);
if (array_key_exists("REAL_EVENT_ID", $arEventTmp) && strlen($arEventTmp["REAL_EVENT_ID"]) > 0) {
$arScheme["EVENT_ID"] = $arEventTmp["REAL_EVENT_ID"];
}
if ($arScheme["EVENT_ID"] == "news" && CModule::IncludeModule("iblock")) {
$arLogParams = array("SCHEME_ID" => $arScheme["ID"]);
$strParams = CharsetConverter::ConvertCharset($_POST["params"], CXDImport::DetectUTF8($_POST["params"]) ? "utf-8" : "windows-1251", SITE_CHARSET);
$arParamPairs = explode("&", $strParams);
if (is_array($arParamPairs)) {
foreach ($arParamPairs as $strPair) {
list($key, $value) = explode("=", $strPair);
if (strlen($key) > 0 && strlen($value) > 0) {
$arLogParams[$key] = $value;
}
}
}
示例4: array
if (!array_key_exists("COMMON_ALL", $arSubscribe) || !array_key_exists($strTmp, $arSubscribe["COMMON_ALL"]) || $arSubscribe["COMMON_ALL"][$strTmp] == "I") {
$arSubscribe["COMMON_ALL"][$strTmp] = $value_default;
$arSubscribe["COMMON_ALL"][$strTmp . "_INHERITED"] = true;
}
$fullset_event_id = CSocNetLogTools::FindFullSetEventIDByEventID($event_id);
if ($fullset_event_id) {
$arEvent = CSocNetLogTools::FindLogEventByID($fullset_event_id, $entity_type);
} else {
$arEvent = CSocNetLogTools::FindLogEventByID($event_id, $entity_type);
}
if (!$arEvent) {
$arEvent = CSocNetLogTools::FindLogEventByCommentID($event_id);
if ($arEvent) {
$fullset_event_id = CSocNetLogTools::FindFullSetEventIDByEventID($arEvent["EVENT_ID"]);
if ($fullset_event_id) {
$arEvent = CSocNetLogTools::FindLogEventByID($fullset_event_id, $entity_type);
}
}
}
if ($arEvent) {
$arSubscribe["EVENT"]["TITLE"] = $arEvent["ENTITIES"][$entity_type]["TITLE_SETTINGS"];
if (array_key_exists("NAME_FORMATTED", $arEntityTmp) && strlen($arEntityTmp["NAME_FORMATTED"]) > 0) {
$arSubscribe["EVENT"]["TITLE_1"] = str_replace(array("#TITLE#"), array(array_key_exists("~NAME_FORMATTED", $arEntityTmp) ? $arEntityTmp["~NAME_FORMATTED"] : $arEntityTmp["NAME_FORMATTED"]), $arEvent["ENTITIES"][$entity_type]["TITLE_SETTINGS_1"]);
$arSubscribe["EVENT"]["TITLE_2"] = str_replace(array("#TITLE#"), array(array_key_exists("~NAME_FORMATTED", $arEntityTmp) ? $arEntityTmp["~NAME_FORMATTED"] : $arEntityTmp["NAME_FORMATTED"]), $arEvent["ENTITIES"][$entity_type]["TITLE_SETTINGS_2"]);
}
}
if (array_key_exists($entity_type, $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"]) && array_key_exists("TITLE_SETTINGS_ALL", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]) && strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]["TITLE_SETTINGS_ALL"]) > 0) {
$arSubscribe["ALL"]["TITLE"] = $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]["TITLE_SETTINGS_ALL"];
}
if (array_key_exists($entity_type, $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"]) && array_key_exists("TITLE_SETTINGS_ALL_1", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]) && strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]["TITLE_SETTINGS_ALL_1"]) > 0 && array_key_exists("NAME_FORMATTED", $arEntityTmp) && strlen($arEntityTmp["NAME_FORMATTED"]) > 0) {
$arSubscribe["ALL"]["TITLE_1"] = str_replace(array("#TITLE#"), array(array_key_exists("~NAME_FORMATTED", $arEntityTmp) ? $arEntityTmp["~NAME_FORMATTED"] : $arEntityTmp["NAME_FORMATTED"]), $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$entity_type]["TITLE_SETTINGS_ALL_1"]);
示例5: __SLMGetLogRecord
function __SLMGetLogRecord($logID, $arParams, $current_page_date)
{
$cache_time = 31536000;
$arEvent = array();
$cache = new CPHPCache();
$arCacheID = array();
$arKeys = array("AVATAR_SIZE", "DESTINATION_LIMIT", "CHECK_PERMISSIONS_DEST", "NAME_TEMPLATE", "NAME_TEMPLATE_WO_NOBR", "SHOW_LOGIN", "DATE_TIME_FORMAT", "PATH_TO_USER", "PATH_TO_GROUP", "PATH_TO_CONPANY_DEPARTMENT");
foreach ($arKeys as $param_key) {
if (array_key_exists($param_key, $arParams)) {
$arCacheID[$param_key] = $arParams[$param_key];
} else {
$arCacheID[$param_key] = false;
}
}
$cache_id = "log_post_" . $logID . "_" . md5(serialize($arCacheID)) . "_" . SITE_TEMPLATE_ID . "_" . SITE_ID . "_" . LANGUAGE_ID . "_" . FORMAT_DATETIME . "_" . CTimeZone::GetOffset();
$cache_path = "/sonet/log/" . intval(intval($logID) / 1000) . "/" . $logID . "/entry/";
if (is_object($cache) && $cache->InitCache($cache_time, $cache_id, $cache_path)) {
$arCacheVars = $cache->GetVars();
$arEvent["FIELDS_FORMATTED"] = $arCacheVars["FIELDS_FORMATTED"];
if (array_key_exists("EVENT", $arEvent["FIELDS_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT"])) {
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($arEvent["FIELDS_FORMATTED"]["EVENT"]["EVENT_ID"]);
}
if (array_key_exists("CACHED_CSS_PATH", $arEvent["FIELDS_FORMATTED"])) {
if (!is_array($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]) && strlen($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]) > 0) {
$GLOBALS['APPLICATION']->SetAdditionalCSS($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]);
} elseif (is_array($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"] as $css_path) {
$GLOBALS['APPLICATION']->SetAdditionalCSS($css_path);
}
}
}
if (array_key_exists("CACHED_JS_PATH", $arEvent["FIELDS_FORMATTED"])) {
if (!is_array($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"]) && $arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"] !== '') {
$GLOBALS['APPLICATION']->AddHeadScript($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"]);
} elseif (is_array($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["CACHED_JS_PATH"] as $js_path) {
$GLOBALS['APPLICATION']->AddHeadScript($js_path);
}
}
}
} else {
if (is_object($cache)) {
$cache->StartDataCache($cache_time, $cache_id, $cache_path);
}
$arFilter = array("ID" => $logID);
$arListParams = array("CHECK_RIGHTS" => "N", "USE_FOLLOW" => "N", "USE_SUBSCRIBE" => "N");
$arSelect = array("ID", "TMP_ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "EVENT_ID", "LOG_DATE", "LOG_UPDATE", "TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "CALLBACK_FUNC", "EXTERNAL_ID", "SITE_ID", "PARAMS", "ENABLE_COMMENTS", "SOURCE_ID", "GROUP_NAME", "GROUP_OWNER_ID", "GROUP_INITIATE_PERMS", "GROUP_VISIBLE", "GROUP_OPENED", "GROUP_IMAGE_ID", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "USER_PERSONAL_PHOTO", "USER_PERSONAL_GENDER", "CREATED_BY_NAME", "CREATED_BY_LAST_NAME", "CREATED_BY_SECOND_NAME", "CREATED_BY_LOGIN", "CREATED_BY_PERSONAL_PHOTO", "CREATED_BY_PERSONAL_GENDER", "RATING_TYPE_ID", "RATING_ENTITY_ID", "SOURCE_TYPE");
$dbEvent = CSocNetLog::GetList(array(), $arFilter, false, false, $arSelect, $arListParams);
if ($arEvent = $dbEvent->GetNext()) {
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($arEvent["EVENT_ID"]);
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
$GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_NAME_" . intval($arEvent["USER_ID"]));
$GLOBALS["CACHE_MANAGER"]->RegisterTag("SONET_LOG_" . intval($arEvent["ID"]));
if ($arEvent["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
$GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group_" . $arEvent["ENTITY_ID"]);
}
}
$arEvent["EVENT_ID_FULLSET"] = CSocNetLogTools::FindFullSetEventIDByEventID($arEvent["EVENT_ID"]);
if ($arEvent["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
static $arSiteWorkgroupsPage;
if (!$arSiteWorkgroupsPage && IsModuleInstalled("extranet")) {
$rsSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
while ($arSite = $rsSite->Fetch()) {
$arSiteWorkgroupsPage[$arSite["ID"]] = COption::GetOptionString("socialnetwork", "workgroups_page", $arSite["DIR"] . "workgroups/", $arSite["ID"]);
}
}
if (is_set($arEvent["URL"]) && is_array($arSiteWorkgroupsPage) && array_key_exists(SITE_ID, $arSiteWorkgroupsPage)) {
$arEvent["URL"] = str_replace("#GROUPS_PATH#", $arSiteWorkgroupsPage[SITE_ID], $arEvent["URL"]);
}
}
$arEventTmp = CSocNetLogTools::FindLogEventByID($arEvent["EVENT_ID"]);
if ($arEventTmp && is_array($arEventTmp) && array_key_exists("CLASS_FORMAT", $arEventTmp) && array_key_exists("METHOD_FORMAT", $arEventTmp)) {
$arParams["MOBILE"] = "Y";
$arParams["NEW_TEMPLATE"] = "Y";
$arEvent["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("SONET_LOG", $arEvent["ID"], LANGUAGE_ID);
$arEvent["FIELDS_FORMATTED"] = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arEvent, $arParams);
if (is_array($arEvent["FIELDS_FORMATTED"])) {
if (isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"])) {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] = CSocNetTextParser::closetags(htmlspecialcharsback($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"]));
}
if (isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"])) {
$arFields2Cache = array("URL", "STYLE", "DESTINATION", "DESTINATION_MORE", "TITLE", "TITLE_24", "TITLE_24_2", "IS_IMPORTANT", "MESSAGE", "DATETIME_FORMATTED", "LOG_DATE_FORMAT", "DESCRIPTION", "DESCRIPTION_STYLE", "AVATAR_STYLE", "HAS_COMMENTS");
foreach ($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"][$field]);
}
}
}
if (isset($arEvent["FIELDS_FORMATTED"]["EVENT"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT"])) {
$arFields2Cache = array("ID", "URL", "USER_ID", "ENTITY_TYPE", "ENTITY_ID", "EVENT_ID", "EVENT_ID_FULLSET", "TITLE", "SOURCE_ID", "MODULE_ID", "PARAMS", "RATING_TYPE_ID", "RATING_ENTITY_ID");
foreach ($arEvent["FIELDS_FORMATTED"]["EVENT"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arEvent["FIELDS_FORMATTED"]["EVENT"][$field]);
}
}
}
if (isset($arEvent["FIELDS_FORMATTED"]["CREATED_BY"]) && is_array($arEvent["FIELDS_FORMATTED"]["CREATED_BY"])) {
$arFields2Cache = array("TOOLTIP_FIELDS", "FORMATTED", "URL");
foreach ($arEvent["FIELDS_FORMATTED"]["CREATED_BY"] as $field => $value) {
//.........这里部分代码省略.........
示例6: onAfterCommentUpdate
public static function onAfterCommentUpdate($entityType, $entityId, $arData)
{
$log_event_id = CSocNetForumComments::FindLogEventIDByForumEntityID($entityType);
if (!$log_event_id)
return false;
$arLogCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($log_event_id);
if (!$arLogCommentEvent)
return false;
$arLogEvent = CSocNetLogTools::FindLogEventByID($log_event_id);
$entityId = intval($entityId);
if ($entityId <= 0)
return;
if (empty($arData["MESSAGE_ID"]))
return;
$parser = new CTextParser();
$parser->allow = array("HTML" => 'N',"ANCHOR" => 'Y',"BIU" => 'Y',"IMG" => "Y","VIDEO" => "Y","LIST" => 'N',"QUOTE" => 'Y',"CODE" => 'Y',"FONT" => 'Y',"SMILES" => "N","UPLOAD" => 'N',"NL2BR" => 'N',"TABLE" => "Y");
switch ($arData["ACTION"])
{
case "DEL":
case "HIDE":
$dbLogComment = CSocNetLogComments::GetList(
array("ID" => "DESC"),
array(
"EVENT_ID" => array($arLogCommentEvent["EVENT_ID"]),
"SOURCE_ID" => intval($arData["MESSAGE_ID"])
),
false,
false,
array("ID")
);
while ($arLogComment = $dbLogComment->Fetch())
CSocNetLogComments::Delete($arLogComment["ID"]);
break;
case "SHOW":
$dbLogComment = CSocNetLogComments::GetList(
array("ID" => "DESC"),
array(
"EVENT_ID" => array($arLogCommentEvent["EVENT_ID"]),
"SOURCE_ID" => intval($arData["MESSAGE_ID"])
),
false,
false,
array("ID")
);
$arLogComment = $dbLogComment->Fetch();
if (!$arLogComment)
{
$arMessage = CForumMessage::GetByID(intval($arData["MESSAGE_ID"]));
if ($arMessage)
{
$dbLog = CSocNetLog::GetList(
array("ID" => "DESC"),
array(
"EVENT_ID" => $log_event_id,
"SOURCE_ID" => $entityId
),
false,
false,
array("ID", "ENTITY_TYPE", "ENTITY_ID")
);
if ($arLog = $dbLog->Fetch())
{
$log_id = $arLog["ID"];
$entity_type = $arLog["ENTITY_TYPE"];
$entity_id = $arLog["ENTITY_ID"];
$sText = (COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"]);
$strURL = $GLOBALS['APPLICATION']->GetCurPageParam("", array("IFRAME", "MID", "SEF_APPLICATION_CUR_PAGE_URL", BX_AJAX_PARAM_ID, "result"));
$strURL = ForumAddPageParams(
$strURL,
array(
"MID" => intval($arData["MESSAGE_ID"]),
"result" => "reply"
),
false,
false
);
$arFieldsForSocnet = array(
"ENTITY_TYPE" => $entity_type,
"ENTITY_ID" => $entity_id,
"EVENT_ID" => $arLogCommentEvent["EVENT_ID"],
"MESSAGE" => $sText,
"TEXT_MESSAGE" => $parser->convert4mail($sText),
"URL" => str_replace("?IFRAME=Y", "", str_replace("&IFRAME=Y", "", str_replace("IFRAME=Y&", "", $strURL))),
"MODULE_ID" => (array_key_exists("MODULE_ID", $arLogCommentEvent) && strlen($arLogCommentEvent["MODULE_ID"]) > 0 ? $arLogCommentEvent["MODULE_ID"] : ""),
"SOURCE_ID" => intval($arData["MESSAGE_ID"]),
"LOG_ID" => $log_id,
"RATING_TYPE_ID" => "FORUM_POST",
"RATING_ENTITY_ID" => intval($arData["MESSAGE_ID"])
);
$arFieldsForSocnet["USER_ID"] = $arMessage["AUTHOR_ID"];
//.........这里部分代码省略.........
示例7: getCommentRights
public static function getCommentRights($arParams)
{
$arResult = array("COMMENT_RIGHTS_EDIT" => "N", "COMMENT_RIGHTS_DELETE" => "N");
$logEventId = isset($arParams["EVENT_ID"]) && strlen($arParams["EVENT_ID"]) > 0 ? $arParams["EVENT_ID"] : false;
$logSourceId = isset($arParams["SOURCE_ID"]) && intval($arParams["SOURCE_ID"]) > 0 ? intval($arParams["SOURCE_ID"]) : false;
$bCheckAdminSession = !isset($arParams["CHECK_ADMIN_SESSION"]) || $arParams["CHECK_ADMIN_SESSION"] != "N";
$arCommentEventMeta = CSocNetLogTools::FindLogCommentEventByLogEventID($logEventId);
$bHasEditCallback = is_array($arCommentEventMeta) && isset($arCommentEventMeta["UPDATE_CALLBACK"]) && ($arCommentEventMeta["UPDATE_CALLBACK"] == "NO_SOURCE" || is_callable($arCommentEventMeta["UPDATE_CALLBACK"]));
$bHasDeleteCallback = is_array($arCommentEventMeta) && isset($arCommentEventMeta["DELETE_CALLBACK"]) && ($arCommentEventMeta["DELETE_CALLBACK"] == "NO_SOURCE" || is_callable($arCommentEventMeta["DELETE_CALLBACK"]));
if ($bHasEditCallback || $bHasDeleteCallback) {
$arEventMeta = CSocNetLogTools::FindLogEventByID($logEventId);
if (!empty($arEventMeta) && !empty($arEventMeta["COMMENT_EVENT"]) && !empty($arEventMeta["COMMENT_EVENT"]["METHOD_CANEDIT"])) {
$res = call_user_func($arEventMeta["COMMENT_EVENT"]["METHOD_CANEDIT"], array("LOG_SOURCE_ID" => $logSourceId));
if ($res) {
$arResult["COMMENT_RIGHTS_EDIT"] = $bHasEditCallback ? "ALL" : "N";
$arResult["COMMENT_RIGHTS_DELETE"] = $bHasDeleteCallback ? "ALL" : "N";
} else {
if (!empty($arEventMeta["COMMENT_EVENT"]["METHOD_CANEDITOWN"])) {
$res = call_user_func($arEventMeta["COMMENT_EVENT"]["METHOD_CANEDITOWN"], array("LOG_SOURCE_ID" => $logSourceId));
if ($res) {
$arResult["COMMENT_RIGHTS_EDIT"] = $bHasEditCallback ? "OWN" : "N";
$arResult["COMMENT_RIGHTS_DELETE"] = $bHasDeleteCallback ? "OWN" : "N";
}
} elseif ($GLOBALS["USER"]->IsAuthorized()) {
$arResult["COMMENT_RIGHTS_EDIT"] = $bHasEditCallback ? IsModuleInstalled("intranet") ? "OWN" : "OWNLAST" : "N";
$arResult["COMMENT_RIGHTS_DELETE"] = $bHasDeleteCallback ? IsModuleInstalled("intranet") ? "OWN" : "OWNLAST" : "N";
}
}
} elseif (CSocNetUser::IsCurrentUserModuleAdmin(SITE_ID, $bCheckAdminSession)) {
$arResult["COMMENT_RIGHTS_EDIT"] = $bHasEditCallback ? "ALL" : "N";
$arResult["COMMENT_RIGHTS_DELETE"] = $bHasDeleteCallback ? "ALL" : "N";
} elseif ($GLOBALS["USER"]->IsAuthorized()) {
$arResult["COMMENT_RIGHTS_EDIT"] = $bHasEditCallback ? IsModuleInstalled("intranet") ? "OWN" : "OWNLAST" : "N";
$arResult["COMMENT_RIGHTS_DELETE"] = $bHasDeleteCallback ? IsModuleInstalled("intranet") ? "OWN" : "OWNLAST" : "N";
}
}
return $arResult;
}
示例8: 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"));
}
}
示例9: HasLogEventCreatedBy
function HasLogEventCreatedBy($event_id)
{
$bFound = false;
$arEvent = CSocNetLogTools::FindLogEventByID($event_id);
if ($arEvent)
{
if (
array_key_exists("HAS_CB", $arEvent)
&& $arEvent["HAS_CB"] == "Y"
)
$bFound = true;
}
else
{
$arEvent = CSocNetLogTools::FindLogCommentEventByID($event_id);
if ($arEvent)
$bFound = true;
}
return $bFound;
}
示例10: __SLEGetLogRecord
function __SLEGetLogRecord($logID, $arParams, $arCurrentUserSubscribe, $current_page_date)
{
$cache_time = 31536000;
$arEvent = array();
$cache = new CPHPCache();
$arCacheID = array();
$arKeys = array("AVATAR_SIZE", "DESTINATION_LIMIT", "CHECK_PERMISSIONS_DEST", "NAME_TEMPLATE", "NAME_TEMPLATE_WO_NOBR", "SHOW_LOGIN", "DATE_TIME_FORMAT", "PATH_TO_USER", "PATH_TO_GROUP", "PATH_TO_CONPANY_DEPARTMENT");
foreach ($arKeys as $param_key) {
if (array_key_exists($param_key, $arParams)) {
$arCacheID[$param_key] = $arParams[$param_key];
} else {
$arCacheID[$param_key] = false;
}
}
$cache_id = "log_post_" . $logID . "_" . md5(serialize($arCacheID)) . "_" . SITE_TEMPLATE_ID . "_" . SITE_ID . "_" . LANGUAGE_ID . "_" . CTimeZone::GetOffset();
$cache_path = "/sonet/log/";
if (is_object($cache) && $cache->InitCache($cache_time, $cache_id, $cache_path)) {
$arCacheVars = $cache->GetVars();
$arEvent["FIELDS_FORMATTED"] = $arCacheVars["FIELDS_FORMATTED"];
if (array_key_exists("CACHED_CSS_PATH", $arEvent["FIELDS_FORMATTED"])) {
if (!is_array($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]) && strlen($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]) > 0) {
$GLOBALS['APPLICATION']->SetAdditionalCSS($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"]);
} elseif (is_array($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"])) {
foreach ($arEvent["FIELDS_FORMATTED"]["CACHED_CSS_PATH"] as $css_path) {
$GLOBALS['APPLICATION']->SetAdditionalCSS($css_path);
}
}
}
} else {
if (is_object($cache)) {
$cache->StartDataCache($cache_time, $cache_id, $cache_path);
}
$arFilter = array("ID" => $logID);
$arListParams = array("CHECK_RIGHTS" => "N", "USE_FOLLOW" => "N", "USE_SUBSCRIBE" => "N");
$arSelect = array("ID", "TMP_ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "EVENT_ID", "LOG_DATE", "LOG_UPDATE", "TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "CALLBACK_FUNC", "EXTERNAL_ID", "SITE_ID", "PARAMS", "COMMENTS_COUNT", "ENABLE_COMMENTS", "SOURCE_ID", "GROUP_NAME", "GROUP_OWNER_ID", "GROUP_INITIATE_PERMS", "GROUP_VISIBLE", "GROUP_OPENED", "GROUP_IMAGE_ID", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "USER_PERSONAL_PHOTO", "USER_PERSONAL_GENDER", "CREATED_BY_NAME", "CREATED_BY_LAST_NAME", "CREATED_BY_SECOND_NAME", "CREATED_BY_LOGIN", "CREATED_BY_PERSONAL_PHOTO", "CREATED_BY_PERSONAL_GENDER", "RATING_TYPE_ID", "RATING_ENTITY_ID", "SOURCE_TYPE");
$dbEvent = CSocNetLog::GetList(array(), $arFilter, false, false, $arSelect, $arListParams);
if ($arEvent = $dbEvent->GetNext()) {
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cache_path);
$GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_CARD_" . intval($arEvent["USER_ID"] / 100));
$GLOBALS["CACHE_MANAGER"]->RegisterTag("SONET_LOG_" . intval($arEvent["ID"]));
if ($arEvent["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
$GLOBALS["CACHE_MANAGER"]->RegisterTag("sonet_group_" . $arEvent["ENTITY_ID"]);
}
}
$arEvent["EVENT_ID_FULLSET"] = CSocNetLogTools::FindFullSetEventIDByEventID($arEvent["EVENT_ID"]);
if ($arEvent["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
static $arSiteWorkgroupsPage;
if (!$arSiteWorkgroupsPage && IsModuleInstalled("extranet")) {
$rsSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
while ($arSite = $rsSite->Fetch()) {
$arSiteWorkgroupsPage[$arSite["ID"]] = COption::GetOptionString("socialnetwork", "workgroup_page", $arSite["DIR"] . "workgroups/", $arSite["ID"]);
}
}
if (is_set($arEvent["URL"]) && is_array($arSiteWorkgroupsPage) && array_key_exists(SITE_ID, $arSiteWorkgroupsPage)) {
$arEvent["URL"] = str_replace("#GROUPS_PATH#", $arSiteWorkgroupsPage[SITE_ID], $arEvent["URL"]);
}
}
$arEventTmp = CSocNetLogTools::FindLogEventByID($arEvent["EVENT_ID"]);
if ($arEventTmp && is_array($arEventTmp) && array_key_exists("CLASS_FORMAT", $arEventTmp) && array_key_exists("METHOD_FORMAT", $arEventTmp)) {
$arEvent["FIELDS_FORMATTED"] = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arEvent, $arParams);
if (is_array($arEvent["FIELDS_FORMATTED"])) {
if (isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"])) {
$arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] = CSocNetTextParser::closetags(htmlspecialcharsback($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"]));
}
if (isset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"])) {
$arFields2Cache = array("URL", "STYLE", "DESTINATION", "DESTINATION_MORE", "TITLE_24", "TITLE_24_2", "IS_IMPORTANT", "MESSAGE", "MESSAGE_TITLE_24", "DATETIME_FORMATTED");
foreach ($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arEvent["FIELDS_FORMATTED"]["EVENT_FORMATTED"][$field]);
}
}
}
if (isset($arEvent["FIELDS_FORMATTED"]["EVENT"]) && is_array($arEvent["FIELDS_FORMATTED"]["EVENT"])) {
$arFields2Cache = array("ID", "URL", "USER_ID", "ENTITY_TYPE", "ENTITY_ID", "EVENT_ID", "EVENT_ID_FULLSET", "TITLE", "SOURCE_ID", "PARAMS", "RATING_TYPE_ID", "RATING_ENTITY_ID");
foreach ($arEvent["FIELDS_FORMATTED"]["EVENT"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arEvent["FIELDS_FORMATTED"]["EVENT"][$field]);
}
}
}
if (isset($arEvent["FIELDS_FORMATTED"]["CREATED_BY"]) && is_array($arEvent["FIELDS_FORMATTED"]["CREATED_BY"])) {
$arFields2Cache = array("TOOLTIP_FIELDS", "FORMATTED", "URL");
foreach ($arEvent["FIELDS_FORMATTED"]["CREATED_BY"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arEvent["FIELDS_FORMATTED"]["CREATED_BY"][$field]);
}
}
if (isset($arEvent["FIELDS_FORMATTED"]["CREATED_BY"]["TOOLTIP_FIELDS"]) && is_array($arEvent["FIELDS_FORMATTED"]["CREATED_BY"]["TOOLTIP_FIELDS"])) {
$arFields2Cache = array("ID", "PATH_TO_SONET_USER_PROFILE", "NAME", "LAST_NAME", "SECOND_NAME", "LOGIN", "EMAIL");
foreach ($arEvent["FIELDS_FORMATTED"]["CREATED_BY"]["TOOLTIP_FIELDS"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arEvent["FIELDS_FORMATTED"]["CREATED_BY"]["TOOLTIP_FIELDS"][$field]);
}
}
}
}
if (isset($arEvent["FIELDS_FORMATTED"]["ENTITY"]) && is_array($arEvent["FIELDS_FORMATTED"]["ENTITY"])) {
$arFields2Cache = array("TOOLTIP_FIELDS", "FORMATTED", "URL");
foreach ($arEvent["FIELDS_FORMATTED"]["ENTITY"] as $field => $value) {
//.........这里部分代码省略.........
示例11: __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"];
}