本文整理汇总了PHP中CSocNetLogTools::ProcessPath方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogTools::ProcessPath方法的具体用法?PHP CSocNetLogTools::ProcessPath怎么用?PHP CSocNetLogTools::ProcessPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetLogTools
的用法示例。
在下文中一共展示了CSocNetLogTools::ProcessPath方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$id = "";
$isExtranet = false;
if ($type == "SG") {
if ($arSocNetGroup = CSocNetGroup::GetByID($vv["ENTITY_ID"])) {
$name = $arSocNetGroup["NAME"];
$link = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_GROUP"], array("group_id" => $vv["ENTITY_ID"]));
$groupSiteID = false;
$rsGroupSite = CSocNetGroup::GetSite($vv["ENTITY_ID"]);
while ($arGroupSite = $rsGroupSite->Fetch()) {
if (!$arResult["bExtranetInstalled"] || $arGroupSite["LID"] != CExtranet::GetExtranetSiteID()) {
$groupSiteID = $arGroupSite["LID"];
break;
}
}
if ($groupSiteID) {
$arTmp = CSocNetLogTools::ProcessPath(array("GROUP_URL" => $link), $user_id, $groupSiteID);
// user_id is not important parameter
$link = strlen($arTmp["URLS"]["GROUP_URL"]) > 0 ? $arTmp["SERVER_NAME"] . $arTmp["URLS"]["GROUP_URL"] : $link;
}
$isExtranet = is_array($GLOBALS["arExtranetGroupID"]) && in_array($vv["ENTITY_ID"], $GLOBALS["arExtranetGroupID"]);
}
} elseif ($type == "U") {
if (in_array("US" . $vv["ENTITY_ID"], $vv["ENTITY"])) {
$name = "All";
if (!$arResult["bExtranetSite"] && defined("BITRIX24_PATH_COMPANY_STRUCTURE_VISUAL")) {
$link = BITRIX24_PATH_COMPANY_STRUCTURE_VISUAL;
}
$bAll = true;
} else {
$arTmpUser = array("NAME" => $vv["~U_NAME"], "LAST_NAME" => $vv["~U_LAST_NAME"], "SECOND_NAME" => $vv["~U_SECOND_NAME"], "LOGIN" => $vv["~U_LOGIN"], "NAME_LIST_FORMATTED" => "");
$name = CUser::FormatName($arParams["NAME_TEMPLATE"], $arTmpUser, $arParams["SHOW_LOGIN"] != "N" ? true : false);
示例2: NotifyGroup
public static function NotifyGroup($arFields)
{
if (!CModule::IncludeModule("im")) {
return;
}
if (!is_array($arFields["GROUP_ID"])) {
$arFields["GROUP_ID"] = array($arFields["GROUP_ID"]);
}
if (empty($arFields["GROUP_ID"])) {
return;
}
if (empty($arFields["EXCLUDE_USERS"])) {
$arFields["EXCLUDE_USERS"] = array();
}
if (intval($arFields["LOG_ID"]) > 0) {
$rsUnFollower = CSocNetLogFollow::GetList(array("CODE" => "L" . intval($arFields["LOG_ID"]), "TYPE" => "N"), array("USER_ID"));
while ($arUnFollower = $rsUnFollower->Fetch()) {
$arFields["EXCLUDE_USERS"][] = $arUnFollower["USER_ID"];
}
$arFields["EXCLUDE_USERS"] = array_unique($arFields["EXCLUDE_USERS"]);
}
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "socialnetwork", "NOTIFY_EVENT" => "sonet_group_event", "NOTIFY_TAG" => "SONET|EVENT|" . (intval($arFields["LOG_ID"]) > 0 ? $arFields["LOG_ID"] : rand()));
if (intval($arFields["FROM_USER_ID"]) > 0) {
$arMessageFields["FROM_USER_ID"] = $arFields["FROM_USER_ID"];
}
$arUserToSend = array();
$arUserIDToSend = array();
$arGroupID = array();
$arCodes = array();
foreach ($arFields["GROUP_ID"] as $group_id) {
$arCodes[] = "SG" . $group_id;
}
$rsSubscriber = CSocNetSubscription::GetList(array(), array("CODE" => $arCodes), false, false, array("USER_ID", "CODE"));
while ($arSubscriber = $rsSubscriber->Fetch()) {
if (!in_array($arSubscriber["USER_ID"], $arFields["EXCLUDE_USERS"]) && !in_array($arSubscriber["USER_ID"], $arUserIDToSend)) {
if (preg_match('/^SG(\\d+)$/', $arSubscriber["CODE"], $matches)) {
$arUserToSend[] = array("USER_ID" => $arSubscriber["USER_ID"], "GROUP_ID" => $matches[1]);
$arUserIDToSend[] = $arSubscriber["USER_ID"];
$arGroupID[] = $matches[1];
}
}
}
$rsGroup = CSocNetGroup::GetList(array(), array("ID" => $arGroupID), false, false, array("ID", "NAME", "OWNER_ID"));
while ($arGroup = $rsGroup->GetNext()) {
$arGroups[$arGroup["ID"]] = $arGroup;
}
$workgroupsPage = COption::GetOptionString("socialnetwork", "workgroups_page", "/workgroups/", SITE_ID);
$groupUrlTemplate = COption::GetOptionString("socialnetwork", "group_path_template", "/workgroups/group/#group_id#/", SITE_ID);
$groupUrlTemplate = "#GROUPS_PATH#" . substr($groupUrlTemplate, strlen($workgroupsPage), strlen($groupUrlTemplate) - strlen($workgroupsPage));
foreach ($arUserToSend as $arUser) {
$arMessageFields["TO_USER_ID"] = $arUser["USER_ID"];
$arTmp = CSocNetLogTools::ProcessPath(array("URL" => $arFields["URL"], "GROUP_URL" => str_replace(array("#group_id#", "#GROUP_ID#"), $arUser["GROUP_ID"], $groupUrlTemplate)), $arUser["USER_ID"]);
$url = $arTmp["URLS"]["URL"];
if (strpos($url, "http://") === 0 || strpos($url, "https://") === 0) {
$serverName = "";
} else {
$serverName = $arTmp["SERVER_NAME"];
}
$groupUrl = $serverName . $arTmp["URLS"]["GROUP_URL"];
$group_name = array_key_exists($arUser["GROUP_ID"], $arGroups) ? $arGroups[$arUser["GROUP_ID"]]["NAME"] : "";
$arMessageFields["NOTIFY_MESSAGE"] = str_replace(array("#URL#", "#url#", "#group_name#", "#GROUP_ID#", "#group_id#"), array($url, $url, "<a href=\"" . $groupUrl . "\" class=\"bx-notifier-item-action\">" . $group_name . "</a>", $arUser["GROUP_ID"], $arUser["GROUP_ID"]), $arFields["MESSAGE"]);
$arMessageFields["NOTIFY_MESSAGE_OUT"] = str_replace(array("#URL#", "#url#", "#group_name#"), array($serverName . $url, $serverName . $url, $group_name), $arFields["MESSAGE_OUT"]);
$arMessageFields2Send = $arMessageFields;
if (!is_set($arMessageFields2Send["FROM_USER_ID"]) || intval($arMessageFields2Send["FROM_USER_ID"]) <= 0) {
$arMessageFields2Send["NOTIFY_TYPE"] = IM_NOTIFY_SYSTEM;
$arMessageFields2Send["FROM_USER_ID"] = 0;
}
CIMNotify::Add($arMessageFields2Send);
}
}
示例3: NotifyImToModerators
function NotifyImToModerators($arNotifyParams)
{
if (!CModule::IncludeModule("im")) {
return;
}
if (!is_array($arNotifyParams) || !array_key_exists("TYPE", $arNotifyParams) || !in_array($arNotifyParams["TYPE"], array("join", "unjoin", "exclude", "moderate", "unmoderate", "owner")) || !array_key_exists("USER_ID", $arNotifyParams) || intval($arNotifyParams["USER_ID"]) <= 0 || !array_key_exists("GROUP_ID", $arNotifyParams) || intval($arNotifyParams["GROUP_ID"]) <= 0 || !array_key_exists("RELATION_ID", $arNotifyParams) || intval($arNotifyParams["RELATION_ID"]) <= 0 || !array_key_exists("GROUP_NAME", $arNotifyParams) || strlen($arNotifyParams["GROUP_NAME"]) <= 0) {
return;
}
switch ($arNotifyParams["TYPE"]) {
case "join":
$from_user_id = $arNotifyParams["USER_ID"];
$message_code = "SONET_UG_IM_JOIN";
$schema_code = "inout_group";
$notify_tag = "INOUT_GROUP";
break;
case "unjoin":
$from_user_id = $arNotifyParams["USER_ID"];
$message_code = "SONET_UG_IM_UNJOIN";
$schema_code = "inout_group";
$notify_tag = "INOUT_GROUP";
break;
case "exclude":
$from_user_id = $arNotifyParams["USER_ID"];
$message_code = "SONET_UG_IM_EXCLUDE";
$schema_code = "inout_group";
$notify_tag = "INOUT_GROUP";
break;
case "moderate":
$from_user_id = $arNotifyParams["USER_ID"];
$message_code = "SONET_UG_IM_MODERATE";
$schema_code = "moderators_group";
$notify_tag = "MOD_GROUP";
break;
case "unmoderate":
$from_user_id = $arNotifyParams["USER_ID"];
$message_code = "SONET_UG_IM_UNMODERATE";
$schema_code = "moderators_group";
$notify_tag = "MOD_GROUP";
break;
case "owner":
$from_user_id = $arNotifyParams["USER_ID"];
$message_code = "SONET_UG_IM_OWNER";
$schema_code = "owner_group";
$notify_tag = "OWNER_GROUP";
break;
default:
}
$rsUser = CUser::GetByID($arNotifyParams["USER_ID"]);
if ($arUser = $rsUser->Fetch()) {
switch ($arUser["PERSONAL_GENDER"]) {
case "M":
$gender_suffix = "_M";
break;
case "F":
$gender_suffix = "_F";
break;
default:
$gender_suffix = "";
}
}
$arToUserID = array();
$rsUserToGroup = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $arNotifyParams["GROUP_ID"], "USER_ACTIVE" => "Y", "<=ROLE" => SONET_ROLES_MODERATOR), false, false, array("USER_ID"));
while ($arUserToGroup = $rsUserToGroup->Fetch()) {
$arToUserID[] = $arUserToGroup["USER_ID"];
}
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "FROM_USER_ID" => $from_user_id, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "socialnetwork", "NOTIFY_EVENT" => $schema_code, "LOG_ID" => $arEntry["LOG_ID"], "NOTIFY_TAG" => "SOCNET|" . $notify_tag . "|" . intval($arNotifyParams["USER_ID"]) . "|" . intval($arNotifyParams["GROUP_ID"]) . "|" . intval($arNotifyParams["RELATION_ID"]));
$groups_path = COption::GetOptionString("socialnetwork", "workgroups_page", SITE_DIR . "workgroups/");
$group_url_template = str_replace($groups_path, "#GROUPS_PATH#", COption::GetOptionString("socialnetwork", "group_path_template", SITE_DIR . "workgroups/group/#group_id#/"));
$groupUrl = str_replace("#group_id#", $arNotifyParams["GROUP_ID"], $group_url_template);
foreach ($arToUserID as $to_user_id) {
if (is_array($arNotifyParams["EXCLUDE_USERS"]) && in_array($to_user_id, $arNotifyParams["EXCLUDE_USERS"]) || $to_user_id == $from_user_id) {
continue;
}
$arMessageFields["TO_USER_ID"] = $to_user_id;
$arTmp = CSocNetLogTools::ProcessPath(array("GROUP_PAGE" => $groupUrl), $to_user_id, SITE_ID);
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage($message_code . $gender_suffix, array("#group_name#" => "<a href=\"" . $arTmp["URLS"]["GROUP_PAGE"] . "\" class=\"bx-notifier-item-action\">" . $arNotifyParams["GROUP_NAME"] . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage($message_code . $gender_suffix, array("#group_name#" => $arNotifyParams["GROUP_NAME"])) . " (" . $arTmp["SERVER_NAME"] . $arTmp["URLS"]["GROUP_PAGE"] . ")";
CIMNotify::Add($arMessageFields);
}
}
示例4: AddCommentToIM
public static function AddCommentToIM($arFields)
{
if (CModule::IncludeModule("im") && intval($arFields["USER_ID"]) > 0) {
$date_text = "";
$dbReport = CTimeManReportFull::GetByID($arFields["REPORT_ID"]);
if ($arReport = $dbReport->Fetch()) {
$date_from = FormatDate("j F", MakeTimeStamp($arReport["DATE_FROM"], CSite::GetDateFormat("FULL", SITE_ID)));
$date_to = FormatDate("j F", MakeTimeStamp($arReport["DATE_TO"], CSite::GetDateFormat("FULL", SITE_ID)));
if ($date_from == $date_to) {
$date_text = $date_to;
} else {
$date_text = $date_from . " - " . $date_to;
}
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "FROM_USER_ID" => $arFields["USER_ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "timeman", "NOTIFY_EVENT" => "report_comment", "NOTIFY_TAG" => "TIMEMAN|REPORT|" . $arFields["REPORT_ID"]);
$arUserIDToSend = array($arReport["USER_ID"]);
$gender_suffix = "";
$dbUser = CUser::GetByID($arFields["USER_ID"]);
if ($arUser = $dbUser->Fetch()) {
switch ($arUser["PERSONAL_GENDER"]) {
case "M":
$gender_suffix = "_M";
break;
case "F":
$gender_suffix = "_F";
break;
default:
$gender_suffix = "";
}
}
$arManagers = CTimeMan::GetUserManagers($arReport["USER_ID"]);
if (is_array($arManagers)) {
$arUserIDToSend = array_merge($arUserIDToSend, $arManagers);
}
$reports_page = COption::GetOptionString("timeman", "WORK_REPORT_PATH", "/company/work_report.php");
$arUnFollowers = array();
$rsUnFollower = CSocNetLogFollow::GetList(array("USER_ID" => $arUserIDToSend, "CODE" => "L" . $arFields["LOG_ID"], "TYPE" => "N"), array("USER_ID"));
while ($arUnFollower = $rsUnFollower->Fetch()) {
$arUnFollowers[] = $arUnFollower["USER_ID"];
}
$arUserIDToSend = array_diff($arUserIDToSend, $arUnFollowers);
foreach ($arUserIDToSend as $user_id) {
if ($arFields["USER_ID"] == $user_id) {
continue;
}
$arMessageFields["TO_USER_ID"] = $user_id;
$arTmp = CSocNetLogTools::ProcessPath(array("REPORTS_PAGE" => $reports_page), $user_id);
$sender_type = $arReport["USER_ID"] == $user_id ? "1" : ($arReport["USER_ID"] == $arFields["USER_ID"] ? "2" : "3");
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("REPORT_FULL_IM_COMMENT_" . $sender_type . $gender_suffix, array("#period#" => "<a href=\"" . $arTmp["URLS"]["REPORTS_PAGE"] . "#user_id=" . $arReport["USER_ID"] . "&report=" . $arReport["ID"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($date_text) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("REPORT_FULL_IM_COMMENT_" . $sender_type . $gender_suffix, array("#period#" => htmlspecialcharsbx($date_text))) . " ( " . $arTmp["SERVER_NAME"] . $arTmp["URLS"]["REPORTS_PAGE"] . "#user_id=" . $arReport["USER_ID"] . "&report=" . $arReport["ID"] . " )#BR##BR#" . $arFields["MESSAGE"];
CIMNotify::Add($arMessageFields);
}
}
}
}
示例5: NotifyIm
public static function NotifyIm($arParams)
{
if (!CModule::IncludeModule("im")) {
return;
}
$arUsers = array();
$arUserIDSent = array();
if (!empty($arParams["TO_USER_ID"])) {
foreach ($arParams["TO_USER_ID"] as $val) {
$val = IntVal($val);
if ($val > 0 && $val != $arParams["FROM_USER_ID"]) {
$arUsers[] = $val;
}
}
}
if (!empty($arParams["TO_SOCNET_RIGHTS"])) {
foreach ($arParams["TO_SOCNET_RIGHTS"] as $v) {
if (substr($v, 0, 1) == "U") {
$u = IntVal(substr($v, 1));
if ($u > 0 && !in_array($u, $arUsers) && (!array_key_exists("U", $arParams["TO_SOCNET_RIGHTS_OLD"]) || empty($arParams["TO_SOCNET_RIGHTS_OLD"]["U"][$u])) && $u != $arParams["FROM_USER_ID"]) {
$arUsers[] = $u;
}
}
}
}
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => "", "FROM_USER_ID" => $arParams["FROM_USER_ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "blog");
$aditGM = "";
if (IntVal($arParams["FROM_USER_ID"]) > 0) {
$dbUser = CUser::GetByID($arParams["FROM_USER_ID"]);
if ($arUser = $dbUser->Fetch()) {
if ($arUser["PERSONAL_GENDER"] == "F") {
$aditGM = "_FEMALE";
}
}
}
if (CModule::IncludeModule("socialnetwork")) {
$rsLog = CSocNetLog::GetList(array(), array("EVENT_ID" => array("blog_post", "blog_post_important", "blog_post_micro"), "SOURCE_ID" => $arParams["ID"]), false, false, array("ID"));
if ($arLog = $rsLog->Fetch()) {
$arMessageFields["LOG_ID"] = $arLog["ID"];
}
}
$arParams["TITLE"] = str_replace(array("\r\n", "\n"), " ", $arParams["TITLE"]);
$arParams["TITLE"] = TruncateText($arParams["TITLE"], 100);
$arParams["TITLE_OUT"] = TruncateText($arParams["TITLE"], 255);
$serverName = (CMain::IsHTTPS() ? "https" : "http") . "://" . (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", ""));
if (IsModuleInstalled("extranet")) {
$user_path = COption::GetOptionString("socialnetwork", "user_page", false, SITE_ID);
if (strpos($arParams["URL"], $user_path) === 0) {
$arParams["URL"] = str_replace($user_path, "#USER_PATH#", $arParams["URL"]);
}
}
if ($arParams["TYPE"] == "POST") {
$arMessageFields["NOTIFY_EVENT"] = "post";
$arMessageFields["NOTIFY_TAG"] = "BLOG|POST|" . $arParams["ID"];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_1" . $aditGM, array("#title#" => "<a href=\"" . $arParams["URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_1" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $arParams["URL"] . "";
} elseif ($arParams["TYPE"] == "COMMENT") {
$arMessageFields["NOTIFY_EVENT"] = "comment";
$arMessageFields["NOTIFY_TAG"] = "BLOG|COMMENT|" . $arParams["ID"];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_4" . $aditGM, array("#title#" => "<a href=\"" . $arParams["URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_4" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $arParams["URL"] . "\n\n" . $arParams["BODY"];
$arMessageFields["NOTIFY_MESSAGE_AUTHOR"] = GetMessage("BLG_GP_IM_5" . $aditGM, array("#title#" => "<a href=\"" . $arParams["URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_AUTHOR_OUT"] = GetMessage("BLG_GP_IM_5" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $arParams["URL"] . "\n\n" . $arParams["BODY"];
} elseif ($arParams["TYPE"] == "SHARE") {
$arMessageFields["NOTIFY_EVENT"] = "share";
$arMessageFields["NOTIFY_TAG"] = "BLOG|SHARE|" . $arParams["ID"];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_8" . $aditGM, array("#title#" => "<a href=\"" . $arParams["URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_8" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $arParams["URL"] . "";
} elseif ($arParams["TYPE"] == "SHARE2USERS") {
$arMessageFields["NOTIFY_EVENT"] = "share2users";
$arMessageFields["NOTIFY_TAG"] = "BLOG|SHARE2USERS|" . $arParams["ID"];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_9" . $aditGM, array("#title#" => "<a href=\"" . $arParams["URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_9" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $arParams["URL"] . "";
}
foreach ($arUsers as $v) {
if (!empty($arParams["EXCLUDE_USERS"]) && IntVal($arParams["EXCLUDE_USERS"][$v]) > 0) {
continue;
}
if (IsModuleInstalled("extranet")) {
$arTmp = CSocNetLogTools::ProcessPath(array("URL" => $arParams["URL"]), $v);
$url = $arTmp["URLS"]["URL"];
if (strpos($url, "http://") === 0 || strpos($url, "https://") === 0) {
$serverName = "";
} else {
$serverName = $arTmp["SERVER_NAME"];
}
if ($arParams["TYPE"] == "POST") {
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_1" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_1" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " (" . $serverName . $url . ")";
} elseif ($arParams["TYPE"] == "COMMENT") {
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_4" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_4" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $url . "\n\n" . $arParams["BODY"];
$arMessageFields["NOTIFY_MESSAGE_AUTHOR"] = GetMessage("BLG_GP_IM_5" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_AUTHOR_OUT"] = GetMessage("BLG_GP_IM_5" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $url . "\n\n" . $arParams["BODY"];
} elseif ($arParams["TYPE"] == "SHARE") {
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_8" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_8" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $url . "";
} elseif ($arParams["TYPE"] == "SHARE2USERS") {
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("BLG_GP_IM_9" . $aditGM, array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("BLG_GP_IM_9" . $aditGM, array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " " . $serverName . $url . "";
//.........这里部分代码省略.........
示例6: __ProcessPath
public static function __ProcessPath($arUrl, $user_id)
{
return CSocNetLogTools::ProcessPath($arUrl, $user_id);
}
示例7: 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)));
}
}
}
示例8: NotifyIm
public static function NotifyIm($arParams)
{
if (!CModule::IncludeModule("im") || intval($arParams["PHOTO_AUTHOR_ID"]) <= 0 || $arParams["PHOTO_AUTHOR_ID"] == intval($arParams["COMMENT_AUTHOR_ID"])) {
return;
}
if (!array_key_exists("SECTION_NAME", $arParams)) {
$arParams["SECTION_NAME"] = "";
}
if (!array_key_exists("SECTION_URL", $arParams)) {
$arParams["SECTION_URL"] = 0;
}
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arParams["PHOTO_AUTHOR_ID"], "FROM_USER_ID" => $arParams["COMMENT_AUTHOR_ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "photogallery", "NOTIFY_EVENT" => "comment");
$rsLog = CSocNetLog::GetList(array(), array("EVENT_ID" => array("photo_photo"), "SOURCE_ID" => $arParams["ID"]), false, false, array("ID"));
if ($arLog = $rsLog->Fetch()) {
$rsUnFollower = CSocNetLogFollow::GetList(array("USER_ID" => $arParams["PHOTO_AUTHOR_ID"], "CODE" => "L" . $arLog["ID"], "TYPE" => "N"), array("USER_ID"));
if ($arUnFollower = $rsUnFollower->Fetch()) {
return;
}
$arMessageFields["LOG_ID"] = $arLog["ID"];
}
$arParams["TITLE"] = str_replace(array("\r\n", "\n"), " ", $arParams["TITLE"]);
$arParams["TITLE"] = TruncateText($arParams["TITLE"], 100);
$arParams["TITLE_OUT"] = TruncateText($arParams["TITLE"], 255);
$arTmp = CSocNetLogTools::ProcessPath(array("PHOTO_URL" => $arParams["URL"], "SECTION_URL" => $arParams["SECTION_URL"]), $arParams["PHOTO_AUTHOR_ID"]);
$serverName = $arTmp["SERVER_NAME"];
$arParams["URL"] = $arTmp["URLS"]["PHOTO_URL"];
$arParams["SECTION_URL"] = $arTmp["URLS"]["SECTION_URL"];
$arMessageFields["NOTIFY_TAG"] = "PHOTO|COMMENT|" . $arParams["ID"];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("SONET_PHOTO_IM_COMMENT", array("#photo_title#" => "<a href=\"" . $arParams["URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>", "#album_title#" => "<a href=\"" . $arParams["SECTION_URL"] . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["SECTION_NAME"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("SONET_PHOTO_IM_COMMENT", array("#photo_title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]), "#album_title#" => htmlspecialcharsbx($arParams["SECTION_NAME"]))) . " (" . $serverName . $arParams["URL"] . ")#BR##BR#" . $arParams["MESSAGE"];
$ID = CIMNotify::Add($arMessageFields);
if (!empty($arParams["COMMENT_MENTION_ID"])) {
//
}
}
示例9: GetMessageRatingEntityURL
private static function GetMessageRatingEntityURL($url, $user_id = false, $arSites = false, $intranet_site_id = false, $extranet_site_id = false)
{
static $arSiteData = false;
if (!$arSiteData && IsModuleInstalled('intranet') && CModule::IncludeModule('socialnetwork')) {
$arSiteData = CSocNetLogTools::GetSiteData();
}
if ($arSiteData && count($arSiteData) > 1) {
foreach ($arSiteData as $siteId => $arUrl) {
$url = str_replace($arUrl["USER_PATH"], "#USER_PATH#", $url);
}
$arTmp = CSocNetLogTools::ProcessPath(array("URL" => $url), $user_id);
$url = $arTmp["URLS"]["URL"];
$url = (strpos($url, "http://") === 0 || strpos($url, "https://") === 0 ? "" : (isset($arTmp["SERVER_NAME"]) && !empty($arTmp["SERVER_NAME"]) ? $arTmp["SERVER_NAME"] : "")) . $arTmp["URLS"]["URL"];
} else {
if (is_array($arSites) && intval($user_id) > 0 && strlen($extranet_site_id) > 0 && strlen($intranet_site_id) > 0) {
$bExtranetUser = false;
if ($arSites[$extranet_site_id]) {
$bExtranetUser = true;
$rsUser = CUser::GetByID(intval($user_id));
if ($arUser = $rsUser->Fetch()) {
if (intval($arUser["UF_DEPARTMENT"][0]) > 0) {
$bExtranetUser = false;
}
}
}
if ($bExtranetUser) {
$link = $url;
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, "/");
} else {
$link = $url;
if (substr($link, 0, strlen($arSites[$intranet_site_id]['DIR'])) == $arSites[$intranet_site_id]['DIR']) {
$link = substr($link, strlen($arSites[$intranet_site_id]['DIR']));
}
$SiteServerName = $arSites[$intranet_site_id]['SERVER_NAME'] . $arSites[$intranet_site_id]['DIR'] . ltrim($link, "/");
}
$url = (CMain::IsHTTPS() ? "https" : "http") . "://" . $SiteServerName;
} else {
$SiteServerName = defined('SITE_SERVER_NAME') && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", $_SERVER['SERVER_NAME']);
if (strlen($SiteServerName) > 0) {
$url = (CMain::IsHTTPS() ? "https" : "http") . "://" . $SiteServerName . $url;
}
}
}
return $url;
}
示例10: AddComment_Forum
function AddComment_Forum($arFields)
{
if (!CModule::IncludeModule("forum")) {
return false;
}
$ufFileID = array();
$ufDocID = array();
$dbResult = CSocNetLog::GetList(array(), array("ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "SITE_ID", "TITLE", "PARAMS"));
if ($arLog = $dbResult->Fetch()) {
$arMessage = CForumMessage::GetByID($arLog["SOURCE_ID"]);
if ($arMessage) {
$userID = $GLOBALS["USER"]->GetID();
$notificationSiteId = false;
$arLogSites = array();
$rsLogSite = CSocNetLog::GetSite($arLog["ID"]);
while ($arLogSite = $rsLogSite->Fetch()) {
$arLogSites[] = $arLogSite["LID"];
if (!$notificationSiteId && (!CModule::IncludeModule('extranet') || $arLogSite["LID"] != CExtranet::GetExtranetSiteID())) {
$notificationSiteId = $arLogSite["LID"];
}
}
$bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin($arLogSites);
if ($arFields["ENTITY_TYPE"] == SONET_ENTITY_GROUP) {
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "forum", "full", $bCurrentUserIsAdmin)) {
$strPermission = "Y";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "forum", "newtopic", $bCurrentUserIsAdmin)) {
$strPermission = "M";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "forum", "answer", $bCurrentUserIsAdmin)) {
$strPermission = "I";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_GROUP, $arFields["ENTITY_ID"], "forum", "view", $bCurrentUserIsAdmin)) {
$strPermission = "E";
}
} else {
if (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "forum", "full", $bCurrentUserIsAdmin)) {
$strPermission = "Y";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "forum", "newtopic", $bCurrentUserIsAdmin)) {
$strPermission = "M";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "forum", "answer", $bCurrentUserIsAdmin)) {
$strPermission = "I";
} elseif (CSocNetFeaturesPerms::CanPerformOperation($userID, SONET_ENTITY_USER, $arFields["ENTITY_ID"], "forum", "view", $bCurrentUserIsAdmin)) {
$strPermission = "E";
}
}
$arFieldsMessage = array("POST_MESSAGE" => $arFields["TEXT_MESSAGE"], "USE_SMILES" => "Y", "PERMISSION_EXTERNAL" => "Q", "PERMISSION" => $strPermission, "APPROVED" => "Y");
$GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("SONET_COMMENT", $arTmp);
if (is_array($arTmp)) {
if (array_key_exists("UF_SONET_COM_DOC", $arTmp)) {
$GLOBALS["UF_FORUM_MESSAGE_DOC"] = $arTmp["UF_SONET_COM_DOC"];
} elseif (array_key_exists("UF_SONET_COM_FILE", $arTmp)) {
$arFieldsMessage["FILES"] = array();
foreach ($arTmp["UF_SONET_COM_FILE"] as $file_id) {
$arFieldsMessage["FILES"][$file_id] = array("FILE_ID" => $file_id);
}
if (!empty($arFieldsMessage["FILES"])) {
$arFileParams = array("FORUM_ID" => $arMessage["FORUM_ID"], "TOPIC_ID" => $arMessage["TOPIC_ID"]);
if (CForumFiles::CheckFields($arFieldsMessage["FILES"], $arFileParams, "NOT_CHECK_DB")) {
CForumFiles::Add(array_keys($arFieldsMessage["FILES"]), $arFileParams);
}
}
}
}
$messageID = ForumAddMessage("REPLY", $arMessage["FORUM_ID"], $arMessage["TOPIC_ID"], 0, $arFieldsMessage, $sError, $sNote);
unset($GLOBALS["UF_FORUM_MESSAGE_DOC"]);
// get UF DOC value and FILE_ID there
if ($messageID > 0) {
$dbAddedMessageFiles = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $messageID));
while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch()) {
$ufFileID[] = $arAddedMessageFiles["FILE_ID"];
}
$ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $messageID, LANGUAGE_ID);
}
if ($messageID > 0 && CModule::IncludeModule("im") && intval($arMessage["AUTHOR_ID"]) > 0 && $arMessage["AUTHOR_ID"] != $userID) {
$rsUnFollower = CSocNetLogFollow::GetList(array("USER_ID" => $arMessage["AUTHOR_ID"], "CODE" => "L" . $arLog["ID"], "TYPE" => "N"), array("USER_ID"));
$arUnFollower = $rsUnFollower->Fetch();
if (!$arUnFollower) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arMessage["AUTHOR_ID"], "FROM_USER_ID" => $userID, "LOG_ID" => $arLog["ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "forum", "NOTIFY_EVENT" => "comment");
$arParams["TITLE"] = str_replace(array("\r\n", "\n"), " ", $arLog["TITLE"]);
$arParams["TITLE"] = TruncateText($arParams["TITLE"], 100);
$arParams["TITLE_OUT"] = TruncateText($arParams["TITLE"], 255);
$arParams["URL"] = "";
if (strlen($arLog["PARAMS"]) > 0) {
$arTmp = unserialize(htmlspecialcharsback($arLog["PARAMS"]));
if ($arTmp && array_key_exists("PATH_TO_MESSAGE", $arTmp)) {
$arParams["URL"] = CComponentEngine::MakePathFromTemplate($arTmp["PATH_TO_MESSAGE"], array("MID" => $messageID));
}
}
$arTmp = CSocNetLogTools::ProcessPath(array("MESSAGE_URL" => $arParams["URL"]), $arMessage["AUTHOR_ID"], $notificationSiteId);
$serverName = $arTmp["SERVER_NAME"];
$url = $arTmp["URLS"]["MESSAGE_URL"];
$arMessageFields["NOTIFY_TAG"] = "FORUM|COMMENT|" . $messageID;
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("SONET_FORUM_IM_COMMENT", array("#title#" => strlen($url) > 0 ? "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>" : htmlspecialcharsbx($arParams["TITLE"])));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("SONET_FORUM_IM_COMMENT", array("#title#" => htmlspecialcharsbx($arParams["TITLE"]))) . (strlen($url) > 0 ? " (" . $serverName . $url . ")" : "") . "#BR##BR#" . $arFields["TEXT_MESSAGE"];
CIMNotify::Add($arMessageFields);
}
}
} else {
$sError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
}
} else {
$sError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
//.........这里部分代码省略.........
示例11: createLogComment
private function createLogComment($messageID, $bSocNetLogRecordExists, $iblockElementID, $topicID, $arLogParams)
{
$dbComment = CSocNetLogComments::GetList(array(), array('EVENT_ID' => 'wiki_comment', 'SOURCE_ID' => $messageID), false, false, array('ID'));
if (($arComment = $dbComment->Fetch()) && intval($arComment['ID']) > 0) {
return false;
}
$arForum = CForumNew::GetByID($this->ForumID);
$parser = new textParser(LANGUAGE_ID, $this->arPath['PATH_TO_SMILE']);
$parser->image_params['width'] = false;
$parser->image_params['height'] = false;
$arAllow = array('HTML' => "N", 'ANCHOR' => "N", 'BIU' => "N", 'IMG' => "N", 'LIST' => "N", 'QUOTE' => "N", 'CODE' => "N", 'FONT' => "N", 'UPLOAD' => $arForum['ALLOW_UPLOAD'], 'NL2BR' => "N", 'SMILES' => "N");
if ($bSocNetLogRecordExists) {
$arMessage = CForumMessage::GetByIDEx($messageID);
$sAuthorForMail = str_replace('#TITLE#', $arMessage['AUTHOR_NAME'], GetMessage('SONET_FORUM_LOG_TEMPLATE_GUEST'));
$parser = new textParser(LANGUAGE_ID, $this->arPath['PATH_TO_SMILE']);
$parser->image_params['width'] = false;
$parser->image_params['height'] = false;
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$sAuthorForMail = str_replace(array('#URL#', '#TITLE#'), array('http://' . SITE_SERVER_NAME . CComponentEngine::MakePathFromTemplate($this->arPath['PATH_TO_USER'], array('user_id' => $arMessage['AUTHOR_ID'])), $arMessage['AUTHOR_NAME']), GetMessage('SONET_FORUM_LOG_TEMPLATE_AUTHOR'));
}
$arFieldsForSocnet = array('ENTITY_TYPE' => SONET_SUBSCRIBE_ENTITY_GROUP, 'ENTITY_ID' => intval($this->SonetGroupID), 'EVENT_ID' => 'wiki_comment', '=LOG_DATE' => $GLOBALS['DB']->CharToDateFunction($arMessage['POST_DATE'], "FULL", SITE_ID), 'MESSAGE' => $parser->convert($arMessage['POST_MESSAGE'], $arAllow), 'TEXT_MESSAGE' => $parser->convert4mail($arMessage['POST_MESSAGE'] . $sAuthorForMail), 'URL' => $arLogParams["URL"], 'MODULE_ID' => false, 'SOURCE_ID' => $messageID, 'LOG_ID' => $arLogParams["LOG_ID"], 'RATING_TYPE_ID' => 'FORUM_POST', 'RATING_ENTITY_ID' => intval($arMessage['ID']));
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$arFieldsForSocnet['USER_ID'] = $arMessage['AUTHOR_ID'];
}
$log_comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
if ($log_comment_id) {
CSocNetLog::CounterIncrement($log_comment_id, false, false, "LC");
if (CModule::IncludeModule("im") && intval($arMessage["AUTHOR_ID"]) > 0 && $arMessage["AUTHOR_ID"] != $arLogParams["LOG_USER_ID"]) {
$rsUnFollower = CSocNetLogFollow::GetList(array("USER_ID" => $arLogParams["LOG_USER_ID"], "CODE" => "L" . $arLogParams["LOG_ID"], "TYPE" => "N"), array("USER_ID"));
$arUnFollower = $rsUnFollower->Fetch();
if (!$arUnFollower) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arLogParams["LOG_USER_ID"], "FROM_USER_ID" => $arMessage["AUTHOR_ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "wiki", "NOTIFY_EVENT" => "comment");
$arParams["TITLE"] = str_replace(array("\r\n", "\n"), " ", $arLogParams["LOG_TITLE"]);
$arParams["TITLE"] = TruncateText($arParams["TITLE"], 100);
$arParams["TITLE_OUT"] = TruncateText($arParams["TITLE"], 255);
$arTmp = CSocNetLogTools::ProcessPath(array("ELEMENT_URL" => $arLogParams["URL"]), $arLogParams["LOG_USER_ID"]);
$serverName = $arTmp["SERVER_NAME"];
$url = $arTmp["URLS"]["ELEMENT_URL"];
$arMessageFields["NOTIFY_TAG"] = "WIKI|COMMENT|" . $iblockElementID;
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("WIKI_SONET_IM_COMMENT", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("WIKI_SONET_IM_COMMENT", array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " (" . $serverName . $url . ")#BR##BR#" . $arFieldsForSocnet["MESSAGE"];
CIMNotify::Add($arMessageFields);
}
}
}
} else {
$dbMessage = CForumMessage::GetListEx(array(), array("TOPIC_ID" => $topicID, "NEW_TOPIC" => "N"));
while ($arMessage = $dbMessage->GetNext()) {
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$sAuthorForMail = str_replace(array('#URL#', '#TITLE#'), array('http://' . SITE_SERVER_NAME . CComponentEngine::MakePathFromTemplate($this->arPath['PATH_TO_USER'], array('user_id' => $arMessage['AUTHOR_ID'])), $arMessage['AUTHOR_NAME']), GetMessage('SONET_FORUM_LOG_TEMPLATE_AUTHOR'));
}
$arFieldsForSocnet = array('ENTITY_TYPE' => SONET_SUBSCRIBE_ENTITY_GROUP, 'ENTITY_ID' => intval($this->SonetGroupID), 'EVENT_ID' => 'wiki_comment', '=LOG_DATE' => $GLOBALS['DB']->CharToDateFunction($arMessage['POST_DATE'], "FULL", SITE_ID), 'MESSAGE' => $parser->convert($arMessage['POST_MESSAGE'], $arAllow), 'TEXT_MESSAGE' => $parser->convert4mail($arMessage['POST_MESSAGE'] . $sAuthorForMail), 'URL' => $arLogParams["URL"], 'MODULE_ID' => false, 'SOURCE_ID' => $arMessage['ID'], 'LOG_ID' => $arLogParams["LOG_ID"], 'RATING_TYPE_ID' => 'FORUM_POST', 'RATING_ENTITY_ID' => intval($arMessage['ID']));
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$arFieldsForSocnet['USER_ID'] = $arMessage['AUTHOR_ID'];
}
$log_comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
CSocNetLog::CounterIncrement($log_comment_id, false, false, "LC");
}
}
}
示例12: array
}
if ($bSocNetLogRecordExists) {
if (intVal($arResult["MESSAGE"]["AUTHOR_ID"]) > 0) {
$arFieldsForSocnet["USER_ID"] = $arResult["MESSAGE"]["AUTHOR_ID"];
}
$log_comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
CSocNetLog::CounterIncrement($log_comment_id, false, false, "LC");
if (CModule::IncludeModule("im") && intval($arFieldsForSocnet["USER_ID"]) > 0 && $arFieldsForSocnet["USER_ID"] != $log_user_id) {
$rsUnFollower = CSocNetLogFollow::GetList(array("USER_ID" => $log_user_id, "CODE" => "L" . $log_id, "TYPE" => "N"), array("USER_ID"));
$arUnFollower = $rsUnFollower->Fetch();
if (!$arUnFollower) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $log_user_id, "FROM_USER_ID" => $arFieldsForSocnet["USER_ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "forum", "NOTIFY_EVENT" => "comment");
$arParams["TITLE"] = str_replace(array("\r\n", "\n"), " ", $arResult["MESSAGE"]["TOPIC_INFO"]["TITLE"]);
$arParams["TITLE"] = TruncateText($arParams["TITLE"], 100);
$arParams["TITLE_OUT"] = TruncateText($arParams["TITLE"], 255);
$arTmp = CSocNetLogTools::ProcessPath(array("MESSAGE_URL" => $arFieldsForSocnet["URL"]), $log_user_id);
$serverName = $arTmp["SERVER_NAME"];
$url = $arTmp["URLS"]["MESSAGE_URL"];
$arMessageFields["NOTIFY_TAG"] = "FORUM|COMMENT|" . $arParams["MID"];
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("SONET_FORUM_ACTION_IM_COMMENT", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("SONET_FORUM_ACTION_IM_COMMENT", array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " (" . $serverName . $url . ")#BR##BR#" . $sText;
CIMNotify::Add($arMessageFields);
}
}
} else {
$dbComments = CForumMessage::GetListEx(array("ID" => "ASC"), array('TOPIC_ID' => $arParams["TID"], "NEW_TOPIC" => "N"));
if ($dbComments && ($arComment = $dbComments->Fetch())) {
do {
$ufFileID = array();
$dbAddedMessageFiles = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $arComment["ID"]));
while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch()) {