本文整理汇总了PHP中CSocNetLogTools::FindLogCommentEventByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogTools::FindLogCommentEventByID方法的具体用法?PHP CSocNetLogTools::FindLogCommentEventByID怎么用?PHP CSocNetLogTools::FindLogCommentEventByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetLogTools
的用法示例。
在下文中一共展示了CSocNetLogTools::FindLogCommentEventByID方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetSource
function SetSource($arFields)
{
$arCallback = false;
$arEvent = CSocNetLogTools::FindLogCommentEventByID($arFields["EVENT_ID"]);
if ($arEvent) {
$arCallback = $arEvent["ADD_CALLBACK"];
}
if ($arCallback && is_callable($arCallback)) {
$arSource = call_user_func_array($arCallback, array($arFields));
}
return $arSource;
}
示例2: __SLEGetLogCommentRecord
function __SLEGetLogCommentRecord($arComments, $arParams, &$arAssets)
{
// for the same post log_update - time only, if not - date and time
$timestamp = MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"]);
$timeFormated = FormatDateFromDB($arComments["LOG_DATE"], stripos($arParams["DATE_TIME_FORMAT"], 'a') || ($arParams["DATE_TIME_FORMAT"] == 'FULL' && IsAmPmMode()) !== false ? strpos(FORMAT_DATETIME, 'TT') !== false ? 'G:MI TT' : 'G:MI T' : 'HH:MI');
$dateTimeFormated = FormatDate(!empty($arParams['DATE_TIME_FORMAT']) ? $arParams['DATE_TIME_FORMAT'] == 'FULL' ? $GLOBALS['DB']->DateFormatToPHP(str_replace(':SS', '', FORMAT_DATETIME)) : $arParams['DATE_TIME_FORMAT'] : $GLOBALS['DB']->DateFormatToPHP(FORMAT_DATETIME), $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);
}
$path2Entity = $arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arComments["ENTITY_ID"])) : CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["ENTITY_ID"]));
if (intval($arComments["USER_ID"]) > 0) {
$suffix = is_array($GLOBALS["arExtranetUserID"]) && in_array($arComments["USER_ID"], $GLOBALS["arExtranetUserID"]) ? GetMessage("SONET_LOG_EXTRANET_SUFFIX") : "";
$arTmpUser = array("NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"]);
$bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false;
$arCreatedBy = array("FORMATTED" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arTmpUser, $bUseLogin) . $suffix, "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["USER_ID"], "id" => $arComments["USER_ID"])));
$arCreatedBy["TOOLTIP_FIELDS"] = array("ID" => $arComments["USER_ID"], "NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"], "USE_THUMBNAIL_LIST" => "N", "PATH_TO_SONET_MESSAGES_CHAT" => $arParams["PATH_TO_MESSAGES_CHAT"], "PATH_TO_SONET_USER_PROFILE" => $arParams["PATH_TO_USER"], "PATH_TO_VIDEO_CALL" => $arParams["PATH_TO_VIDEO_CALL"], "DATE_TIME_FORMAT" => $arParams["DATE_TIME_FORMAT"], "SHOW_YEAR" => $arParams["SHOW_YEAR"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"] . $suffix, "SHOW_LOGIN" => $arParams["SHOW_LOGIN"], "PATH_TO_CONPANY_DEPARTMENT" => $arParams["PATH_TO_CONPANY_DEPARTMENT"], "INLINE" => "Y");
} else {
$arCreatedBy = array("FORMATTED" => GetMessage("SONET_C73_CREATED_BY_ANONYMOUS"));
}
$arTmpUser = array("NAME" => $arComments["~USER_NAME"], "LAST_NAME" => $arComments["~USER_LAST_NAME"], "SECOND_NAME" => $arComments["~USER_SECOND_NAME"], "LOGIN" => $arComments["~USER_LOGIN"]);
$arParamsTmp = $arParams;
$arParamsTmp["AVATAR_SIZE"] = isset($arParams["AVATAR_SIZE_COMMON"]) ? $arParams["AVATAR_SIZE_COMMON"] : $arParams["AVATAR_SIZE"];
$arTmpCommentEvent = array("EVENT" => $arComments, "LOG_DATE" => $arComments["LOG_DATE"], "LOG_DATE_TS" => MakeTimeStamp($arComments["LOG_DATE"]), "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComments["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "LOG_DATETIME_FORMAT" => $dateTimeFormated, "TITLE_TEMPLATE" => "", "TITLE" => "", "TITLE_FORMAT" => "", "ENTITY_NAME" => $arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? $arComments["GROUP_NAME"] : CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin), "ENTITY_PATH" => $path2Entity, "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arComments, $arParamsTmp));
$arEvent = CSocNetLogTools::FindLogCommentEventByID($arComments["EVENT_ID"]);
if ($arEvent && array_key_exists("CLASS_FORMAT", $arEvent) && array_key_exists("METHOD_FORMAT", $arEvent)) {
$arLog = $arParams["USER_COMMENTS"] == "Y" ? array() : array("TITLE" => $arComments["~LOG_TITLE"], "URL" => $arComments["~LOG_URL"], "PARAMS" => $arComments["~LOG_PARAMS"]);
$arFIELDS_FORMATTED = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arComments, $arParams, false, $arLog);
if ($arParams["USE_COMMENTS"] != "Y") {
if (array_key_exists("CREATED_BY", $arFIELDS_FORMATTED) && isset($arFIELDS_FORMATTED["CREATED_BY"]["TOOLTIP_FIELDS"])) {
$arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"] = $arFIELDS_FORMATTED["CREATED_BY"]["TOOLTIP_FIELDS"];
}
}
}
$message = $arFIELDS_FORMATTED && array_key_exists("EVENT_FORMATTED", $arFIELDS_FORMATTED) && array_key_exists("MESSAGE", $arFIELDS_FORMATTED["EVENT_FORMATTED"]) ? $arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"] : $arTmpCommentEvent["EVENT"]["MESSAGE"];
if (strlen($message) > 0) {
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["FULL_MESSAGE_CUT"] = CSocNetTextParser::closetags(htmlspecialcharsback($message));
}
if (is_array($arTmpCommentEvent)) {
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $arTmpCommentEvent["LOG_DATE_DAY"] == ConvertTimeStamp() ? $timeFormated : $dateTimeFormated;
$arTmpCommentEvent["EVENT_FORMATTED"] = $arFIELDS_FORMATTED["EVENT_FORMATTED"];
if (isset($arComments["UF"]["UF_SONET_COM_URL_PRV"]) && !empty($arComments["UF"]["UF_SONET_COM_URL_PRV"]["VALUE"])) {
$arCss = $GLOBALS["APPLICATION"]->sPath2css;
$arJs = $GLOBALS["APPLICATION"]->arHeadScripts;
ob_start();
$GLOBALS["APPLICATION"]->IncludeComponent("bitrix:system.field.view", $arComments["UF"]["UF_SONET_COM_URL_PRV"]["USER_TYPE_ID"], array("arUserField" => $arComments["UF"]["UF_SONET_COM_URL_PRV"], "arAddField" => array("NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"], "PATH_TO_USER" => $arParams["~PATH_TO_USER"])), null, array("HIDE_ICONS" => "Y"));
$urlPreviewText = ob_get_clean();
$arTmpCommentEvent["EVENT_FORMATTED"]["FULL_MESSAGE_CUT"] .= $urlPreviewText;
$arAssets["CSS"] = array_merge($arAssets["CSS"], array_diff($GLOBALS["APPLICATION"]->sPath2css, $arCss));
$arAssets["JS"] = array_merge($arAssets["JS"], array_diff($GLOBALS["APPLICATION"]->arHeadScripts, $arJs));
unset($arComments["UF"]["UF_SONET_COM_URL_PRV"]);
}
$arTmpCommentEvent["UF"] = $arComments["UF"];
if (isset($arTmpCommentEvent["EVENT_FORMATTED"]) && is_array($arTmpCommentEvent["EVENT_FORMATTED"])) {
$arFields2Cache = array("DATETIME", "MESSAGE", "FULL_MESSAGE_CUT", "ERROR_MSG");
foreach ($arTmpCommentEvent["EVENT_FORMATTED"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["EVENT_FORMATTED"][$field]);
}
}
}
if (isset($arTmpCommentEvent["EVENT"]) && is_array($arTmpCommentEvent["EVENT"])) {
if (!empty($arTmpCommentEvent["EVENT"]["URL"])) {
$arTmpCommentEvent["EVENT"]["URL"] = str_replace("#GROUPS_PATH#", COption::GetOptionString("socialnetwork", "workgroups_page", "/workgroups/", SITE_ID), $arTmpCommentEvent["EVENT"]["URL"]);
}
$arFields2Cache = array("ID", "SOURCE_ID", "EVENT_ID", "USER_ID", "LOG_DATE", "RATING_TYPE_ID", "RATING_ENTITY_ID", "URL");
foreach ($arTmpCommentEvent["EVENT"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["EVENT"][$field]);
}
}
}
if (isset($arTmpCommentEvent["CREATED_BY"]) && is_array($arTmpCommentEvent["CREATED_BY"])) {
$arFields2Cache = array("TOOLTIP_FIELDS", "FORMATTED", "URL");
foreach ($arTmpCommentEvent["CREATED_BY"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["CREATED_BY"][$field]);
}
}
if (isset($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"]) && is_array($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"])) {
$arFields2Cache = array("ID", "PATH_TO_SONET_USER_PROFILE", "NAME", "LAST_NAME", "SECOND_NAME", "LOGIN", "EMAIL");
foreach ($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"][$field]);
}
}
}
}
}
foreach ($arTmpCommentEvent["EVENT"] as $key => $value) {
if (strpos($key, "~") === 0) {
unset($arTmpCommentEvent["EVENT"][$key]);
}
}
return $arTmpCommentEvent;
//.........这里部分代码省略.........
示例3: array
else
$arCreatedBy = array("FORMATTED" => GetMessage("SONET_C73_CREATED_BY_ANONYMOUS"));
$arTmpCommentEvent = array(
"LOG_DATE" => $arComment["LOG_DATE"],
"LOG_DATE_FORMAT" => $arComment["LOG_DATE_FORMAT"],
"LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComment["LOG_DATE"]), "SHORT"),
"LOG_TIME_FORMAT" => $timeFormated,
"MESSAGE" => $arComment["MESSAGE"],
"MESSAGE_FORMAT" => $arComment["~MESSAGE"],
"CREATED_BY" => $arCreatedBy,
"AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arUser, $arParams, ""),
"USER_ID" => $arComment["USER_ID"]
);
$arEventTmp = CSocNetLogTools::FindLogCommentEventByID($arComment["EVENT_ID"]);
if (
$arEventTmp
&& array_key_exists("CLASS_FORMAT", $arEventTmp)
&& array_key_exists("METHOD_FORMAT", $arEventTmp)
)
{
$arFIELDS_FORMATTED = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arComment, $arParams);
$arTmpCommentEvent["MESSAGE_FORMAT"] = htmlspecialcharsback($arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"]);
}
$arResult["arCommentFormatted"] = $arTmpCommentEvent;
}
}
elseif ($action == "get_comments")
{
示例4: SetSource
public static function SetSource($arFields, $action = false)
{
$arCallback = false;
if (!$action) {
$action = "ADD";
}
if (!in_array($action, array("ADD", "UPDATE", "DELETE"))) {
return false;
}
$arEvent = CSocNetLogTools::FindLogCommentEventByID($arFields["EVENT_ID"]);
if ($arEvent) {
$arCallback = $arEvent[$action . "_CALLBACK"];
}
if ($arCallback && is_callable($arCallback)) {
$arSource = call_user_func_array($arCallback, array($arFields));
}
return $arSource;
}
示例5: OnAddRatingVote
public static function OnAddRatingVote($id, $arParams)
{
$bSocialnetworkInstalled = CModule::IncludeModule("socialnetwork");
if ($arParams['ENTITY_TYPE_ID'] == 'LISTS_NEW_ELEMENT' && CModule::IncludeModule("socialnetwork")) {
$rsLog = CSocNetLog::GetList(array(), array("RATING_TYPE_ID" => $arParams['ENTITY_TYPE_ID'], "RATING_ENTITY_ID" => $arParams['ENTITY_ID']), false, false, array("ID", "USER_ID", "TITLE_TEMPLATE", "TITLE"));
if ($arLog = $rsLog->Fetch()) {
if ($arLog['USER_ID'] != $arParams['USER_ID']) {
$url = COption::GetOptionString("socialnetwork", "log_entry_page", $arSites[$user_site_id]["DIR"] . "company/personal/log/#log_id#/", SITE_ID);
$url = str_replace("#log_id#", $arLog["ID"], $url);
$arParams['ENTITY_LINK'] = $url;
$arParams['ENTITY_TITLE'] = htmlspecialcharsback($arLog["TITLE"]);
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => intval($arLog['USER_ID']), "FROM_USER_ID" => intval($arParams['USER_ID']), "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "main", "NOTIFY_EVENT" => "rating_vote", "NOTIFY_TAG" => "RATING|" . ($arParams['VALUE'] >= 0 ? "" : "DL|") . $arParams['ENTITY_TYPE_ID'] . "|" . $arParams['ENTITY_ID'], "NOTIFY_MESSAGE" => self::GetMessageRatingVote($arParams), "NOTIFY_MESSAGE_OUT" => self::GetMessageRatingVote($arParams, true));
CIMNotify::Add($arMessageFields);
}
}
} elseif ($arParams['ENTITY_TYPE_ID'] == 'LOG_COMMENT') {
if ($arComment = CSocNetLogComments::GetByID($arParams['ENTITY_ID'])) {
preg_match_all("/\\[user\\s*=\\s*([^\\]]*)\\](.+?)\\[\\/user\\]/ies" . BX_UTF_PCRE_MODIFIER, $arComment["TEXT_MESSAGE"], $arMention);
if (!empty($arMention)) {
$arMentionedUserID = $arMention[1];
}
if ($arComment['USER_ID'] == $arParams['USER_ID'] && empty($arMentionedUserID)) {
return false;
}
$arEventTmp = CSocNetLogTools::FindLogCommentEventByID($arComment["EVENT_ID"]);
if ($arEventTmp && array_key_exists("CLASS_FORMAT", $arEventTmp) && array_key_exists("METHOD_FORMAT", $arEventTmp)) {
$arComment["MESSAGE"] = preg_replace(array('|\\[DISK\\sFILE\\sID=[n]*\\d+\\]|', '|\\[DOCUMENT\\sID=[n]*\\d+\\]|'), '', $arComment["MESSAGE"]);
$arComment["MESSAGE"] = preg_replace('|\\[QUOTE\\](.+?)\\[\\/QUOTE\\]|is' . BX_UTF_PCRE_MODIFIER, '"\\1"', $arComment["MESSAGE"]);
$arFIELDS_FORMATTED = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arComment, array("IM" => "Y"));
$CCTP = new CTextParser();
$CCTP->MaxStringLen = 200;
$CCTP->allow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "Y", "NL2BR" => "Y", "VIDEO" => "N", "TABLE" => "N", "CUT_ANCHOR" => "N", "ALIGN" => "N");
$arComment["MESSAGE"] = $CCTP->convertText($arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"]);
}
$arComment["MESSAGE"] = preg_replace(array('|\\[DISK\\sFILE\\sID=[n]*\\d+\\]|', '|\\[DOCUMENT\\sID=[n]*\\d+\\]|'), '', $arComment["MESSAGE"]);
$arParams["ENTITY_TITLE"] = strip_tags(str_replace(array("<br>", "<br/>", "<br />", "#BR#"), array(" ", " ", " ", " "), htmlspecialcharsback($arComment["MESSAGE"])));
$bExtranetInstalled = CModule::IncludeModule("extranet");
if ($bExtranetInstalled) {
$arSites = array();
$extranet_site_id = CExtranet::GetExtranetSiteID();
$intranet_site_id = CSite::GetDefSite();
$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"]));
}
}
if ($arComment['USER_ID'] != $arParams['USER_ID']) {
$followValue = "Y";
if ($bSocialnetworkInstalled) {
$followValue = CSocNetLogFollow::GetExactValueByRating($arComment['USER_ID'], trim($arParams["ENTITY_TYPE_ID"]), intval($arParams["ENTITY_ID"]));
}
if ($followValue != "N") {
$arParams['ENTITY_LINK'] = self::GetMessageRatingLogCommentURL($arComment, intval($arComment['USER_ID']), $arSites, $intranet_site_id, $extranet_site_id);
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => intval($arComment['USER_ID']), "FROM_USER_ID" => intval($arParams['USER_ID']), "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "main", "NOTIFY_EVENT" => "rating_vote", "NOTIFY_TAG" => "RATING|" . ($arParams['VALUE'] >= 0 ? "" : "DL|") . $arParams['ENTITY_TYPE_ID'] . "|" . $arParams['ENTITY_ID'], "NOTIFY_MESSAGE" => self::GetMessageRatingVote($arParams), "NOTIFY_MESSAGE_OUT" => self::GetMessageRatingVote($arParams, true));
CIMNotify::Add($arMessageFields);
}
}
if (!empty($arMentionedUserID) && is_array($arMentionedUserID)) {
$arParams["MENTION"] = true;
// for self::GetMessageRatingVote()
foreach ($arMentionedUserID as $mentioned_user_id) {
if ($mentioned_user_id != $arParams['USER_ID'] && CSocNetLogRights::CheckForUserOnly($arComment["LOG_ID"], $mentioned_user_id)) {
$followValue = "Y";
if ($bSocialnetworkInstalled) {
$followValue = CSocNetLogFollow::GetExactValueByRating(intval($mentioned_user_id), trim($arParams["ENTITY_TYPE_ID"]), intval($arParams["ENTITY_ID"]));
}
if ($followValue != "N") {
$arParams['ENTITY_LINK'] = self::GetMessageRatingLogCommentURL($arComment, intval($mentioned_user_id), $arSites, $intranet_site_id, $extranet_site_id);
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => intval($mentioned_user_id), "FROM_USER_ID" => intval($arParams['USER_ID']), "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "main", "NOTIFY_EVENT" => "rating_vote_mentioned", "NOTIFY_TAG" => "RATING_MENTION|" . ($arParams['VALUE'] >= 0 ? "" : "DL|") . $arParams['ENTITY_TYPE_ID'] . "|" . $arParams['ENTITY_ID'], "NOTIFY_MESSAGE" => self::GetMessageRatingVote($arParams), "NOTIFY_MESSAGE_OUT" => self::GetMessageRatingVote($arParams, true));
CIMNotify::Add($arMessageFields);
}
}
}
}
}
} else {
if (!CModule::IncludeModule("search") || BX_SEARCH_VERSION <= 1) {
return false;
}
$CSI = new CSearchItem();
$arFSearch = array('=ENTITY_TYPE_ID' => $arParams['ENTITY_TYPE_ID'], '=ENTITY_ID' => $arParams['ENTITY_ID']);
if (defined("SITE_ID") && strlen(SITE_ID) > 0) {
$arFSearch["=SITE_ID"] = SITE_ID;
}
$res = $CSI->GetList(array(), $arFSearch, array('ID', 'URL', 'TITLE', 'BODY', 'PARAM1'));
if ($arItem = $res->GetNext(true, false)) {
// notify mentioned users
$arSearchItemParams = CSearch::GetContentItemParams($arItem['ID'], 'mentioned_user_id');
if (is_array($arSearchItemParams) && array_key_exists('mentioned_user_id', $arSearchItemParams) && is_array($arSearchItemParams['mentioned_user_id'])) {
$arMentionedUserID = $arSearchItemParams['mentioned_user_id'];
}
// send to author
if ($arParams['OWNER_ID'] != $arParams['USER_ID'] || $arMentionedUserID) {
$arParams["ENTITY_LINK"] = $arItem['URL'];
$arParams["ENTITY_PARAM"] = $arItem['PARAM1'];
$arParams["ENTITY_TITLE"] = trim(strip_tags(str_replace(array("\r\n", "\n", "\r"), ' ', htmlspecialcharsback($arItem['TITLE']))));
$arParams["ENTITY_MESSAGE"] = trim(strip_tags(str_replace(array("\r\n", "\n", "\r"), ' ', htmlspecialcharsback($arItem['BODY']))));
if ((strlen($arParams["ENTITY_TITLE"]) > 0 || strlen($arParams["ENTITY_MESSAGE"]) > 0) && strlen($arParams["ENTITY_LINK"]) > 0) {
$originalLink = $arParams["ENTITY_LINK"];
$bExtranetInstalled = CModule::IncludeModule("extranet");
//.........这里部分代码省略.........
示例6: Update
function Update($ID, $arFields, $bSetSource = false)
{
global $DB;
$ID = IntVal($ID);
if ($ID <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_LC_WRONG_PARAMETER_ID"), "ERROR_NO_ID");
return false;
}
if ($bSetSource)
{
if (strlen($arFields["EVENT_ID"]) > 0)
{
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByID($arFields["EVENT_ID"]);
if (
!$arCommentEvent
|| !array_key_exists("UPDATE_CALLBACK", $arCommentEvent)
|| !is_callable($arCommentEvent["UPDATE_CALLBACK"])
)
{
$bSetSource = false;
}
}
if (
!isset($arFields["SOURCE_ID"])
|| !isset($arFields["LOG_ID"])
)
{
$rsRes = CSocNetLogComments::GetList(
array(),
array("ID" => $ID),
false,
false,
array("LOG_ID", "SOURCE_ID")
);
if ($arRes = $rsRes->Fetch())
{
$arFields["SOURCE_ID"] = $arRes["SOURCE_ID"];
$arFields["LOG_ID"] = $arRes["LOG_ID"];
}
}
if (!isset($arFields["SOURCE_ID"]))
{
$bSetSource = false;
}
}
$arFields1 = array();
foreach ($arFields as $key => $value)
{
if (substr($key, 0, 1) == "=")
{
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if ($bSetSource)
{
$arSource = CSocNetLogComments::SetSource($arFields, "UPDATE");
if (
isset($arSource["NO_SOURCE"])
&& $arSource["NO_SOURCE"] == "Y"
)
{
$bSetSource = false;
}
elseif (
is_array($arSource)
&& (
isset($arSource["ERROR"])
&& !empty($arSource["ERROR"])
)
)
{
return array(
"ID" => false,
"MESSAGE" => $arSource["ERROR"]
);
}
else
{
if (
isset($arSource["MESSAGE"])
&& strlen($arSource["MESSAGE"]) > 0
)
{
$arFields["MESSAGE"] = $arSource["MESSAGE"];
}
if (
isset($arSource["TEXT_MESSAGE"])
&& strlen($arSource["TEXT_MESSAGE"]) > 0
)
{
//.........这里部分代码省略.........
示例7: __SLMAjaxGetComment
function __SLMAjaxGetComment($comment_id, $arParams, $bCheckRights = false)
{
if ($arComment = CSocNetLogComments::GetByID($comment_id)) {
if ($bCheckRights) {
if (strpos($arComment["ENTITY_TYPE"], "CRM") === 0 && IsModuleInstalled("crm")) {
$arListParams = array("IS_CRM" => "Y", "CHECK_CRM_RIGHTS" => "Y");
} else {
$arListParams = array("CHECK_RIGHTS" => "Y", "USE_SUBSCRIBE" => "N");
}
if (intval($arComment["LOG_ID"]) <= 0 || !($rsLog = CSocNetLog::GetList(array(), array("ID" => $arComment["LOG_ID"]), false, false, array("ID"), $arListParams)) || !($arLog = $rsLog->Fetch())) {
return false;
}
}
$arParams["DATE_TIME_FORMAT"] = $_REQUEST["dtf"];
$dateFormated = FormatDate($GLOBALS['DB']->DateFormatToPHP(FORMAT_DATE), MakeTimeStamp($arComment["LOG_DATE"]));
$timeFormated = FormatDateFromDB($arComment["LOG_DATE"], stripos($arParams["DATE_TIME_FORMAT"], 'a') || ($arParams["DATE_TIME_FORMAT"] == 'FULL' && IsAmPmMode()) !== false ? 'H:MI T' : 'HH:MI');
$dateTimeFormated = FormatDate(!empty($arParams['DATE_TIME_FORMAT']) ? $arParams['DATE_TIME_FORMAT'] == 'FULL' ? $GLOBALS['DB']->DateFormatToPHP(str_replace(':SS', '', FORMAT_DATETIME)) : $arParams['DATE_TIME_FORMAT'] : $GLOBALS['DB']->DateFormatToPHP(FORMAT_DATETIME), MakeTimeStamp($arComment["LOG_DATE"]));
if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
$dateFormated = ToLower($dateFormated);
$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);
}
if (intval($arComment["USER_ID"]) > 0) {
$arParams = array("PATH_TO_USER" => $_REQUEST["p_user"], "NAME_TEMPLATE" => $_REQUEST["nt"], "SHOW_LOGIN" => $_REQUEST["sl"], "AVATAR_SIZE" => $as, "PATH_TO_SMILE" => $_REQUEST["p_smile"]);
$arUser = array("ID" => $arComment["USER_ID"], "NAME" => $arComment["~CREATED_BY_NAME"], "LAST_NAME" => $arComment["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComment["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComment["~CREATED_BY_LOGIN"], "PERSONAL_PHOTO" => $arComment["~CREATED_BY_PERSONAL_PHOTO"], "PERSONAL_GENDER" => $arComment["~CREATED_BY_PERSONAL_GENDER"]);
$bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false;
$arCreatedBy = array("FORMATTED" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arUser, $bUseLogin), "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComment["USER_ID"], "id" => $arComment["USER_ID"])));
} else {
$arCreatedBy = array("FORMATTED" => GetMessage("SONET_SLM_CREATED_BY_ANONYMOUS"));
}
$arTmpCommentEvent = array("LOG_DATE" => $arComment["LOG_DATE"], "LOG_DATE_FORMAT" => $arComment["LOG_DATE_FORMAT"], "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComment["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "MESSAGE" => $arComment["MESSAGE"], "MESSAGE_FORMAT" => $arComment["~MESSAGE"], "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arUser, $arParams, ""), "USER_ID" => $arComment["USER_ID"]);
$arEventTmp = CSocNetLogTools::FindLogCommentEventByID($arComment["EVENT_ID"]);
if ($arEventTmp && array_key_exists("CLASS_FORMAT", $arEventTmp) && array_key_exists("METHOD_FORMAT", $arEventTmp)) {
$arComment["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("SONET_COMMENT", $arComment["ID"], LANGUAGE_ID);
$arFIELDS_FORMATTED = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arComment, array_merge($arParams, array("MOBILE" => "N", "PATH_TO_USER" => COption::GetOptionString("main", "TOOLTIP_PATH_TO_USER", SITE_DIR . "company/personal/user/#user_id#/", SITE_ID))));
$arTmpCommentEvent["MESSAGE_FORMAT"] = htmlspecialcharsback($arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"]);
$arFIELDS_FORMATTED = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arComment, array_merge($arParams, array("MOBILE" => "Y", "PATH_TO_USER" => SITE_DIR . "mobile/users/?user_id=#user_id#")));
$arTmpCommentEvent["MESSAGE_FORMAT_MOBILE"] = htmlspecialcharsback($arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"]);
}
return $arTmpCommentEvent;
}
}
示例8: Add
function Add($arFields, $bSetSource = false, $bSendEvent = true, $bSetLogUpDate = true)
{
global $DB;
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSocNetLogComments::CheckFields("ADD", $arFields)) {
return false;
}
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByID($arFields["EVENT_ID"]);
if (!$arCommentEvent || !array_key_exists("ADD_CALLBACK", $arCommentEvent) || !is_callable($arCommentEvent["ADD_CALLBACK"])) {
$bSetSource = false;
}
$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetLogCommentAdd");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
return false;
}
}
if ($bSetSource) {
$arSource = CSocNetLogComments::SetSource($arFields);
if (intval($arSource["SOURCE_ID"]) > 0) {
$arFields["SOURCE_ID"] = $arSource["SOURCE_ID"];
if (array_key_exists("RATING_ENTITY_ID", $arSource) && array_key_exists("RATING_TYPE_ID", $arSource) && intval($arSource["RATING_ENTITY_ID"]) > 0 && strlen($arSource["RATING_TYPE_ID"]) > 0) {
$arFields["RATING_TYPE_ID"] = $arSource["RATING_TYPE_ID"];
$arFields["RATING_ENTITY_ID"] = $arSource["RATING_ENTITY_ID"];
}
if (isset($arSource["MESSAGE"]) && strlen($arSource["MESSAGE"]) > 0) {
$arFields["MESSAGE"] = $arSource["MESSAGE"];
}
if (isset($arSource["TEXT_MESSAGE"]) && strlen($arSource["TEXT_MESSAGE"]) > 0) {
$arFields["TEXT_MESSAGE"] = $arSource["TEXT_MESSAGE"];
}
} else {
$strMessage = array_key_exists("ERROR", $arSource) && strlen($arSource["ERROR"]) > 0 ? $arSource["ERROR"] : (array_key_exists("NOTES", $arSource) && strlen($arSource["NOTES"]) > 0 ? $arSource["NOTES"] : "");
}
}
if (!$bSetSource || is_array($arSource) && array_key_exists("SOURCE_ID", $arFields) && intval($arFields["SOURCE_ID"]) > 0) {
$arInsert = $DB->PrepareInsert("b_sonet_log_comment", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($arInsert[0]) > 0) {
$arInsert[0] .= ", ";
}
$arInsert[0] .= $key;
if (strlen($arInsert[1]) > 0) {
$arInsert[1] .= ", ";
}
$arInsert[1] .= $value;
}
$ID = false;
if (strlen($arInsert[0]) > 0) {
$strSql = "INSERT INTO b_sonet_log_comment(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = IntVal($DB->LastID());
if ($ID > 0) {
if (!array_key_exists("RATING_TYPE_ID", $arFields) || empty($arFields["RATING_TYPE_ID"])) {
CSocNetLogComments::Update($ID, array("RATING_TYPE_ID" => "LOG_COMMENT", "RATING_ENTITY_ID" => $ID));
}
CSocNetLogFollow::Set($arFields["USER_ID"], "L" . $arFields["LOG_ID"], "Y");
$rsLog = CSocNetLog::GetList(array(), array("ID" => $arFields["LOG_ID"]), false, false, array("ID", "USER_ID"));
if (($arLog = $rsLog->Fetch()) && intval($arLog["USER_ID"]) > 0) {
$default_follow = CSocNetLogFollow::GetDefaultValue($arLog["USER_ID"]);
if ($default_follow != "Y") {
$rsLogFollow = CSocNetLogFollow::GetList(array("USER_ID" => $arLog["USER_ID"], "CODE" => "L" . $arFields["LOG_ID"]), array("TYPE"));
$arLogFoillow = $rsLogFollow->Fetch();
if (!$arLogFoillow) {
CSocNetLogFollow::Set($arLog["USER_ID"], "L" . $arFields["LOG_ID"], "Y");
}
}
}
if ($bSendEvent) {
CSocNetLogComments::SendEvent($ID, "SONET_NEW_EVENT");
}
CSocNetLogComments::UpdateLogData($arFields["LOG_ID"], $bSetLogUpDate);
$db_events = GetModuleEvents("socialnetwork", "OnAfterSocNetLogCommentAdd");
while ($arEvent = $db_events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("SONET_LOG_" . $arFields["LOG_ID"]);
}
}
}
CSocNetLogTools::SetCacheLastLogID("comment", $ID);
return $ID;
} elseif ($bSetSource && strlen($strMessage) > 0) {
return array("ID" => false, "MESSAGE" => $strMessage);
} else {
return false;
}
}
示例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: CheckFields
function CheckFields($ACTION, &$arFields, $ID = 0)
{
global $DB, $arSocNetAllowedEntityTypes;
$arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures();
$arSocNetLogEvents = CSocNetAllowed::GetAllowedLogEvents();
if ($ACTION != "ADD" && IntVal($ID) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException("System error 870164", "ERROR");
return false;
}
if ((is_set($arFields, "ENTITY_TYPE") || $ACTION == "ADD") && StrLen($arFields["ENTITY_TYPE"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_LE_EMPTY_ENTITY_TYPE"), "EMPTY_ENTITY_TYPE");
return false;
} elseif (is_set($arFields, "ENTITY_TYPE")) {
if (!in_array($arFields["ENTITY_TYPE"], CSocNetAllowed::GetAllowedEntityTypes())) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_LE_ERROR_NO_ENTITY_TYPE"), "ERROR_NO_ENTITY_TYPE");
return false;
}
}
if (is_set($arFields, "ENTITY_ID")) {
$type = "";
if (is_set($arFields, "ENTITY_TYPE")) {
$type = $arFields["ENTITY_TYPE"];
} elseif ($ACTION != "ADD") {
$arRe = CAllSocNetLog::GetByID($ID);
if ($arRe) {
$type = $arRe["ENTITY_TYPE"];
}
}
if (StrLen($type) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_LE_ERROR_CALC_ENTITY_TYPE"), "ERROR_CALC_ENTITY_TYPE");
return false;
}
if ($type == SONET_SUBSCRIBE_ENTITY_GROUP && intval($arFields["ENTITY_ID"]) > 0) {
$arResult = CSocNetGroup::GetByID($arFields["ENTITY_ID"]);
if ($arResult == false) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_LE_ERROR_NO_ENTITY_ID"), "ERROR_NO_ENTITY_ID");
return false;
}
} elseif ($type == SONET_SUBSCRIBE_ENTITY_USER && intval($arFields["ENTITY_ID"]) > 0) {
$dbResult = CUser::GetByID($arFields["ENTITY_ID"]);
if (!$dbResult->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_LE_ERROR_NO_ENTITY_ID"), "ERROR_NO_ENTITY_ID");
return false;
}
}
}
if ((is_set($arFields, "EVENT_ID") || $ACTION == "ADD") && StrLen($arFields["EVENT_ID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_LE_EMPTY_EVENT_ID"), "EMPTY_EVENT_ID");
return false;
} elseif (is_set($arFields, "EVENT_ID")) {
$arFields["EVENT_ID"] = strtolower($arFields["EVENT_ID"]);
if (!array_key_exists($arFields["EVENT_ID"], $arSocNetFeaturesSettings) && $arFields["EVENT_ID"] != "all" && !array_key_exists($arFields["EVENT_ID"], $arSocNetLogEvents)) {
$bFound = false;
foreach ($arSocNetFeaturesSettings as $feature_id => $arFeature) {
if (array_key_exists("subscribe_events", $arFeature) && array_key_exists($arFields["EVENT_ID"], $arFeature["subscribe_events"])) {
$bFound = true;
break;
}
}
if (!$bFound && CSocNetLogTools::FindLogCommentEventByID($arFields["EVENT_ID"])) {
$bFound = true;
}
if (!$bFound) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_LE_ERROR_NO_FEATURE_ID"), "ERROR_NO_FEATURE");
return false;
}
}
}
if (is_set($arFields, "SITE_ID") && $arFields["SITE_ID"] != false) {
$dbResult = CSite::GetByID($arFields["SITE_ID"]);
if (!$dbResult->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["SITE_ID"], GetMessage("SONET_LE_ERROR_NO_SITE")), "ERROR_NO_SITE");
return false;
}
}
if ((is_set($arFields, "MAIL_EVENT") || $ACTION == "ADD") && $arFields["MAIL_EVENT"] != "Y" && $arFields["MAIL_EVENT"] != "N") {
$arFields["MAIL_EVENT"] = "N";
}
if (is_set($arFields, "MAIL_EVENT") && $arFields["MAIL_EVENT"] == "Y") {
$arFields["TRANSPORT"] = "M";
}
return True;
}
示例11: OnAddRatingVote
public static function OnAddRatingVote($id, $arParams)
{
if (CModule::IncludeModule("socialnetwork"))
{
$followValue = CSocNetLogFollow::GetExactValueByRating(
intval($arParams["OWNER_ID"]),
trim($arParams["ENTITY_TYPE_ID"]),
intval($arParams["ENTITY_ID"])
);
if ($followValue === "N")
return false;
}
if ($arParams['ENTITY_TYPE_ID'] == 'LOG_COMMENT')
{
if ($arComment = CSocNetLogComments::GetByID($arParams['ENTITY_ID']))
{
if ($arComment['USER_ID'] == $arParams['USER_ID'])
return false;
$arEventTmp = CSocNetLogTools::FindLogCommentEventByID($arComment["EVENT_ID"]);
if (
$arEventTmp
&& array_key_exists("CLASS_FORMAT", $arEventTmp)
&& array_key_exists("METHOD_FORMAT", $arEventTmp)
)
{
$arFIELDS_FORMATTED = call_user_func(array($arEventTmp["CLASS_FORMAT"], $arEventTmp["METHOD_FORMAT"]), $arComment, array());
$CCTP = new CTextParser();
$CCTP->MaxStringLen = 200;
$CCTP->allow = array("HTML" => "N", "ANCHOR" => "Y", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "Y", "NL2BR" => "Y", "VIDEO" => "N", "TABLE" => "N", "CUT_ANCHOR" => "N", "ALIGN" => "N");
$arComment["MESSAGE"] = $CCTP->convertText($arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"]);
}
$arParams["ENTITY_TITLE"] = strip_tags(str_replace(array("<br>","<br/>","<br />", "#BR#"), Array(" "," ", " ", " "), $arComment["MESSAGE"]));
$arMessageFields = array(
"MESSAGE_TYPE" => IM_MESSAGE_SYSTEM,
"TO_USER_ID" => intval($arComment['USER_ID']),
"FROM_USER_ID" => intval($arParams['USER_ID']),
"NOTIFY_TYPE" => IM_NOTIFY_FROM,
"NOTIFY_MODULE" => "main",
"NOTIFY_EVENT" => "rating_vote",
"NOTIFY_TAG" => "RATING|".($arParams['VALUE'] >= 0?"":"DL|").$arParams['ENTITY_TYPE_ID']."|".$arParams['ENTITY_ID'],
"NOTIFY_MESSAGE" => self::GetMessageRatingVote($arParams),
"NOTIFY_MESSAGE_OUT" => self::GetMessageRatingVote($arParams, true)
);
CIMNotify::Add($arMessageFields);
}
}
else
{
if ($arParams['OWNER_ID'] == $arParams['USER_ID'])
return false;
if (!CModule::IncludeModule("search") || BX_SEARCH_VERSION <= 1)
return false;
$CSI = new CSearchItem;
$res = $CSI->GetList(Array(), Array('=ENTITY_TYPE_ID' => $arParams['ENTITY_TYPE_ID'], '=ENTITY_ID' => $arParams['ENTITY_ID']), Array('URL', 'TITLE', 'BODY', 'PARAM1'));
if ($arItem = $res->GetNext(true, false))
{
$arParams["ENTITY_LINK"] = $arItem['URL'];
$arParams["ENTITY_PARAM"] = $arItem['PARAM1'];
$arParams["ENTITY_TITLE"] = trim(strip_tags(str_replace(array("\r\n","\n","\r"), ' ', htmlspecialcharsback($arItem['TITLE']))));
$arParams["ENTITY_MESSAGE"] = trim(strip_tags(str_replace(array("\r\n","\n","\r"), ' ', htmlspecialcharsback($arItem['BODY']))));
if ((strlen($arParams["ENTITY_TITLE"]) > 0 || strlen($arParams["ENTITY_MESSAGE"]) > 0 ) && strlen($arParams["ENTITY_LINK"]) > 0)
{
if (CModule::IncludeModule("extranet"))
{
$arSites = array();
$extranet_site_id = CExtranet::GetExtranetSiteID();
$intranet_site_id = CSite::GetDefSite();
$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"]))
);
}
$bExtranetUser = false;
if ($arSites[$extranet_site_id])
{
$bExtranetUser = true;
$rsUser = CUser::GetByID(intval($arParams['OWNER_ID']));
if ($arUser = $rsUser->Fetch())
if (intval($arUser["UF_DEPARTMENT"][0]) > 0)
$bExtranetUser = false;
}
if ($bExtranetUser)
{
$link = $arParams['ENTITY_LINK'];
if (substr($link, 0, strlen($arSites[$extranet_site_id]['DIR'])) == $arSites[$extranet_site_id]['DIR'])
$link = substr($link, strlen($arSites[$extranet_site_id]['DIR']));
$SiteServerName = $arSites[$extranet_site_id]['SERVER_NAME'].$arSites[$extranet_site_id]['DIR'].ltrim($link, "/");
//.........这里部分代码省略.........
示例12: __SLEGetLogCommentRecord
function __SLEGetLogCommentRecord($arComments, $arParams, $arCurrentUserSubscribe, $bTooltip = true)
{
// for the same post log_update - time only, if not - date and time
$dateFormated = FormatDate($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATE), MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"]));
$timeFormated = FormatDateFromDB(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"], stripos($arParams["DATE_TIME_FORMAT"], 'a') || ($arParams["DATE_TIME_FORMAT"] == 'FULL' && IsAmPmMode()) !== false ? 'H:MI T' : 'HH:MI');
$dateTimeFormated = FormatDate(!empty($arParams['DATE_TIME_FORMAT']) ? $arParams['DATE_TIME_FORMAT'] == 'FULL' ? $GLOBALS['DB']->DateFormatToPHP(str_replace(':SS', '', FORMAT_DATETIME)) : $arParams['DATE_TIME_FORMAT'] : $GLOBALS['DB']->DateFormatToPHP(FORMAT_DATETIME), MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"]));
if (strcasecmp(LANGUAGE_ID, 'EN') !== 0 && strcasecmp(LANGUAGE_ID, 'DE') !== 0) {
$dateFormated = ToLower($dateFormated);
$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);
}
if ($arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
$path2Entity = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arComments["ENTITY_ID"]));
} else {
$path2Entity = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["ENTITY_ID"]));
}
if (intval($arComments["USER_ID"]) > 0) {
$suffix = is_array($GLOBALS["arExtranetUserID"]) && in_array($arComments["USER_ID"], $GLOBALS["arExtranetUserID"]) ? GetMessage("SONET_LOG_EXTRANET_SUFFIX") : "";
$arTmpUser = array("NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"]);
$bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false;
$arCreatedBy = array("FORMATTED" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arTmpUser, $bUseLogin) . $suffix, "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["USER_ID"], "id" => $arComments["USER_ID"])));
if ($bTooltip) {
$arCreatedBy["TOOLTIP_FIELDS"] = array("ID" => $arComments["USER_ID"], "NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"], "USE_THUMBNAIL_LIST" => "N", "PATH_TO_SONET_MESSAGES_CHAT" => $arParams["PATH_TO_MESSAGES_CHAT"], "PATH_TO_SONET_USER_PROFILE" => $arParams["PATH_TO_USER"], "PATH_TO_VIDEO_CALL" => $arParams["PATH_TO_VIDEO_CALL"], "DATE_TIME_FORMAT" => $arParams["DATE_TIME_FORMAT"], "SHOW_YEAR" => $arParams["SHOW_YEAR"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "NAME_TEMPLATE" => $arParams["NAME_TEMPLATE"] . $suffix, "SHOW_LOGIN" => $arParams["SHOW_LOGIN"], "PATH_TO_CONPANY_DEPARTMENT" => $arParams["PATH_TO_CONPANY_DEPARTMENT"], "INLINE" => "Y");
}
} else {
$arCreatedBy = array("FORMATTED" => GetMessage("SONET_C73_CREATED_BY_ANONYMOUS"));
}
$arTmpUser = array("NAME" => $arComments["~USER_NAME"], "LAST_NAME" => $arComments["~USER_LAST_NAME"], "SECOND_NAME" => $arComments["~USER_SECOND_NAME"], "LOGIN" => $arComments["~USER_LOGIN"]);
$arParamsTmp = $arParams;
$arParamsTmp["AVATAR_SIZE"] = $arParams["AVATAR_SIZE_COMMENT"];
$arTmpCommentEvent = array("EVENT" => $arComments, "LOG_DATE" => $arComments["LOG_DATE"], "LOG_DATE_TS" => MakeTimeStamp($arComments["LOG_DATE"]), "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComments["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "TITLE_TEMPLATE" => "", "TITLE" => "", "TITLE_FORMAT" => "", "ENTITY_NAME" => $arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? $arComments["GROUP_NAME"] : CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin), "ENTITY_PATH" => $path2Entity, "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arComments, $arParamsTmp));
// if (is_array($arCurrentUserSubscribe) && $arParams["USER_COMMENTS"] != "Y")
// $arTmpCommentEvent["TRANSPORT"] = __SLEGetTransport($arComments, $arCurrentUserSubscribe);
$arEvent = CSocNetLogTools::FindLogCommentEventByID($arComments["EVENT_ID"]);
if ($arEvent && array_key_exists("CLASS_FORMAT", $arEvent) && array_key_exists("METHOD_FORMAT", $arEvent)) {
if ($arParams["USER_COMMENTS"] == "Y") {
$arLog = array();
} else {
$arLog = array("TITLE" => $arComments["~LOG_TITLE"], "URL" => $arComments["~LOG_URL"], "PARAMS" => $arComments["~LOG_PARAMS"]);
}
$arFIELDS_FORMATTED = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arComments, $arParams, false, $arLog);
if ($arParams["USE_COMMENTS"] != "Y") {
if (array_key_exists("CREATED_BY", $arFIELDS_FORMATTED) && is_array($arFIELDS_FORMATTED["CREATED_BY"]) && array_key_exists("TOOLTIP_FIELDS", $arFIELDS_FORMATTED["CREATED_BY"])) {
$arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"] = $arFIELDS_FORMATTED["CREATED_BY"]["TOOLTIP_FIELDS"];
}
// $arTmpCommentEvent["ENTITY"] = $arFIELDS_FORMATTED["ENTITY"];
}
}
$message = $arFIELDS_FORMATTED && array_key_exists("EVENT_FORMATTED", $arFIELDS_FORMATTED) && array_key_exists("MESSAGE", $arFIELDS_FORMATTED["EVENT_FORMATTED"]) ? $arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"] : $arTmpCommentEvent["EVENT"]["MESSAGE"];
if (strlen($message) > 0) {
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["FULL_MESSAGE_CUT"] = CSocNetTextParser::closetags(htmlspecialcharsback($message));
}
if (is_array($arTmpCommentEvent)) {
if ($arTmpCommentEvent["LOG_DATE_DAY"] == ConvertTimeStamp()) {
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $timeFormated;
} else {
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $dateTimeFormated;
}
$arTmpCommentEvent["EVENT_FORMATTED"] = $arFIELDS_FORMATTED["EVENT_FORMATTED"];
if (isset($arTmpCommentEvent["EVENT_FORMATTED"]) && is_array($arTmpCommentEvent["EVENT_FORMATTED"])) {
$arFields2Cache = array("DATETIME", "MESSAGE", "FULL_MESSAGE_CUT", "ERROR_MSG");
foreach ($arTmpCommentEvent["EVENT_FORMATTED"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["EVENT_FORMATTED"][$field]);
}
}
}
if (isset($arTmpCommentEvent["EVENT"]) && is_array($arTmpCommentEvent["EVENT"])) {
$arFields2Cache = array("ID", "USER_ID", "LOG_DATE", "RATING_TYPE_ID", "RATING_ENTITY_ID");
foreach ($arTmpCommentEvent["EVENT"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["EVENT"][$field]);
}
}
}
if (isset($arTmpCommentEvent["CREATED_BY"]) && is_array($arTmpCommentEvent["CREATED_BY"])) {
$arFields2Cache = array("TOOLTIP_FIELDS", "FORMATTED", "URL");
foreach ($arTmpCommentEvent["CREATED_BY"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["CREATED_BY"][$field]);
}
}
if (isset($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"]) && is_array($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"])) {
$arFields2Cache = array("ID", "PATH_TO_SONET_USER_PROFILE", "NAME", "LAST_NAME", "SECOND_NAME", "LOGIN", "EMAIL");
foreach ($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"] as $field => $value) {
if (!in_array($field, $arFields2Cache)) {
unset($arTmpCommentEvent["CREATED_BY"]["TOOLTIP_FIELDS"][$field]);
}
}
}
}
}
foreach ($arTmpCommentEvent["EVENT"] as $key => $value) {
if (strpos($key, "~") === 0) {
unset($arTmpCommentEvent["EVENT"][$key]);
//.........这里部分代码省略.........
示例13: __SLMGetLogCommentRecord
function __SLMGetLogCommentRecord($arComments, $arParams, $arCurrentUserSubscribe, $arMyEntities, &$arTmpComments)
{
$arParams["MOBILE"] = "Y";
$arParams["NEW_TEMPLATE"] = "Y";
$dateFormated = FormatDate($GLOBALS['DB']->DateFormatToPHP(FORMAT_DATE), MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["LOG_DATE"]));
$timestamp = MakeTimeStamp(array_key_exists("LOG_DATE_FORMAT", $arComments) ? $arComments["LOG_DATE_FORMAT"] : $arComments["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) {
$dateFormated = ToLower($dateFormated);
$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);
}
$title = "";
if ($arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
$path2Entity = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $arComments["ENTITY_ID"]));
} else {
$path2Entity = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["ENTITY_ID"]));
}
if (intval($arComments["USER_ID"]) > 0) {
$suffix = is_array($GLOBALS["arExtranetUserID"]) && in_array($arComments["USER_ID"], $GLOBALS["arExtranetUserID"]) ? GetMessage("SONET_LOG_EXTRANET_SUFFIX") : "";
$arTmpUser = array("NAME" => $arComments["~CREATED_BY_NAME"], "LAST_NAME" => $arComments["~CREATED_BY_LAST_NAME"], "SECOND_NAME" => $arComments["~CREATED_BY_SECOND_NAME"], "LOGIN" => $arComments["~CREATED_BY_LOGIN"]);
$bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false;
$arCreatedBy = array("FORMATTED" => CUser::FormatName($arParams["NAME_TEMPLATE"], $arTmpUser, $bUseLogin) . $suffix, "URL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arComments["USER_ID"], "id" => $arComments["USER_ID"])));
} else {
$arCreatedBy = array("FORMATTED" => GetMessage("SONET_C73_CREATED_BY_ANONYMOUS"));
}
$arTmpUser = array("NAME" => $arComments["~USER_NAME"], "LAST_NAME" => $arComments["~USER_LAST_NAME"], "SECOND_NAME" => $arComments["~USER_SECOND_NAME"], "LOGIN" => $arComments["~USER_LOGIN"]);
$arParamsTmp = $arParams;
$arParamsTmp["AVATAR_SIZE"] = $arParams["AVATAR_SIZE_COMMENT"];
if (is_array($arComments)) {
unset($arComments["~MESSAGE"]);
unset($arComments["TEXT_MESSAGE"]);
unset($arComments["~TEXT_MESSAGE"]);
}
$arTmpCommentEvent = array("EVENT" => $arComments, "LOG_DATE" => $arComments["LOG_DATE"], "LOG_DATE_TS" => MakeTimeStamp($arComments["LOG_DATE"]), "LOG_DATE_DAY" => ConvertTimeStamp(MakeTimeStamp($arComments["LOG_DATE"]), "SHORT"), "LOG_TIME_FORMAT" => $timeFormated, "TITLE_TEMPLATE" => $title, "TITLE" => $title, "TITLE_FORMAT" => $title, "ENTITY_NAME" => $arComments["ENTITY_TYPE"] == SONET_ENTITY_GROUP ? $arComments["GROUP_NAME"] : CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin), "ENTITY_PATH" => $path2Entity, "CREATED_BY" => $arCreatedBy, "AVATAR_SRC" => CSocNetLogTools::FormatEvent_CreateAvatar($arComments, $arParamsTmp));
$arEvent = CSocNetLogTools::FindLogCommentEventByID($arComments["EVENT_ID"]);
if ($arEvent && array_key_exists("CLASS_FORMAT", $arEvent) && array_key_exists("METHOD_FORMAT", $arEvent)) {
$arFIELDS_FORMATTED = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arComments, $arParams, false, array());
}
$message = $arFIELDS_FORMATTED && array_key_exists("EVENT_FORMATTED", $arFIELDS_FORMATTED) && array_key_exists("MESSAGE", $arFIELDS_FORMATTED["EVENT_FORMATTED"]) ? $arFIELDS_FORMATTED["EVENT_FORMATTED"]["MESSAGE"] : $arTmpCommentEvent["MESSAGE"];
$bToday = $arTmpCommentEvent["LOG_DATE_DAY"] == ConvertTimeStamp();
if ($bToday || intval((time() - $timestamp) / 60 / 60) < 24) {
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $timeFormated;
} else {
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["DATETIME"] = $dateTimeFormated;
}
$arFIELDS_FORMATTED["EVENT_FORMATTED"]["ALLOW_VOTE"] = CRatings::CheckAllowVote(array("ENTITY_TYPE_ID" => $arComments["RATING_TYPE_ID"], "OWNER_ID" => $arComments["USER_ID"]));
$arTmpCommentEvent["EVENT_FORMATTED"] = $arFIELDS_FORMATTED["EVENT_FORMATTED"];
$arTmpComments[] = $arTmpCommentEvent;
}