当前位置: 首页>>代码示例>>PHP>>正文


PHP CSocNetLogRights::CheckForUserOnly方法代码示例

本文整理汇总了PHP中CSocNetLogRights::CheckForUserOnly方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogRights::CheckForUserOnly方法的具体用法?PHP CSocNetLogRights::CheckForUserOnly怎么用?PHP CSocNetLogRights::CheckForUserOnly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSocNetLogRights的用法示例。


在下文中一共展示了CSocNetLogRights::CheckForUserOnly方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: SendEvent


//.........这里部分代码省略.........
					array_key_exists($arSubscriber["TRANSPORT"], $arSentUserID)
					&& in_array($arSubscriber["USER_ID"], $arSentUserID[$arSubscriber["TRANSPORT"]])
				)
					continue;

				if (
					intval($arSubscriber["ENTITY_ID"]) != 0
					&& $arSubscriber["EVENT_ID"] == "all"
					&&
					(
						in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arSubscriber["ENTITY_ID"]."_N_".$arSubscriber["ENTITY_CB"]."_".$arLog["EVENT_ID"], $arUnSubscribers)
						|| in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arSubscriber["ENTITY_ID"]."_Y_".$arSubscriber["ENTITY_CB"]."_".$arLog["EVENT_ID"], $arUnSubscribers)
					)
				)
					continue;
				elseif (
					intval($arSubscriber["ENTITY_ID"]) == 0
					&& $arSubscriber["ENTITY_CB"] == "N"
					&& $arSubscriber["EVENT_ID"] != "all"
					&&
					(
						in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arLog["ENTITY_ID"]."_Y_N_all", $arUnSubscribers)
						|| in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arLog["ENTITY_ID"]."_N_N_all", $arUnSubscribers)
						|| in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arLog["ENTITY_ID"]."_Y_N_".$arLog["EVENT_ID"], $arUnSubscribers)
						|| in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arLog["ENTITY_ID"]."_N_N_".$arLog["EVENT_ID"], $arUnSubscribers)
					)
				)
					continue;

				$arSentUserID[$arSubscriber["TRANSPORT"]][] = $arSubscriber["USER_ID"];

				if (!$bHasAccessAll)
				{
					$bHasAccess = CSocNetLogRights::CheckForUserOnly($arLog["ID"], $arSubscriber["USER_ID"]);
					if (!$bHasAccess)
						continue;
				}

				if (CModule::IncludeModule("extranet"))
				{
					$server_name = $arSites[((!in_array($arSubscriber["USER_ID"], $arIntranetUsers) && $extranet_site_id) ? $extranet_site_id : $intranet_site_id)]["SERVER_NAME"];
					$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"] = str_replace(
						array("#SERVER_NAME#", "#GROUPS_PATH#"),
						array(
							$server_name,
							COption::GetOptionString("socialnetwork", "workgroups_page", false, ((!in_array($arSubscriber["USER_ID"], $arIntranetUsers) && $extranet_site_id) ? $extranet_site_id : $intranet_site_id))
						),
						$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"]
					);
					$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE_TO_SEND"] = str_replace(
						array("#SERVER_NAME#", "#GROUPS_PATH#"),
						array(
							$server_name,
							COption::GetOptionString("socialnetwork", "workgroups_page", false, ((!in_array($arSubscriber["USER_ID"], $arIntranetUsers) && $extranet_site_id) ? $extranet_site_id : $intranet_site_id))
						),
						$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"]
					);
				}
				else
					$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE_TO_SEND"] = $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"];

				switch ($arSubscriber["TRANSPORT"])
				{
					case "X":

						if (
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:67,代码来源:log.php

示例2: SendMentionNotification

 public static function SendMentionNotification($arCommentFields)
 {
     if (!CModule::IncludeModule("im")) {
         return false;
     }
     switch ($arCommentFields["EVENT_ID"]) {
         case "forum":
             $arTitleRes = self::OnSendMentionGetEntityFields_Forum($arCommentFields);
             break;
         default:
             $db_events = GetModuleEvents("socialnetwork", "OnSendMentionGetEntityFields");
             while ($arEvent = $db_events->Fetch()) {
                 $arTitleRes = ExecuteModuleEventEx($arEvent, array($arCommentFields));
                 if ($arTitleRes) {
                     break;
                 }
             }
     }
     if ($arTitleRes && is_array($arTitleRes) && !empty($arTitleRes["NOTIFY_MESSAGE"])) {
         $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "FROM_USER_ID" => $arCommentFields["USER_ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => !empty($arTitleRes["NOTIFY_MODULE"]) ? $arTitleRes["NOTIFY_MODULE"] : "socialnetwork", "NOTIFY_EVENT" => "mention", "NOTIFY_TAG" => !empty($arTitleRes["NOTIFY_TAG"]) ? $arTitleRes["NOTIFY_TAG"] : "LOG_COMMENT|COMMENT_MENTION|" . $arCommentFields["ID"]);
         preg_match_all("/\\[user\\s*=\\s*([^\\]]*)\\](.+?)\\[\\/user\\]/ies" . BX_UTF_PCRE_MODIFIER, $arCommentFields["MESSAGE"], $arMention);
         if (!empty($arMention)) {
             $arMention = $arMention[1];
             $arExcludeUsers = array();
             if (!empty($arCommentFields["LOG_ID"])) {
                 $rsUnFollower = CSocNetLogFollow::GetList(array("CODE" => "L" . $arCommentFields["LOG_ID"], "TYPE" => "N"), array("USER_ID"));
                 while ($arUnFollower = $rsUnFollower->Fetch()) {
                     $arExcludeUsers[] = $arUnFollower["USER_ID"];
                 }
             }
             $arSourceURL = array("URL" => $arTitleRes["URL"]);
             if (!empty($arTitleRes["CRM_URL"])) {
                 $arSourceURL["CRM_URL"] = $arTitleRes["CRM_URL"];
             }
             foreach ($arMention as $mentionUserID) {
                 $bHaveRights = CSocNetLogRights::CheckForUserOnly($arCommentFields["LOG_ID"], $mentionUserID);
                 if (!$bHaveRights && $arTitleRes["IS_CRM"] == "Y") {
                     $dbLog = CSocNetLog::GetList(array(), array("ID" => $arCommentFields["LOG_ID"], "ENTITY_TYPE" => $arCommentFields["ENTITY_TYPE"]), false, false, array("ID"), array("IS_CRM" => "Y", "CHECK_CRM_RIGHTS" => "Y", "USER_ID" => $mentionUserID, "USE_SUBSCRIBE" => "N"));
                     if ($arLog = $dbLog->Fetch()) {
                         $bHaveCrmRights = true;
                     }
                 }
                 if (in_array($mentionUserID, $arExcludeUsers) || !$bHaveRights && !$bHaveCrmRights) {
                     continue;
                 }
                 $url = false;
                 if (!empty($arSourceURL["URL"]) || !empty($arSourceURL["CRM_URL"])) {
                     $arTmp = CSocNetLogTools::ProcessPath($arSourceURL, $mentionUserID);
                     if ($arTitleRes["IS_CRM"] == "Y" && !$bHaveRights && !empty($arTmp["URLS"]["CRM_URL"])) {
                         $url = $arTmp["URLS"]["CRM_URL"];
                     } else {
                         $url = $arTmp["URLS"]["URL"];
                     }
                     $serverName = strpos($url, "http://") === 0 || strpos($url, "https://") === 0 ? "" : $arTmp["SERVER_NAME"];
                 }
                 $arMessageFields["TO_USER_ID"] = $mentionUserID;
                 $arMessageFields["NOTIFY_MESSAGE"] = str_replace(array("#url#", "#server_name#"), array($url, $serverName), $arTitleRes["NOTIFY_MESSAGE"]);
                 $arMessageFields["NOTIFY_MESSAGE_OUT"] = !empty($arTitleRes["NOTIFY_MESSAGE_OUT"]) ? str_replace(array("#url#", "#server_name#"), array($url, $serverName), $arTitleRes["NOTIFY_MESSAGE_OUT"]) : "";
                 CIMNotify::Add($arMessageFields);
             }
             $arMentionedDestCode = array();
             foreach ($arMention as $val) {
                 $arMentionedDestCode[] = "U" . $val;
             }
             \Bitrix\Main\FinderDestTable::merge(array("CONTEXT" => "mention", "CODE" => array_unique($arMentionedDestCode)));
         }
     }
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:68,代码来源:log_comments.php

示例3: SendEvent

 function SendEvent($ID, $mailTemplate = "SONET_NEW_EVENT")
 {
     $ID = IntVal($ID);
     if ($ID <= 0) {
         return false;
     }
     $arFilter = array("ID" => $ID);
     $dbLogComments = CSocNetLogComments::GetList(array(), $arFilter, false, false, array("ID", "LOG_ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "EVENT_ID", "LOG_DATE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "GROUP_NAME", "CREATED_BY_NAME", "CREATED_BY_SECOND_NAME", "CREATED_BY_LAST_NAME", "CREATED_BY_LOGIN", "LOG_SITE_ID", "SOURCE_ID", "LOG_SOURCE_ID"));
     $arLogComment = $dbLogComments->Fetch();
     if (!$arLogComment) {
         return false;
     }
     $arLog = array();
     if (intval($arLogComment["LOG_ID"]) > 0) {
         $dbLog = CSocNetLog::GetList(array(), array("ID" => $arLogComment["LOG_ID"]));
         $arLog = $dbLog->Fetch();
         if (!$arLog) {
             $arLog = array();
         }
     }
     $arEvent = CSocNetLogTools::FindLogCommentEventByID($arLogComment["EVENT_ID"]);
     if ($arEvent && array_key_exists("CLASS_FORMAT", $arEvent) && array_key_exists("METHOD_FORMAT", $arEvent) && strlen($arEvent["CLASS_FORMAT"]) > 0 && strlen($arEvent["METHOD_FORMAT"]) > 0) {
         $dbSiteCurrent = CSite::GetByID(SITE_ID);
         if ($arSiteCurrent = $dbSiteCurrent->Fetch()) {
             if ($arSiteCurrent["LANGUAGE_ID"] != LANGUAGE_ID) {
                 $arLogComment["MAIL_LANGUAGE_ID"] = $arSiteCurrent["LANGUAGE_ID"];
             }
         }
         $arLogComment["FIELDS_FORMATTED"] = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arLogComment, array(), true, $arLog);
     }
     if (array_key_exists($arLogComment["ENTITY_TYPE"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"]) && array_key_exists("HAS_MY", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]) && $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["HAS_MY"] == "Y" && array_key_exists("CLASS_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]) && array_key_exists("METHOD_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]) && strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["CLASS_OF"]) > 0 && strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["METHOD_OF"]) > 0 && method_exists($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["METHOD_OF"])) {
         $arOfEntities = call_user_func(array($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLogComment["ENTITY_TYPE"]]["METHOD_OF"]), $arLogComment["ENTITY_ID"]);
     }
     $arListParams = array("USE_SUBSCRIBE" => "Y", "ENTITY_TYPE" => $arLogComment["ENTITY_TYPE"], "ENTITY_ID" => $arLogComment["ENTITY_ID"], "EVENT_ID" => $arLogComment["EVENT_ID"], "USER_ID" => $arLogComment["USER_ID"], "OF_ENTITIES" => $arOfEntities, "TRANSPORT" => array("M", "X"));
     $arLogSites = array();
     $rsLogSite = CSocNetLog::GetSite($arLog["ID"]);
     while ($arLogSite = $rsLogSite->Fetch()) {
         $arLogSites[] = $arLogSite["LID"];
     }
     if (CModule::IncludeModule("extranet")) {
         if ($arLogComment["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
             $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"]));
             }
             $intranet_site_id = CSite::GetDefSite();
         }
         $arIntranetUsers = CExtranet::GetIntranetUsers();
         $extranet_site_id = CExtranet::GetExtranetSiteID();
     }
     $dbSubscribers = CSocNetLogEvents::GetList(array("TRANSPORT" => "DESC"), array("USER_ACTIVE" => "Y", "SITE_ID" => array_merge($arLogSites, array(false))), false, false, array("USER_ID", "ENTITY_TYPE", "ENTITY_ID", "ENTITY_CB", "ENTITY_MY", "USER_NAME", "USER_LAST_NAME", "USER_LOGIN", "USER_LID", "USER_EMAIL", "TRANSPORT"), $arListParams);
     $arListParams = array("USE_SUBSCRIBE" => "Y", "ENTITY_TYPE" => $arLogComment["ENTITY_TYPE"], "ENTITY_ID" => $arLogComment["ENTITY_ID"], "EVENT_ID" => $arLogComment["EVENT_ID"], "USER_ID" => $arLogComment["USER_ID"], "OF_ENTITIES" => $arOfEntities, "TRANSPORT" => "N");
     $dbUnSubscribers = CSocNetLogEvents::GetList(array("TRANSPORT" => "DESC"), array("USER_ACTIVE" => "Y", "SITE_ID" => array_merge($arLogSites, array(false))), false, false, array("USER_ID", "SITE_ID", "ENTITY_TYPE", "ENTITY_ID", "ENTITY_CB", "ENTITY_MY", "TRANSPORT", "EVENT_ID"), $arListParams);
     $arUnSubscribers = array();
     while ($arUnSubscriber = $dbUnSubscribers->Fetch()) {
         $arUnSubscribers[] = $arUnSubscriber["USER_ID"] . "_" . $arUnSubscriber["ENTITY_TYPE"] . "_" . $arUnSubscriber["ENTITY_ID"] . "_" . $arUnSubscriber["ENTITY_MY"] . "_" . $arUnSubscriber["ENTITY_CB"] . "_" . $arUnSubscriber["EVENT_ID"];
     }
     $bHasAccessAll = CSocNetLogRights::CheckForUserAll($arLog["ID"] ? $arLog["ID"] : $arLogComment["LOG_ID"]);
     $arSentUserID = array("M" => array(), "X" => array());
     while ($arSubscriber = $dbSubscribers->Fetch()) {
         if (is_array($arIntranetUsers) && !in_array($arSubscriber["USER_ID"], $arIntranetUsers) && !in_array($extranet_site_id, $arLogSites)) {
             continue;
         }
         if (array_key_exists($arSubscriber["TRANSPORT"], $arSentUserID) && in_array($arSubscriber["USER_ID"], $arSentUserID[$arSubscriber["TRANSPORT"]])) {
             continue;
         }
         if (intval($arSubscriber["ENTITY_ID"]) != 0 && $arSubscriber["EVENT_ID"] == "all" && (in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arSubscriber["ENTITY_ID"] . "_N_" . $arSubscriber["ENTITY_CB"] . "_" . $arLogComment["EVENT_ID"], $arUnSubscribers) || in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arSubscriber["ENTITY_ID"] . "_Y_" . $arSubscriber["ENTITY_CB"] . "_" . $arLogComment["EVENT_ID"], $arUnSubscribers))) {
             continue;
         } elseif (intval($arSubscriber["ENTITY_ID"]) == 0 && $arSubscriber["ENTITY_CB"] == "N" && $arSubscriber["EVENT_ID"] != "all" && (in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arLogComment["ENTITY_ID"] . "_Y_N_all", $arUnSubscribers) || in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arLogComment["ENTITY_ID"] . "_N_N_all", $arUnSubscribers) || in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arLogComment["ENTITY_ID"] . "_Y_N_" . $arLogComment["EVENT_ID"], $arUnSubscribers) || in_array($arSubscriber["USER_ID"] . "_" . $arSubscriber["ENTITY_TYPE"] . "_" . $arLogComment["ENTITY_ID"] . "_N_N_" . $arLogComment["EVENT_ID"], $arUnSubscribers))) {
             continue;
         }
         $arSentUserID[$arSubscriber["TRANSPORT"]][] = $arSubscriber["USER_ID"];
         if (!$bHasAccessAll) {
             $bHasAccess = CSocNetLogRights::CheckForUserOnly($arLog["ID"] ? $arLog["ID"] : $arLogComment["LOG_ID"], $arSubscriber["USER_ID"]);
             if (!$bHasAccess) {
                 continue;
             }
         }
         if ($arLogComment["ENTITY_TYPE"] == SONET_ENTITY_GROUP && is_array($arIntranetUsers) && CModule::IncludeModule("extranet")) {
             $server_name = $arSites[!in_array($arSubscriber["USER_ID"], $arIntranetUsers) && $extranet_site_id ? $extranet_site_id : $intranet_site_id]["SERVER_NAME"];
             $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"] = str_replace(array("#SERVER_NAME#", "#GROUPS_PATH#"), array($server_name, COption::GetOptionString("socialnetwork", "workgroups_page", false, !in_array($arSubscriber["USER_ID"], $arIntranetUsers) && $extranet_site_id ? $extranet_site_id : $intranet_site_id)), $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"]);
         } else {
             $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"] = $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"];
         }
         switch ($arSubscriber["TRANSPORT"]) {
             case "X":
                 if (array_key_exists("URL_TO_SEND", $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]) && strlen($arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"]) > 0) {
                     $link = GetMessage("SONET_GLC_SEND_EVENT_LINK") . $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"];
                 } else {
                     $link = "";
                 }
                 $arMessageFields = array("FROM_USER_ID" => intval($arLogComment["USER_ID"]) > 0 ? $arLogComment["USER_ID"] : 1, "TO_USER_ID" => $arSubscriber["USER_ID"], "MESSAGE" => $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["TITLE"] . " #BR# " . $arLogComment["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"] . (strlen($link) > 0 ? "#BR# " . $link : ""), "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM, "IS_LOG" => "Y");
                 CSocNetMessages::Add($arMessageFields);
                 break;
             case "M":
                 $arFields["SUBSCRIBER_ID"] = $arSubscriber["USER_ID"];
                 $arFields["SUBSCRIBER_NAME"] = $arSubscriber["USER_NAME"];
                 $arFields["SUBSCRIBER_LAST_NAME"] = $arSubscriber["USER_LAST_NAME"];
                 $arFields["SUBSCRIBER_LOGIN"] = $arSubscriber["USER_LOGIN"];
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:log_comments.php

示例4: 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, '&quot;\\1&quot;', $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");
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:im_event.php


注:本文中的CSocNetLogRights::CheckForUserOnly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。