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


PHP CSocNetLog::CounterIncrement方法代码示例

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


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

示例1: onAfterCommentAdd

 public static function onAfterCommentAdd($entityType, $entityId, $arData)
 {
     global $USER;
     // 'TK' is our entity type
     if ($entityType !== 'TK' || intval($entityId) <= 0 || !CModule::IncludeModule('tasks') || !CModule::IncludeModule('socialnetwork')) {
         return;
     }
     $taskId = (int) $entityId;
     $messageId = $arData['MESSAGE_ID'];
     $parser = new CTextParser();
     $messageAuthorId = null;
     if (array_key_exists('AUTHOR_ID', $arData['PARAMS']) && array_key_exists('EDIT_DATE', $arData['PARAMS']) && array_key_exists('POST_DATE', $arData['PARAMS'])) {
         $messageAuthorId = $arData['PARAMS']['AUTHOR_ID'];
     } else {
         $arMessage = CForumMessage::GetByID($messageId);
         $messageAuthorId = $arMessage['AUTHOR_ID'];
     }
     $occurAsUserId = CTasksTools::getOccurAsUserId();
     if (!$occurAsUserId) {
         $occurAsUserId = $messageAuthorId ? $messageAuthorId : 1;
     }
     $rsTask = CTasks::GetList(false, array('ID' => $taskId), array('UF_CRM_TASK'));
     $arTask = $rsTask->GetNext();
     if (!isset($arTask) || !isset($arTask['UF_CRM_TASK']) || is_array($arTask['UF_CRM_TASK']) && (!isset($arTask['UF_CRM_TASK'][0]) || strlen($arTask['UF_CRM_TASK'][0]) <= 0) || !is_array($arTask['UF_CRM_TASK']) && strlen($arTask['UF_CRM_TASK']) <= 0) {
         return;
     }
     $dbCrmActivity = CCrmActivity::GetList(array(), array('TYPE_ID' => CCrmActivityType::Task, 'ASSOCIATED_ENTITY_ID' => $taskId, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID'));
     $arCrmActivity = $dbCrmActivity->Fetch();
     if (!$arCrmActivity) {
         return;
     }
     $crmActivityId = $arCrmActivity['ID'];
     // sonet log
     $dbLog = CSocNetLog::GetList(array(), array("EVENT_ID" => "crm_activity_add", "ENTITY_ID" => $crmActivityId), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID"));
     if ($arLog = $dbLog->Fetch()) {
         $log_id = $arLog["ID"];
         $entity_type = $arLog["ENTITY_TYPE"];
         $entity_id = $arLog["ENTITY_ID"];
         $strURL = $GLOBALS['APPLICATION']->GetCurPageParam("", array("IFRAME", "MID", "SEF_APPLICATION_CUR_PAGE_URL", BX_AJAX_PARAM_ID, "result"));
         $strURL = ForumAddPageParams($strURL, array("MID" => $messageId, "result" => "reply"), false, false);
         $sText = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"];
         $arFieldsForSocnet = array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "crm_activity_add_comment", "MESSAGE" => $sText, "TEXT_MESSAGE" => $parser->convert4mail($sText), "URL" => str_replace("?IFRAME=Y", "", str_replace("&IFRAME=Y", "", str_replace("IFRAME=Y&", "", $strURL))), "MODULE_ID" => "crm", "SOURCE_ID" => $messageId, "LOG_ID" => $log_id, "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => $messageId);
         $arFieldsForSocnet["USER_ID"] = $occurAsUserId;
         $arFieldsForSocnet["=LOG_DATE"] = $GLOBALS['DB']->CurrentTimeFunction();
         $ufFileID = array();
         $dbAddedMessageFiles = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $messageId));
         while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch()) {
             $ufFileID[] = $arAddedMessageFiles["FILE_ID"];
         }
         if (count($ufFileID) > 0) {
             $arFieldsForSocnet["UF_SONET_COM_FILE"] = $ufFileID;
         }
         $ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $messageId, LANGUAGE_ID);
         if ($ufDocID) {
             $arFieldsForSocnet["UF_SONET_COM_DOC"] = $ufDocID;
         }
         $comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
         CSocNetLog::CounterIncrement($comment_id, false, false, "LC");
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:60,代码来源:livefeed.php

示例2: onAfterForumMessageAdd

 function onAfterForumMessageAdd($ID, $arForumMessage, $arTopicInfo, $arForumInfo, $arFields)
 {
     // add log comment
     if (array_key_exists("ADD_TO_LOG", $arFields) && $arFields["ADD_TO_LOG"] == "N") {
         return;
     }
     if (array_key_exists("NEW_TOPIC", $arFields) && $arFields["NEW_TOPIC"] == "Y") {
         return;
     }
     if (!array_key_exists("TOPIC_INFO", $arForumMessage) || !is_array($arForumMessage["TOPIC_INFO"]) || !array_key_exists("XML_ID", $arForumMessage["TOPIC_INFO"]) || empty($arForumMessage["TOPIC_INFO"]["XML_ID"]) || strpos($arForumMessage["TOPIC_INFO"]["XML_ID"], "IBLOCK_") !== 0) {
         return;
     }
     $val = COption::GetOptionString("intranet", "sonet_log_news_iblock_forum");
     $arIBlockForum = strlen($val) > 0 ? unserialize($val) : array();
     if (CModule::IncludeModule("socialnetwork") && in_array($arFields["FORUM_ID"], $arIBlockForum) && array_key_exists("PARAM2", $arFields) && intval($arFields["PARAM2"]) > 0) {
         CSocNetAllowed::GetAllowedEntityTypes();
         $dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "news", "SOURCE_ID" => $arFields["PARAM2"]), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID", "TMP_ID"));
         if ($arRes = $dbRes->Fetch()) {
             $log_id = $arRes["ID"];
             $entity_id = $arRes["ENTITY_ID"];
             $arForum = CForumNew::GetByID($arFields["FORUM_ID"]);
             $parser = new textParser(LANGUAGE_ID);
             // second parameter - 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", "VIDEO" => "N", "SMILES" => "N");
             $arMessage = CForumMessage::GetByIDEx($ID);
             $url = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $arMessage["FORUM_ID"], "TID" => $arMessage["TOPIC_ID"], "MID" => $ID));
             $arFieldsForSocnet = array("ENTITY_TYPE" => SONET_SUBSCRIBE_ENTITY_NEWS, "ENTITY_ID" => $entity_id, "EVENT_ID" => "news_comment", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE" => $parser->convert($arFields["POST_MESSAGE"], $arAllow), "TEXT_MESSAGE" => $parser->convert4mail($arFields["POST_MESSAGE"]), "URL" => $url, "MODULE_ID" => false, "SOURCE_ID" => $ID, "LOG_ID" => $log_id, "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => $ID);
             if (intVal($arMessage["AUTHOR_ID"]) > 0) {
                 $arFieldsForSocnet["USER_ID"] = $arMessage["AUTHOR_ID"];
             }
             $comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
             CSocNetLog::CounterIncrement($comment_id, false, false, "LC");
         }
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:37,代码来源:include.php

示例3: OnAfterPhotoCommentAddBlog


//.........这里部分代码省略.........
                 $sAuthorName = GetMessage("SONET_PHOTO_LOG_GUEST");
                 if (intval($arElement["CREATED_BY"]) > 0) {
                     $rsUser = CUser::GetByID($arElement["CREATED_BY"]);
                     if ($arUser = $rsUser->Fetch()) {
                         $sAuthorName = CUser::FormatName(CSite::GetNameFormat(false), $arUser, true, false);
                     }
                 }
                 if (in_array($this->entity_type, array(SONET_ENTITY_USER, SONET_ENTITY_GROUP)) && intval($this->entity_id) > 0) {
                     $entity_type = $this->entity_type;
                     $entity_id = $this->entity_id;
                     $alias = ($this->entity_type == SONET_ENTITY_GROUP ? "group" : "user") . "_" . $this->entity_id;
                 }
                 $arLogParams = array("BLOG_ID" => intval($this->BlogID));
                 $rsIBlock = CIBlock::GetByID($arElement["IBLOCK_ID"]);
                 if ($arIBlock = $rsIBlock->Fetch()) {
                     $arLogParams["IBLOCK_ID"] = $arIBlock["ID"];
                     $arLogParams["IBLOCK_TYPE"] = $arIBlock["IBLOCK_TYPE_ID"];
                 }
                 $rsSection = CIBlockSection::GetByID($arElement["IBLOCK_SECTION_ID"]);
                 if ($arSection = $rsSection->Fetch()) {
                     $arLogParams["SECTION_ID"] = $arSection["ID"];
                     $arLogParams["SECTION_NAME"] = $arSection["NAME"];
                     $arLogParams["SECTION_URL"] = str_replace("#SECTION_ID#", $arSection["ID"], $this->arPath["SECTION_URL"]);
                     $arSectionPath = array();
                     $bPassword = false;
                     $dbSectionPath = CIBlockSection::GetList(array("LEFT_MARGIN" => "ASC"), array("IBLOCK_ID" => intval($arLogParams["IBLOCK_ID"]), "<=LEFT_BORDER" => intval($arSection["LEFT_MARGIN"]), ">=RIGHT_BORDER" => intval($arSection["RIGHT_MARGIN"]), "<=DEPTH_LEVEL" => intval($arSection["DEPTH_LEVEL"])), false, array("ID", "IBLOCK_ID", "NAME", "CREATED_BY", "DEPTH_LEVEL", "LEFT_MARGIN", "RIGHT_MARGIN", "UF_PASSWORD"));
                     while ($arPath = $dbSectionPath->Fetch()) {
                         $arSectionPath[] = $arPath;
                         if (strlen(trim($arPath["UF_PASSWORD"])) > 0) {
                             $bPassword = true;
                             break;
                         }
                     }
                     if (!$alias) {
                         $entity_type = SONET_ENTITY_USER;
                         $entity_id = $arSectionPath[0]["CREATED_BY"];
                         $alias = $arSectionPath[0]["CODE"];
                     }
                 }
                 $arLogParams["ALIAS"] = $alias;
                 $arSonetFields = array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "photo_photo", "LOG_DATE" => $arElement["TIMESTAMP_X"], "TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $sAuthorName, GetMessage("SONET_PHOTOPHOTO_LOG_1")), "TITLE" => $arElement["NAME"], "MESSAGE" => "", "TEXT_MESSAGE" => "", "URL" => CComponentEngine::MakePathFromTemplate($url, array("ELEMENT_ID" => $arElement["ID"], "element_id" => $arElement["ID"], "SECTION_ID" => $arElement["IBLOCK_SECTION_ID"], "section_id" => $arElement["IBLOCK_SECTION_ID"])), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "SOURCE_ID" => $arElement["ID"], "PARAMS" => serialize($arLogParams), "RATING_TYPE_ID" => "IBLOCK_ELEMENT", "RATING_ENTITY_ID" => $arElement["ID"]);
                 if (intval($arElement["CREATED_BY"]) > 0) {
                     $arSonetFields["USER_ID"] = $arElement["CREATED_BY"];
                 }
                 $log_id = CSocNetLog::Add($arSonetFields, false);
                 if (intval($log_id) > 0) {
                     $log_title = $arSonetFields["TITLE"];
                     $log_url = $arSonetFields["URL"];
                     $log_section_name = $arLogParams["SECTION_NAME"];
                     $log_section_url = $arLogParams["SECTION_URL"];
                     $log_user_id = $arSonetFields["USER_ID"];
                     CSocNetLog::Update($log_id, array("TMP_ID" => $log_id));
                     if ($bPassword) {
                         CSocNetLogRights::DeleteByLogID($log_id);
                         CSocNetLogRights::Add($log_id, array("U" . $GLOBALS["USER"]->GetID(), "SA"));
                     } else {
                         CSocNetLogRights::SetForSonet($log_id, $entity_type, $entity_id, "photo", "view", true);
                     }
                 }
             }
         }
         if (intval($log_id) > 0) {
             $parserBlog = new blogTextParser(false, $this->arPath["PATH_TO_SMILE"]);
             $arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N");
             if ($bSocNetLogRecordExists) {
                 $text4message = $parserBlog->convert($arFields["POST_TEXT"], true, array(), $arAllow);
                 $text4mail = $parserBlog->convert4mail($arFields["POST_TEXT"]);
                 $arFieldsForSocnet = array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "photo_comment", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE" => $text4message, "TEXT_MESSAGE" => $text4mail, "MODULE_ID" => false, "SOURCE_ID" => $ID, "LOG_ID" => $log_id, "RATING_TYPE_ID" => "BLOG_COMMENT", "RATING_ENTITY_ID" => $ID);
                 if (intval($arFields["AUTHOR_ID"]) > 0) {
                     $arFieldsForSocnet["USER_ID"] = $arFields["AUTHOR_ID"];
                 }
                 $comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
                 if ($comment_id) {
                     CSocNetLog::CounterIncrement($comment_id, false, false, "LC");
                     $arFieldsIM = array("TYPE" => "COMMENT", "TITLE" => $log_title, "MESSAGE" => $arFieldsForSocnet["MESSAGE"], "URL" => $log_url, "SECTION_NAME" => $log_section_name, "SECTION_URL" => $log_section_url, "ID" => $this->PhotoElementID, "PHOTO_AUTHOR_ID" => $log_user_id, "COMMENT_AUTHOR_ID" => $arFields["AUTHOR_ID"]);
                     CSocNetPhotoCommentEvent::NotifyIm($arFieldsIM);
                 }
             } else {
                 $dbComments = CBlogComment::GetList(array(), array("BLOG_ID" => intval($this->BlogID), "POST_ID" => intval($this->PostID)), false, false, array("ID", "BLOG_ID", "POST_ID", "AUTHOR_ID", "POST_TEXT", "DATE_CREATE"));
                 while ($arComment = $dbComments->GetNext()) {
                     $text4message = $parserBlog->convert($arComment["POST_TEXT"], true, array(), $arAllow);
                     $text4mail = $parserBlog->convert4mail($arComment["POST_TEXT"]);
                     $arFieldsForSocnet = array("ENTITY_TYPE" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "photo_comment", "=LOG_DATE" => $GLOBALS["DB"]->CharToDateFunction($arComment["DATE_CREATE"], "FULL", SITE_ID), "MESSAGE" => $text4message, "TEXT_MESSAGE" => $text4mail, "MODULE_ID" => false, "SOURCE_ID" => intval($arComment["ID"]), "LOG_ID" => $log_id, "RATING_TYPE_ID" => "BLOG_COMMENT", "RATING_ENTITY_ID" => intval($arComment["ID"]));
                     if (intval($arFields["AUTHOR_ID"]) > 0) {
                         $arFieldsForSocnet["USER_ID"] = $arFields["AUTHOR_ID"];
                     }
                     $comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
                     if ($comment_id) {
                         CSocNetLog::CounterIncrement($comment_id, false, false, "LC");
                         $arFieldsIM = array("TYPE" => "COMMENT", "TITLE" => $log_title, "MESSAGE" => $arFieldsForSocnet["MESSAGE"], "URL" => $log_url, "SECTION_NAME" => $log_section_name, "SECTION_URL" => $log_section_url, "ID" => $this->PhotoElementID, "PHOTO_AUTHOR_ID" => $log_user_id, "COMMENT_AUTHOR_ID" => $arFields["AUTHOR_ID"]);
                         CSocNetPhotoCommentEvent::NotifyIm($arFieldsIM);
                     }
                 }
                 if ($arElement) {
                     self::InheriteAlbumFollow($arElement["IBLOCK_SECTION_ID"], $log_id, intVal($arElement["CREATED_BY"]) > 0 ? $arElement["CREATED_BY"] : false);
                 }
             }
         }
     }
 }
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:log_tools_photo.php

示例4: array

 }
 $arImages = array();
 $res = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arBlog["ID"], "IS_COMMENT" => "Y", "COMMENT_ID" => $commentId));
 while ($arImage = $res->Fetch()) {
     $arImages[$arImage["ID"]] = $arImage["FILE_ID"];
 }
 $arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "TABLE" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N");
 $text4mail = $parserBlog->convert4mail($_POST['comment'], $arImages);
 if (intval($log_id) > 0) {
     $text4message = $parserBlog->convert($_POST['comment'], false, $arImages, $arAllow, array("isSonetLog" => true));
     $arFieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_USER, "ENTITY_ID" => $arBlog["OWNER_ID"], "EVENT_ID" => "blog_comment", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE" => $text4message, "TEXT_MESSAGE" => $text4mail, "URL" => $commentUrl, "MODULE_ID" => false, "SOURCE_ID" => $commentId, "LOG_ID" => $log_id, "RATING_TYPE_ID" => "BLOG_COMMENT", "RATING_ENTITY_ID" => intval($commentId));
     if (intval($user_id) > 0) {
         $arFieldsForSocnet["USER_ID"] = $user_id;
     }
     $log_comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
     CSocNetLog::CounterIncrement($log_comment_id, false, false, "LC", CSocNetLogRights::CheckForUserAll($log_id));
 }
 $arPSR = CBlogPost::GetSocnetPerms($arPost["ID"]);
 $arUsrS = array();
 if (!empty($arPSR["U"])) {
     foreach ($arPSR["U"] as $k => $v) {
         $arUsrS[] = "U" . $k;
     }
 }
 preg_match_all("/\\[user\\s*=\\s*([^\\]]*)\\](.+?)\\[\\/user\\]/is" . BX_UTF_PCRE_MODIFIER, $_POST['comment'], $arMention);
 $arFieldsIM = array("TYPE" => "COMMENT", "TITLE" => htmlspecialcharsBack($arPost["TITLE"]), "URL" => $commentUrl, "ID" => $arPost["ID"], "FROM_USER_ID" => $user_id, "TO_USER_ID" => array($arPost["AUTHOR_ID"]), "TO_SOCNET_RIGHTS" => $arUsrS, "TO_SOCNET_RIGHTS_OLD" => array("U" => array(), "SG" => array()), "AUTHOR_ID" => $arPost["AUTHOR_ID"], "BODY" => $text4mail);
 if (!empty($arMention)) {
     $arFieldsIM["MENTION_ID"] = $arMention[1];
     if ($_POST["act"] != "edit" && is_array($arMention[1]) && !empty($arMention[1])) {
         $arMentionedDestCode = array();
         foreach ($arMention[1] as $val) {
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例5: SendEvent


//.........这里部分代码省略.........
						if (
							array_key_exists("URL_TO_SEND", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"])
							&& strlen($arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"]) > 0
						)
							$link = GetMessage("SONET_GL_SEND_EVENT_LINK").$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"];
						elseif (
							array_key_exists("URL", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"])
							&& strlen($arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"]) > 0
						)
							$link = GetMessage("SONET_GL_SEND_EVENT_LINK").$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"];
						else
							$link = "";

						$arMessageFields = array(
							"FROM_USER_ID" => (intval($arLog["USER_ID"]) > 0 ? $arLog["USER_ID"] : 1),
							"TO_USER_ID" => $arSubscriber["USER_ID"],
							"MESSAGE" => $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["TITLE"]." #BR#".$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE_TO_SEND"].(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"];
						$arFields["SUBSCRIBER_EMAIL"] = $arSubscriber["USER_EMAIL"];
						$arFields["EMAIL_TO"] = $arSubscriber["USER_EMAIL"];
						$arFields["TITLE"] = str_replace("#BR#", "\n", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["TITLE"]);
						$arFields["MESSAGE"] = str_replace("#BR#", "\n", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE_TO_SEND"]);
						$arFields["ENTITY"] = $arLog["FIELDS_FORMATTED"]["ENTITY"]["FORMATTED"];
						$arFields["ENTITY_TYPE"] = $arLog["FIELDS_FORMATTED"]["ENTITY"]["TYPE_MAIL"];

						if (
							array_key_exists("URL_TO_SEND", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"])
							&& strlen($arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"]) > 0
						)
							$arFields["URL"] = $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"];
						elseif (
							array_key_exists("URL", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"])
							&& strlen($arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"]) > 0
						)
							$arFields["URL"] = $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"];
						else
							$arFields["URL"] = $arLog["URL"];

						if (CModule::IncludeModule("extranet"))
							$arUserGroup = CUser::GetUserGroup($arSubscriber["USER_ID"]);

						foreach ($arLogSites as $site_id_tmp)
						{
							if (IsModuleInstalled("extranet"))
							{
								if (
									(
										CExtranet::IsExtranetSite($site_id_tmp)
										&& in_array(CExtranet::GetExtranetUserGroupID(), $arUserGroup)
									)
									||
									(
										!CExtranet::IsExtranetSite($site_id_tmp)
										&& !in_array(CExtranet::GetExtranetUserGroupID(), $arUserGroup)
									)
								)
								{
									$siteID = $site_id_tmp;
									break;
								}
								else
									continue;
							}
							else
							{
								$siteID = $site_id_tmp;
								break;
							}
						}

						if (!$siteID)
							$siteID = (defined("SITE_ID") ? SITE_ID : $arSubscriber["SITE_ID"]);

						if (StrLen($siteID) <= 0)
							$siteID = $arSubscriber["USER_LID"];
						if (StrLen($siteID) <= 0)
							continue;

						$event = new CEvent;
						$event->Send($mailTemplate, $siteID, $arFields, "N");
						break;
					default:
				}
			}
		}

		CSocNetLog::CounterIncrement($arLog["ID"], $arLog["EVENT_ID"], $arOfEntities);

		return true;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:log.php

示例6: SocnetEMailMessageAdd


//.........这里部分代码省略.........
			{
				$dbForumMessage = CForumMessage::GetList(
					array("ID" => "ASC"),
					array("TOPIC_ID" => $TOPIC_ID)
				);
				if ($arForumMessage = $dbForumMessage->Fetch())
				{
					$dbRes = CSocNetLog::GetList(
						array("ID" => "DESC"),
						array(
							"EVENT_ID" => "forum",
							"SOURCE_ID" => $arForumMessage["ID"]
						),
						false,
						false,
						array("ID", "TMP_ID")
					);
					if ($arRes = $dbRes->Fetch())
						$log_id = $arRes["TMP_ID"];
					else
					{
						$dbFirstMessage = CForumMessage::GetList(
							array("ID" => "ASC"),
							array("TOPIC_ID" => $arForumMessage["TOPIC_ID"]),
							false,
							1
						);
						if ($arFirstMessage = $dbFirstMessage->Fetch())
						{
							$arTopic = CForumTopic::GetByID($arFirstMessage["TOPIC_ID"]);
							$sFirstMessageText = (COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arFirstMessage["POST_MESSAGE_FILTER"] : $arFirstMessage["POST_MESSAGE"]);

							$sFirstMessageURL = CComponentEngine::MakePathFromTemplate(
								$arParams["URL_TEMPLATES_MESSAGE"],
								array(
									"UID" => $arFirstMessage["AUTHOR_ID"],
									"FID" => $arFirstMessage["FORUM_ID"],
									"TID" => $arFirstMessage["TOPIC_ID"],
									"MID" => $arFirstMessage["ID"])
							);

							$arFieldsForSocnet = array(
								"ENTITY_TYPE" => SONET_ENTITY_GROUP,
								"ENTITY_ID" => $SOCNET_GROUP_ID,
								"EVENT_ID" => "forum",
								"LOG_DATE" => $arFirstMessage["POST_DATE"],
								"LOG_UPDATE" => $arFirstMessage["POST_DATE"],
								"TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $arFirstMessage["AUTHOR_NAME"], GetMessage("SONET_FORUM_LOG_TOPIC_TEMPLATE")),
								"TITLE" => $arTopic["TITLE"],
								"MESSAGE" => $parser->convert($sFirstMessageText, $arAllow),
								"TEXT_MESSAGE" => $parser->convert4mail($sFirstMessageText),
								"URL" => $sFirstMessageURL,
								"PARAMS" => serialize(array("PATH_TO_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("TID" => $arFirstMessage["TOPIC_ID"])))),
								"MODULE_ID" => false,
								"CALLBACK_FUNC" => false,
								"SOURCE_ID" => $arFirstMessage["ID"],
								"RATING_TYPE_ID" => "FORUM_TOPIC",
								"RATING_ENTITY_ID" => intval($arFirstMessage["TOPIC_ID"])
							);

							if (intVal($arFirstMessage["AUTHOR_ID"]) > 0)
								$arFieldsForSocnet["USER_ID"] = $arFirstMessage["AUTHOR_ID"];

							$log_id = CSocNetLog::Add($arFieldsForSocnet, false);
							if (intval($log_id) > 0)
							{
								CSocNetLog::Update($log_id, array("TMP_ID" => $log_id));
								CSocNetLogRights::SetForSonet($log_id, $arFieldsForSocnet["ENTITY_TYPE"], $arFieldsForSocnet["ENTITY_ID"], "forum", "view", true);
							}
						}
					}

					if (intval($log_id) > 0)
					{
						$arFieldsForSocnet = array(
							"ENTITY_TYPE" => SONET_ENTITY_GROUP,
							"ENTITY_ID" => $SOCNET_GROUP_ID,
							"EVENT_ID" => "forum",
							"LOG_ID" => $log_id,
							"=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
							"MESSAGE" => $parser->convert($body, $arAllow),
							"TEXT_MESSAGE" => $parser->convert4mail($body),
							"URL" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("UID" => $AUTHOR_USER_ID, "FID" => $FORUM_ID, "TID" => $TOPIC_ID, "MID" => $MESSAGE_ID)),
							"MODULE_ID" => false,
							"SOURCE_ID" => $MESSAGE_ID,
							"RATING_TYPE_ID" => "FORUM_POST",
							"RATING_ENTITY_ID" => intval($MESSAGE_ID)
						);

						if (intVal($AUTHOR_USER_ID) > 0)
							$arFieldsForSocnet["USER_ID"] = $AUTHOR_USER_ID;

						$comment_id = CSocNetLogComments::Add($arFieldsForSocnet);
						CSocNetLog::CounterIncrement($comment_id, false, false, "LC");
					}
				}
			}

		}
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:mail.php

示例7: AddComment

 private function AddComment()
 {
     global $DB;
     $arNotification = $this->Notify->getNotification();
     $arLog = CSocNetLog::GetList(array("ID" => "DESC"), array("ENTITY_TYPE" => SONET_ENTITY_USER, "EVENT_ID" => "idea", "SOURCE_ID" => $arNotification["POST_ID"]), false, false, array("ID", "RATING_ENTITY_ID"))->Fetch();
     if ($arLog) {
         $arNotify = array("EVENT_ID" => "idea_comment", "URL" => $arNotification["PATH"], "MESSAGE" => $arNotification["POST_TEXT"], "SOURCE_ID" => $arNotification["ID"], "ENTITY_TYPE" => SONET_ENTITY_USER, "ENTITY_ID" => $arNotification["AUTHOR_ID"], "USER_ID" => $arNotification["AUTHOR_ID"], "MODULE_ID" => 'idea', "LOG_ID" => $arLog["ID"]);
         if (isset($arNotification["LOG_DATE"])) {
             $arNotify["LOG_DATE"] = $arNotification["LOG_DATE"];
         } else {
             $arNotify["=LOG_DATE"] = $DB->CurrentTimeFunction();
         }
         if ($arLog["RATING_ENTITY_ID"] > 0) {
             $arNotify["RATING_ENTITY_ID"] = $arNotification["ID"];
             $arNotify["RATING_TYPE_ID"] = "BLOG_COMMENT";
         }
         if ($arNotification["ACTION"] == "ADD") {
             $LogCommentID = CSocNetLogComments::Add($arNotify, false, false);
             CSocNetLog::CounterIncrement($LogCommentID, false, false, "LC");
         } elseif ($arNotification["ACTION"] == "UPDATE") {
             $arLogComment = CSocNetLogComments::GetList(array("ID" => "DESC"), array("ENTITY_TYPE" => SONET_ENTITY_USER, "EVENT_ID" => "idea_comment", "SOURCE_ID" => $arNotification["ID"]), false, false, array("ID"))->Fetch();
             if ($arLogComment) {
                 unset($arNotify["USER_ID"]);
                 $LogCommentID = CSocNetLogComments::Update($arLogComment["ID"], $arNotify);
             }
         }
     }
     return $LogCommentID > 0;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:29,代码来源:idea_sonet_notify.php

示例8: AddCommentToLog

 public static function AddCommentToLog($arFields)
 {
     global $DB, $USER;
     CModule::IncludeModule("socialnetwork");
     $result = false;
     $dbLog = CSocNetLog::GetList(array(), array("SOURCE_ID" => $arFields["REPORT_ID"], "EVENT_ID" => "report"));
     if (!($arLog = $dbLog->Fetch())) {
         $LOG_ID = CReportNotifications::SendMessage($arFields["REPORT_ID"], false);
     } else {
         $LOG_ID = $arLog["ID"];
     }
     $arMessFields = array("EVENT_ID" => "report_comment", "ENTITY_ID" => $arFields["REPORT_OWNER"], "TEXT_MESSAGE" => $arFields["COMMENT_TEXT"], "MESSAGE" => $arFields["COMMENT_TEXT"], "USER_ID" => $arFields["USER_ID"], "ENTITY_TYPE" => "R", "LOG_ID" => $LOG_ID, "=LOG_DATE" => $DB->CurrentTimeFunction());
     $result = CSocNetLogComments::Add($arMessFields, true, false);
     CSocNetLog::CounterIncrement($result, false, false, "LC");
     $curUser = $USER->GetID();
     $dbLogRights = CSocNetLogRights::GetList(array(), array("LOG_ID" => $LOG_ID));
     while ($arRight = $dbLogRights->Fetch()) {
         $arRights[] = $arRight["GROUP_CODE"];
     }
     if (!in_array("U" . $curUser, $arRights)) {
         CSocNetLogRights::Add($LOG_ID, "U" . $curUser);
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:24,代码来源:timeman_report_full.php

示例9: CheckRequest

 function CheckRequest()
 {
     global $DB;
     $result = "";
     if (!CModule::IncludeModule("socialnetwork")) {
         return $result;
     }
     $current_time = time();
     $time_of_exec = false;
     $rsScheme = CXDILFScheme::GetList(array(), array("ACTIVE" => "Y", "AUTO" => "Y"));
     while (($arScheme = $rsScheme->Fetch()) && $time_of_exec === false) {
         if ($arScheme["LAST_EXECUTED"] == '') {
             continue;
         }
         $last_executed = MakeTimeStamp(ConvertDateTime($arScheme["LAST_EXECUTED"], "DD.MM.YYYY HH:MI:SS"), "DD.MM.YYYY HH:MI:SS");
         if ($last_executed <= 0) {
             continue;
         }
         $arEventTmp = CSocNetLogTools::FindLogEventByID($arScheme["EVENT_ID"]);
         if (array_key_exists("REAL_EVENT_ID", $arEventTmp) && strlen($arEventTmp["REAL_EVENT_ID"]) > 0) {
             $arScheme["EVENT_ID"] = $arEventTmp["REAL_EVENT_ID"];
         }
         //parse schedule
         $arDoM = CXDImport::ParseDaysOfMonth($arScheme["DAYS_OF_MONTH"]);
         $arDoW = CXDImport::ParseDaysOfWeek($arScheme["DAYS_OF_WEEK"]);
         $arToD = CXDImport::ParseTimesOfDay($arScheme["TIMES_OF_DAY"]);
         if ($arToD) {
             sort($arToD, SORT_NUMERIC);
         }
         $arSDate = localtime($last_executed);
         //sdate = truncate(last_execute)
         $sdate = mktime(0, 0, 0, $arSDate[4] + 1, $arSDate[3], $arSDate[5] + 1900);
         while ($sdate < $current_time && $time_of_exec === false) {
             $arSDate = localtime($sdate);
             if ($arSDate[6] == 0) {
                 $arSDate[6] = 7;
             }
             //determine if date is good for execution
             if ($arDoM) {
                 $flag = array_search($arSDate[3], $arDoM);
                 if ($arDoW) {
                     $flag = array_search($arSDate[6], $arDoW);
                 }
             } elseif ($arDoW) {
                 $flag = array_search($arSDate[6], $arDoW);
             } else {
                 $flag = false;
             }
             if ($flag !== false && $arToD) {
                 foreach ($arToD as $intToD) {
                     if ($sdate + $intToD > $last_executed && $sdate + $intToD <= $current_time) {
                         $time_of_exec = $sdate + $intToD;
                         break;
                     }
                 }
             }
             $sdate = mktime(0, 0, 0, date("m", $sdate), date("d", $sdate) + 1, date("Y", $sdate));
             //next day
         }
         if ($time_of_exec !== false) {
             if ($arScheme["TYPE"] == "XML") {
                 $arParams = array();
                 if (strlen($arScheme["PARAMS"]) > 0) {
                     $arTmp = explode("&", $arScheme["PARAMS"]);
                     if (is_array($arTmp) && count($arTmp) > 0) {
                         foreach ($arTmp as $pair) {
                             list($key, $value) = explode("=", $pair);
                             $arParams[$key] = $value;
                         }
                     }
                 }
                 $arResponse = CXDILFSchemeXML::Request($arScheme["HOST"], $arScheme["PAGE"], $arScheme["PORT"], $arScheme["METHOD"], "http://" . $arScheme["HOST"], $arScheme["LOGIN"], $arScheme["PASSWORD"], $arParams);
                 if ($arResponse && is_array($arResponse)) {
                     if (XDI_DEBUG) {
                         CXDImport::WriteToLog("Successful webservice response, scheme ID: " . $arScheme["ID"], "RXML");
                     }
                     $entityName = $arScheme["NAME"];
                     if ($arScheme["EVENT_ID"] == "news") {
                         $rsIBlock = CIBlock::GetList(array("ID" => "ASC"), array("ACTIVE" => "Y", "TYPE" => "news", "ID" => $arScheme["ENTITY_ID"]));
                         if ($arIBlock = $rsIBlock->Fetch()) {
                             $entityName = $arIBlock["NAME"];
                         }
                     }
                     $arLogParams = array("ENTITY_NAME" => $entityName, "ENTITY_URL" => $arResponse["URL"]);
                     $arSonetFields = array("SITE_ID" => $arScheme["LID"], "ENTITY_TYPE" => $arScheme["ENTITY_TYPE"], "ENTITY_ID" => $arScheme["ENTITY_ID"], "EVENT_ID" => $arScheme["EVENT_ID"], "ENABLE_COMMENTS" => $arScheme["ENABLE_COMMENTS"], "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE_TEMPLATE" => $arResponse["TITLE"], "TITLE" => $arResponse["TITLE"], "MESSAGE" => $arResponse["MESSAGE"], "TEXT_MESSAGE" => $arResponse["TEXT_MESSAGE"], "URL" => $arResponse["URL"], "PARAMS" => serialize($arLogParams), "MODULE_ID" => false, "CALLBACK_FUNC" => false);
                     $logID = CSocNetLog::Add($arSonetFields, false);
                     if (intval($logID) > 0) {
                         $arUpdateFields = array("TMP_ID" => $logID, "RATING_TYPE_ID" => "LOG_ENTRY", "RATING_ENTITY_ID" => $logID);
                         CSocNetLog::Update($logID, $arUpdateFields);
                         CXDILFScheme::SetSonetLogRights($logID, $arScheme["ENTITY_TYPE"], $arScheme["ENTITY_ID"], $arScheme["EVENT_ID"]);
                         CSocNetLog::CounterIncrement($logID);
                         if ($arScheme["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP && intval($arScheme["ENTITY_ID"]) > 0) {
                             $notify_title_tmp = str_replace(array("\r\n", "\n"), " ", $arScheme["NAME"]);
                             $notify_title = TruncateText($notify_title_tmp, 100);
                             $notify_title_out = TruncateText($notify_title_tmp, 255);
                             $arNotifyParams = array("LOG_ID" => $logID, "GROUP_ID" => intval($arScheme["ENTITY_ID"]), "NOTIFY_MESSAGE" => "", "URL" => "", "MESSAGE" => GetMessage("LFP_CLASS_SCHEME_IM_ADD", array("#title#" => $notify_title)), "MESSAGE_OUT" => GetMessage("LFP_CLASS_SCHEME_IM_ADD", array("#title#" => $notify_title_out)), "EXCLUDE_USERS" => array());
                             CSocNetSubscription::NotifyGroup($arNotifyParams);
                         }
                     }
                 } else {
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:lf_scheme.php

示例10: SocnetLogMessageAdd

 public static function SocnetLogMessageAdd($arParams, $arMessageFields, $action = "")
 {
     static $parser = null;
     if ($parser == null) {
         $parser = new forumTextParser();
     }
     $arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "LIST" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "SMILES" => "N", "UPLOAD" => "Y", "NL2BR" => "N", "TABLE" => "N", "ALIGN" => "N");
     //		$arParams["LOG_ID"], $arParams["LANG"] ....
     $arFieldsForSocnet = array("ENTITY_TYPE" => SONET_ENTITY_GROUP, "ENTITY_ID" => $arParams["ENTITY_ID"], "EVENT_ID" => "forum", "=LOG_DATE" => !!$arMessageFields["DATE_CREATE"] ? $arMessageFields["DATE_CREATE"] : $GLOBALS["DB"]->CurrentTimeFunction(), "LOG_UPDATE" => !!$arMessageFields["POST_DATE"] ? $arMessageFields["POST_DATE"] : null, "TITLE_TEMPLATE" => str_replace("#AUTHOR_NAME#", $arMessageFields["AUTHOR_NAME"], CForumEmail::GetLangMessage("FORUM_MAIL_SOCNET_TITLE_TOPIC", $arParams["LANG"])), "TITLE" => $arMessageFields["TITLE"], "MESSAGE" => $parser->convert($arMessageFields["POST_MESSAGE"], $arAllow), "TEXT_MESSAGE" => $parser->convert4mail($arMessageFields["POST_MESSAGE"]), "URL" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("UID" => $arMessageFields["AUTHOR_ID"], "FID" => $arMessageFields["FORUM_ID"], "TID" => $arMessageFields["TOPIC_ID"], "TITLE_SEO" => $arMessageFields["TOPIC_ID"], "MID" => $arMessageFields["ID"])), "PARAMS" => serialize(array("PATH_TO_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("TID" => $arMessageFields["TOPIC_ID"])))), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "SOURCE_ID" => $arMessageFields["ID"], "RATING_TYPE_ID" => "FORUM_TOPIC", "RATING_ENTITY_ID" => $arMessageFields["TOPIC_ID"]);
     if ($arMessageFields["AUTHOR_ID"] > 0) {
         $arFieldsForSocnet["USER_ID"] = $arMessageFields["AUTHOR_ID"];
     }
     $db_res = CForumFiles::GetList(array("ID" => "ASC"), array("MESSAGE_ID" => $arMessageFields["ID"]));
     $ufFileID = array();
     while ($res = $db_res->Fetch()) {
         $ufFileID[] = $res["FILE_ID"];
     }
     $ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $arMessageFields["ID"], LANGUAGE_ID);
     $logID = $arParams["LOG_ID"];
     if ($logID <= 0) {
         if (!empty($ufFileID)) {
             $arFieldsForSocnet["UF_SONET_LOG_FILE"] = $ufFileID;
         }
         if ($ufDocID) {
             $arFieldsForSocnet["UF_SONET_LOG_DOC"] = $ufDocID;
         }
         $logID = CSocNetLog::Add($arFieldsForSocnet, false);
         if (intval($logID) > 0) {
             CSocNetLog::Update($logID, array("TMP_ID" => $logID));
             CSocNetLogRights::SetForSonet($logID, $arFieldsForSocnet["ENTITY_TYPE"], $arFieldsForSocnet["ENTITY_ID"], "forum", "view", true);
             if ($action == "SEND_EVENT") {
                 CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
             }
         }
     }
     if ($logID > 0 && $action == "ADD_COMMENT") {
         if (!empty($ufFileID)) {
             $arFieldsForSocnet["UF_SONET_COM_FILE"] = $ufFileID;
         }
         if ($ufDocID) {
             $arFieldsForSocnet["UF_SONET_COM_DOC"] = $ufDocID;
         }
         $arFieldsForSocnet["LOG_ID"] = $logID;
         $arFieldsForSocnet["RATING_TYPE_ID"] = "FORUM_POST";
         $arFieldsForSocnet["RATING_ENTITY_ID"] = $arMessageFields["ID"];
         $commentID = CSocNetLogComments::Add($arFieldsForSocnet);
         CSocNetLog::CounterIncrement($commentID, false, false, "LC");
         return $commentID;
     }
     return $logID;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:51,代码来源:mail.php

示例11: GetModuleEvents

     $db_events = GetModuleEvents("socialnetwork", "OnAfterSocNetLogEntryCommentAdd");
     while ($arEvent = $db_events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array($arLog));
     }
     $db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetLogCommentCounterIncrement");
     while ($arEvent = $db_events->Fetch()) {
         if (ExecuteModuleEventEx($arEvent, array($arLog)) === false) {
             $bSkipCounterIncrement = true;
             break;
         }
     }
 } else {
     $bSkipCounterIncrement = true;
 }
 if (!$bSkipCounterIncrement) {
     CSocNetLog::CounterIncrement($commentIdres, false, false, "LC", CSocNetLogRights::CheckForUserAll($arLog["ID"]));
 }
 $arResult["commentID"] = $commentIdres;
 if ($arComment = CSocNetLogComments::GetByID($arResult["commentID"])) {
     if (intval($update_id) <= 0) {
         if (!empty($arCommentEvent) && !empty($arCommentEvent["METHOD_CANEDIT"]) && !empty($arComment["SOURCE_ID"]) && intval($arComment["SOURCE_ID"]) > 0 && !empty($arLog["SOURCE_ID"]) && intval($arLog["SOURCE_ID"]) > 0) {
             $canEdit = call_user_func($arCommentEvent["METHOD_CANEDIT"], array("LOG_SOURCE_ID" => $arLog["SOURCE_ID"], "COMMENT_SOURCE_ID" => $arComment["SOURCE_ID"]));
         } else {
             $canEdit = true;
         }
     }
     $arResult["hasEditCallback"] = $canEdit && is_array($arCommentEvent) && isset($arCommentEvent["UPDATE_CALLBACK"]) && ($arCommentEvent["UPDATE_CALLBACK"] == "NO_SOURCE" || is_callable($arCommentEvent["UPDATE_CALLBACK"])) ? "Y" : "N";
     $arResult["hasDeleteCallback"] = $canEdit && is_array($arCommentEvent) && isset($arCommentEvent["DELETE_CALLBACK"]) && ($arCommentEvent["DELETE_CALLBACK"] == "NO_SOURCE" || is_callable($arCommentEvent["DELETE_CALLBACK"])) ? "Y" : "N";
     if ($editCommentSourceID <= 0) {
         foreach (GetModuleEvents("socialnetwork", "OnAfterSonetLogEntryAddComment", true) as $arModuleEvent) {
             ExecuteModuleEventEx($arModuleEvent, array($arComment));
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:ajax.php

示例12: 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");
         }
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:60,代码来源:component.php

示例13: SocnetLogMessageAdd

 public function SocnetLogMessageAdd($ID, $arFields, $bUpdate = false)
 {
     $arForum = CForumNew::GetByID($this->forumID);
     $arMessage = CForumMessage::GetByIDEx($ID);
     if ($arMessage["TOPIC_ID"]) {
         $arTopic = CForumTopic::GetByID($arMessage["TOPIC_ID"]);
     }
     $arRes = $this->_getSocnetLogEntityByComment($arMessage);
     if ($arRes && intval($arRes["TMP_ID"]) > 0) {
         $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 (intval($arRes["COMMENTS_COUNT"]) == intval($arTopic["POSTS"])) {
             $url = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $arMessage["FORUM_ID"], "TID" => $arMessage["TOPIC_ID"], "MID" => $ID));
             $arFieldsForSocnet = array("ENTITY_TYPE" => $arRes["ENTITY_TYPE"], "ENTITY_ID" => $arRes["ENTITY_ID"], "EVENT_ID" => $this->event_comments_id, "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE" => $parser->convert($arMessage["POST_MESSAGE"], $arAllow), "TEXT_MESSAGE" => $parser->convert4mail($arMessage["POST_MESSAGE"]), "URL" => $url, "MODULE_ID" => false, "SOURCE_ID" => $ID, "LOG_ID" => $arRes["TMP_ID"], "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => intval($ID));
             if (intVal($arMessage["AUTHOR_ID"]) > 0) {
                 $arFieldsForSocnet["USER_ID"] = $arMessage["AUTHOR_ID"];
             }
             if ($bUpdate) {
                 $commentID = $this->_getSocnetLogCommentByForumComment($ID, $arRes);
                 if ($arMessage['APPROVED'] == 'Y') {
                     if ($commentID) {
                         CSocNetLogComments::Update($commentID, $arFieldsForSocnet);
                     } else {
                         $log_comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
                         //, true
                         CSocNetLog::CounterIncrement($log_comment_id, false, false, "LC");
                     }
                 } else {
                     if ($commentID) {
                         CSocNetLogComments::Delete($commentID);
                     }
                 }
             } else {
                 $log_comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
                 //, true
                 CSocNetLog::CounterIncrement($log_comment_id, false, false, "LC");
             }
         } else {
             $dbComments = CForumMessage::GetListEx(array(), array('TOPIC_ID' => $arMessage["TOPIC_ID"], "NEW_TOPIC" => "N"));
             while ($arComment = $dbComments->GetNext()) {
                 $url = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $arComment["FORUM_ID"], "TID" => $arComment["TOPIC_ID"], "MID" => $arComment["ID"]));
                 $arFieldsForSocnet = array("ENTITY_TYPE" => $arRes["ENTITY_TYPE"], "ENTITY_ID" => $arRes["ENTITY_ID"], "EVENT_ID" => $this->event_comments_id, "=LOG_DATE" => $GLOBALS["DB"]->CharToDateFunction($arComment['POST_DATE'], "FULL", SITE_ID), "MESSAGE" => $parser->convert($arComment["POST_MESSAGE"], $arAllow), "TEXT_MESSAGE" => $parser->convert4mail($arComment["POST_MESSAGE"]), "URL" => $url, "MODULE_ID" => false, "SOURCE_ID" => $arComment["ID"], "LOG_ID" => $arRes["TMP_ID"], "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => intval($arComment["ID"]));
                 if (intVal($arComment["AUTHOR_ID"]) > 0) {
                     $arFieldsForSocnet["USER_ID"] = $arComment["AUTHOR_ID"];
                 }
                 $log_comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
                 //, true
                 CSocNetLog::CounterIncrement($log_comment_id, false, false, "LC");
             }
         }
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:54,代码来源:iblocksocnetevent.php

示例14: IsModuleInstalled

         CSocNetLogComponent::checkEmptyUFValue('UF_SONET_COM_DOC');
         $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("SONET_COMMENT", $arFields);
         if (!empty($_POST["attachedFilesRaw"]) && is_array($_POST["attachedFilesRaw"])) {
             CSocNetLogComponent::saveRawFilesToUF($_POST["attachedFilesRaw"], IsModuleInstalled("webdav") || IsModuleInstalled("disk") ? "UF_SONET_COM_DOC" : "UF_SONET_COM_FILE", $arFields);
         }
         $comment = CSocNetLogComments::Update($editCommentID, $arFields, true);
     }
 } else {
     $arFields = array("ENTITY_TYPE" => $arLog["ENTITY_TYPE"], "ENTITY_ID" => $arLog["ENTITY_ID"], "EVENT_ID" => $arCommentEvent["EVENT_ID"], "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE" => $comment_text, "TEXT_MESSAGE" => $comment_text, "URL" => $source_url, "MODULE_ID" => false, "LOG_ID" => $arLog["ID"], "USER_ID" => $GLOBALS["USER"]->GetID(), "PATH_TO_USER_BLOG_POST" => $arParams["PATH_TO_USER_BLOG_POST"], "PATH_TO_GROUP_BLOG_POST" => $arParams["PATH_TO_GROUP_BLOG_POST"], "PATH_TO_USER_MICROBLOG_POST" => $arParams["PATH_TO_USER_MICROBLOG_POST"], "PATH_TO_GROUP_MICROBLOG_POST" => $arParams["PATH_TO_GROUP_MICROBLOG_POST"], "BLOG_ALLOW_POST_CODE" => $arParams["BLOG_ALLOW_POST_CODE"]);
     if ($arSaveResult) {
         $arFields[$ufCode] = array(isset($arFileStorage["DISC_FOLDER"]) ? "n" . $arSaveResult["ID"] : $arSaveResult["ID"]);
     }
     $GLOBALS[$ufCode] = $arFields[$ufCode];
     $comment = CSocNetLogComments::Add($arFields, true, false);
     unset($GLOBALS[$ufCode]);
     CSocNetLog::CounterIncrement($comment, false, false, "LC");
 }
 if (!is_array($comment) && intval($comment) > 0) {
     $arResult["SUCCESS"] = "Y";
     $arResult["commentID"] = $comment;
     $arResult["arCommentFormatted"] = __SLMAjaxGetComment($comment, $arParams);
     if ($arComment = CSocNetLogComments::GetByID($comment)) {
         $strAfter = "";
         $arResult["arCommentFormatted"]["SOURCE_ID"] = $arComment["SOURCE_ID"] > 0 ? $arComment["SOURCE_ID"] : $arComment["ID"];
         if (strlen($arComment["RATING_TYPE_ID"]) > 0 && intval($arComment["RATING_ENTITY_ID"]) > 0) {
             $arResult["arCommentFormatted"]["EVENT"]["RATING_TYPE_ID"] = $arComment["RATING_TYPE_ID"];
             $arResult["arCommentFormatted"]["EVENT"]["RATING_ENTITY_ID"] = $arComment["RATING_ENTITY_ID"];
             $arResult["arCommentFormatted"]["EVENT"]["RATING_USER_VOTE_VALUE"] = $arComment["RATING_USER_VOTE_VALUE"];
             $arResult["arCommentFormatted"]["EVENT"]["RATING_TOTAL_POSITIVE_VOTES"] = $arComment["RATING_TOTAL_POSITIVE_VOTES"];
         }
         $arComment["UF"] = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("SONET_COMMENT", $arComment["ID"], LANGUAGE_ID);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:ajax.php

示例15: AddCommentToLog

 function AddCommentToLog($arFields)
 {
     global $DB, $USER;
     CModule::IncludeModule("socialnetwork");
     $result = false;
     $LOG_ID = CTimeManNotify::SendMessage($arFields["ENTRY_ID"], 'A');
     $arMessFields = array("EVENT_ID" => "timeman_entry_comment", "ENTITY_ID" => $arFields["USER_ID"], "TEXT_MESSAGE" => $arFields["COMMENT_TEXT"], "MESSAGE" => $arFields["COMMENT_TEXT"], "USER_ID" => $arFields["USER_ID"], "ENTITY_TYPE" => SONET_TIMEMAN_ENTRY_ENTITY, "LOG_ID" => $LOG_ID, "=LOG_DATE" => $DB->CurrentTimeFunction());
     $result = CSocNetLogComments::Add($arMessFields, true, false);
     CSocNetLog::CounterIncrement($result, false, false, "LC");
     $curUser = $USER->GetID();
     $dbLogRights = CSocNetLogRights::GetList(array(), array("LOG_ID" => $LOG_ID));
     while ($arRight = $dbLogRights->Fetch()) {
         $arRights[] = $arRight["GROUP_CODE"];
     }
     if (!in_array("U" . $curUser, $arRights)) {
         CSocNetLogRights::Add($LOG_ID, "U" . $curUser);
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:19,代码来源:timeman_notify.php


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