本文整理汇总了PHP中CSocNetLogComments::Add方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogComments::Add方法的具体用法?PHP CSocNetLogComments::Add怎么用?PHP CSocNetLogComments::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetLogComments
的用法示例。
在下文中一共展示了CSocNetLogComments::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __deprecated_Add
/**
* WARNING! This method is transitional and can be changed without
* any notifications! Don't use it.
*
* @deprecated
*/
public static function __deprecated_Add($commentText, $forumTopicId, $forumId, $nameTemplate, $arTask, $permissions, $commentId, $givenUserId, $imageWidth, $imageHeight, $arSmiles, $arForum, $messagesPerPage, $arUserGroupArray, $backPage, $strMsgAddComment, $strMsgEditComment, $strMsgNewTask, $componentName, &$outForumTopicId, &$arErrorCodes, &$outStrUrl, $arFieldsAdditional)
{
global $DB;
if (is_array($arTask)) {
if (!array_key_exists('~TITLE', $arTask)) {
$arTmpTask = $arTask;
foreach ($arTmpTask as $key => $value) {
if (substr($key, 0, 1) !== '~') {
$arTask['~' . $key] = $arTmpTask[$key];
}
}
}
}
$MID = 0;
$TID = 0;
if ($forumTopicId > 0 && CForumTopic::GetByID($forumTopicId) === false) {
$forumTopicId = false;
}
if ($forumTopicId <= 0) {
$arUserStart = array("ID" => intVal($arTask["CREATED_BY"]), "NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"]);
if ($arUserStart["ID"] > 0) {
$res = array();
$db_res = CForumUser::GetListEx(array(), array("USER_ID" => $arTask["CREATED_BY"]));
if ($db_res && ($res = $db_res->Fetch())) {
$res["FORUM_USER_ID"] = intVal($res["ID"]);
$res["ID"] = $res["USER_ID"];
} else {
$db_res = CUser::GetByID($arTask["CREATED_BY"]);
if ($db_res && ($res = $db_res->Fetch())) {
$res["SHOW_NAME"] = COption::GetOptionString("forum", "USER_SHOW_NAME", "Y");
$res["USER_PROFILE"] = "N";
}
}
if (!empty($res)) {
$arUserStart = $res;
$sName = $res["SHOW_NAME"] == "Y" ? trim(CUser::FormatName($nameTemplate, $res)) : "";
$arUserStart["NAME"] = empty($sName) ? trim($res["LOGIN"]) : $sName;
}
}
$arUserStart["NAME"] = empty($arUserStart["NAME"]) ? $GLOBALS["FORUM_STATUS_NAME"]["guest"] : $arUserStart["NAME"];
$DB->StartTransaction();
$arFields = array("TITLE" => $arTask["~TITLE"], "FORUM_ID" => $forumId, "USER_START_ID" => $arUserStart["ID"], "USER_START_NAME" => $arUserStart["NAME"], "LAST_POSTER_NAME" => $arUserStart["NAME"], "APPROVED" => "Y", "PERMISSION_EXTERNAL" => $permissions, "PERMISSION" => $permissions, "NAME_TEMPLATE" => $nameTemplate, 'XML_ID' => 'TASK_' . $arTask['ID']);
$TID = CForumTopic::Add($arFields);
if (intVal($TID) <= 0) {
$arErrorCodes[] = array('code' => 'topic is not created');
} else {
$arFields = array("FORUM_TOPIC_ID" => $TID);
$task = new CTasks();
$task->Update($arTask["ID"], $arFields);
}
if (!empty($arErrorCodes)) {
$DB->Rollback();
return false;
} else {
$DB->Commit();
}
}
$arFieldsG = array("POST_MESSAGE" => $commentText, "AUTHOR_NAME" => '', "AUTHOR_EMAIL" => $GLOBALS['USER']->GetEmail(), "USE_SMILES" => NULL, "PARAM2" => $arTask['ID'], "TITLE" => $arTask["~TITLE"], "PERMISSION_EXTERNAL" => $permissions, "PERMISSION" => $permissions);
// UF_* forwarding
if (is_array($arFieldsAdditional)) {
foreach ($arFieldsAdditional as $field => $value) {
if (strlen($field) && substr($field, 0, 3) == 'UF_') {
$arFieldsG[$field] = $value;
$GLOBALS[$field] = $value;
// strange behaviour required for ForumMessageAdd() to handle UF_* properly
}
}
}
if (!empty($_FILES["REVIEW_ATTACH_IMG"])) {
$arFieldsG["ATTACH_IMG"] = $_FILES["REVIEW_ATTACH_IMG"];
} else {
$arFiles = array();
if (!empty($_REQUEST["FILES"])) {
foreach ($_REQUEST["FILES"] as $key) {
$arFiles[$key] = array("FILE_ID" => $key);
if (!in_array($key, $_REQUEST["FILES_TO_UPLOAD"])) {
$arFiles[$key]["del"] = "Y";
}
}
}
if (!empty($_FILES)) {
$res = array();
foreach ($_FILES as $key => $val) {
if (substr($key, 0, strLen("FILE_NEW")) == "FILE_NEW" && !empty($val["name"])) {
$arFiles[] = $_FILES[$key];
}
}
}
if (!empty($arFiles)) {
$arFieldsG["FILES"] = $arFiles;
}
}
$TOPIC_ID = $forumTopicId > 0 ? $forumTopicId : $TID;
$MESSAGE_ID = 0;
//.........这里部分代码省略.........
示例2: OnAfterPhotoCommentAddBlog
public function OnAfterPhotoCommentAddBlog($ID, $arFields)
{
if (!CModule::IncludeModule('iblock')) {
return;
}
if (!$this->IsSocnet) {
return;
}
if (intval($this->PhotoElementID) > 0) {
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "photo_photo", "SOURCE_ID" => $this->PhotoElementID), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID", "TMP_ID", "TITLE", "URL", "USER_ID", "PARAMS"));
$bSocNetLogRecordExists = false;
if ($arRes = $dbRes->Fetch()) {
$log_id = $arRes["ID"];
$entity_type = $arRes["ENTITY_TYPE"];
$entity_id = $arRes["ENTITY_ID"];
$log_title = $arRes["TITLE"];
$log_url = $arRes["URL"];
$log_user_id = $arRes["USER_ID"];
$bSocNetLogRecordExists = true;
if (strlen($arRes["PARAMS"]) > 0) {
$arTmp = unserialize($arRes["PARAMS"]);
if ($arTmp) {
if (array_key_exists("SECTION_NAME", $arTmp) && strlen($arTmp["SECTION_NAME"]) > 0) {
$log_section_name = $arTmp["SECTION_NAME"];
}
if (array_key_exists("SECTION_URL", $arTmp) && strlen($arTmp["SECTION_URL"]) > 0) {
$log_section_url = $arTmp["SECTION_URL"];
}
}
}
} else {
$rsElement = CIBlockElement::GetByID($this->PhotoElementID);
if ($arElement = $rsElement->Fetch()) {
$url = $this->arPath["DETAIL_URL"];
$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);
//.........这里部分代码省略.........
示例3: while
while ($arAddedMessageFiles = $dbAddedMessageFiles->Fetch()) {
$ufFileID[] = $arAddedMessageFiles["FILE_ID"];
}
if (count($ufFileID) > 0) {
$arFieldsForSocnet["UF_SONET_COM_FILE"] = $ufFileID;
} else {
unset($arFieldsForSocnet["UF_SONET_COM_FILE"]);
}
$ufDocID = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MESSAGE_DOC", $arComment["ID"], LANGUAGE_ID);
if ($ufDocID) {
$arFieldsForSocnet["UF_SONET_COM_DOC"] = $ufDocID;
} else {
unset($arFieldsForSocnet["UF_SONET_COM_DOC"]);
}
$arSocLog = array("=LOG_DATE" => $DB->CharToDateFunction($arComment['POST_DATE'], "FULL", SITE_ID), "MESSAGE" => $arComment['POST_MESSAGE'], "TEXT_MESSAGE" => $parser->convert4mail($arComment['POST_MESSAGE']), "SOURCE_ID" => intval($arComment["ID"]), "RATING_ENTITY_ID" => intval($arComment["ID"])) + (!!$arComment['AUTHOR_ID'] ? array("USER_ID" => $arComment["AUTHOR_ID"]) : array());
$log_comment_id = CSocNetLogComments::Add(array_merge($arFieldsForSocnet, $arSocLog), false, false);
CSocNetLog::CounterIncrement($log_comment_id, false, false, "LC");
} while ($arComment = $dbComments->Fetch());
}
}
}
}
}
$res = $arParams["MID"];
}
if (!$res) {
$bVarsFromForm = true;
} else {
$arNote = array("code" => $action, "title" => $strOKMessage, "link" => $url);
}
$arResult['RESULT'] = $res;
示例4: array
$log_id = CBlogPost::Notify($arPost, $arBlog, $arParamsNotify);
}
if (intval($log_id) > 0) {
$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");
$text4message = $parserBlog->convert($_POST['comment'], false, $arImages, $arAllow, array("isSonetLog" => true));
$text4mail = $parserBlog->convert4mail($_POST['comment'], $arImages);
$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;
}
CSocNetLogComments::Add($arFieldsForSocnet);
}
$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\\]/ies" . BX_UTF_PCRE_MODIFIER, $_POST['comment'], $arMention);
$arFieldsIM = array("TYPE" => "COMMENT", "TITLE" => $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(), "AUTHOR_ID" => $arPost["AUTHOR_ID"]);
//if(!empty($arMentionOld))
// $arFieldsIM["MENTION_ID_OLD"] = $arMentionOld[1];
if (!empty($arMention)) {
$arFieldsIM["MENTION_ID"] = $arMention[1];
}
示例5: __deprecated_Add
/**
* WARNING! This method is transitional and can be changed without
* any notifications! Don't use it.
*
* @deprecated
*/
public static function __deprecated_Add($commentText, $forumTopicId, $forumId, $nameTemplate, $arTask, $permissions, $commentId, $givenUserId, $imageWidth, $imageHeight, $arSmiles, $arForum, $messagesPerPage, $arUserGroupArray, $backPage, $strMsgAddComment, $strMsgEditComment, $strMsgNewTask, $componentName, &$outForumTopicId, &$arErrorCodes, &$outStrUrl, $arFieldsAdditional = array())
{
global $DB;
if (is_array($arTask)) {
if (!array_key_exists('~TITLE', $arTask)) {
$arTmpTask = $arTask;
foreach ($arTmpTask as $key => $value) {
if (substr($key, 0, 1) !== '~') {
$arTask['~' . $key] = $arTmpTask[$key];
}
}
}
}
$MID = 0;
$TID = 0;
if ($forumTopicId > 0 && CForumTopic::GetByID($forumTopicId) === false) {
$forumTopicId = false;
}
if ($forumTopicId <= 0) {
$arUserStart = array("ID" => intVal($arTask["CREATED_BY"]), "NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"]);
if ($arUserStart["ID"] > 0) {
$res = array();
$db_res = CForumUser::GetListEx(array(), array("USER_ID" => $arTask["CREATED_BY"]));
if ($db_res && ($res = $db_res->Fetch())) {
$res["FORUM_USER_ID"] = intVal($res["ID"]);
$res["ID"] = $res["USER_ID"];
} else {
$db_res = CUser::GetByID($arTask["CREATED_BY"]);
if ($db_res && ($res = $db_res->Fetch())) {
$res["SHOW_NAME"] = COption::GetOptionString("forum", "USER_SHOW_NAME", "Y");
$res["USER_PROFILE"] = "N";
}
}
if (!empty($res)) {
$arUserStart = $res;
$sName = $res["SHOW_NAME"] == "Y" ? trim(CUser::FormatName($nameTemplate, $res)) : "";
$arUserStart["NAME"] = empty($sName) ? trim($res["LOGIN"]) : $sName;
}
}
$arUserStart["NAME"] = empty($arUserStart["NAME"]) ? $GLOBALS["FORUM_STATUS_NAME"]["guest"] : $arUserStart["NAME"];
$DB->StartTransaction();
$arFields = array("TITLE" => $arTask["~TITLE"], "FORUM_ID" => $forumId, "USER_START_ID" => $arUserStart["ID"], "USER_START_NAME" => $arUserStart["NAME"], "LAST_POSTER_NAME" => $arUserStart["NAME"], "APPROVED" => "Y", "PERMISSION_EXTERNAL" => $permissions, "PERMISSION" => $permissions, "NAME_TEMPLATE" => $nameTemplate, 'XML_ID' => 'TASK_' . $arTask['ID']);
$TID = CForumTopic::Add($arFields);
if (intVal($TID) <= 0) {
$arErrorCodes[] = array('code' => 'topic is not created');
} else {
$arFields = array("FORUM_TOPIC_ID" => $TID);
$task = new CTasks();
$task->Update($arTask["ID"], $arFields);
}
if (!empty($arErrorCodes)) {
$DB->Rollback();
return false;
} else {
$DB->Commit();
}
}
$arFieldsG = array("POST_MESSAGE" => $commentText, "AUTHOR_NAME" => '', "AUTHOR_EMAIL" => $GLOBALS['USER']->GetEmail(), "USE_SMILES" => NULL, "PARAM2" => $arTask['ID'], "TITLE" => $arTask["~TITLE"], "PERMISSION_EXTERNAL" => $permissions, "PERMISSION" => $permissions);
// UF_* forwarding
if (is_array($arFieldsAdditional)) {
foreach ($arFieldsAdditional as $field => $value) {
if (strlen($field) && substr($field, 0, 3) == 'UF_') {
$arFieldsG[$field] = $value;
$GLOBALS[$field] = $value;
// strange behaviour required for ForumMessageAdd() to handle UF_* properly
}
}
}
if (!empty($_FILES["REVIEW_ATTACH_IMG"])) {
$arFieldsG["ATTACH_IMG"] = $_FILES["REVIEW_ATTACH_IMG"];
} else {
$arFiles = array();
if (!empty($_REQUEST["FILES"])) {
foreach ($_REQUEST["FILES"] as $key) {
$arFiles[$key] = array("FILE_ID" => $key);
if (!in_array($key, $_REQUEST["FILES_TO_UPLOAD"])) {
$arFiles[$key]["del"] = "Y";
}
}
}
if (!empty($_FILES)) {
$res = array();
foreach ($_FILES as $key => $val) {
if (substr($key, 0, strLen("FILE_NEW")) == "FILE_NEW" && !empty($val["name"])) {
$arFiles[] = $_FILES[$key];
}
}
}
if (!empty($arFiles)) {
$arFieldsG["FILES"] = $arFiles;
}
}
$TOPIC_ID = $forumTopicId > 0 ? $forumTopicId : $TID;
$MESSAGE_ID = 0;
//.........这里部分代码省略.........
示例6: onAfterMessageAdd
function onAfterMessageAdd($ID, $arFields)
{
$bSocNetLogRecordExists = false;
// add log comment
if ((!array_key_exists('PARAM1', $arFields) || $arFields['PARAM1'] != 'IB') && array_key_exists('PARAM2', $arFields) && intval($arFields['PARAM2']) > 0) {
$dbRes = CSocNetLog::GetList(array('ID' => 'DESC'), array("EVENT_ID" => "wiki", "SOURCE_ID" => $arFields["PARAM2"]), false, false, array('ID', 'ENTITY_TYPE', 'ENTITY_ID', 'TMP_ID', 'URL'));
if ($arRes = $dbRes->Fetch()) {
$log_id = $arRes['TMP_ID'];
$url = $arRes['URL'];
$bSocNetLogRecordExists = true;
} else {
$rsElement = CIBlockElement::GetByID($arFields['PARAM2']);
if ($arElement = $rsElement->Fetch()) {
$arWikiElement = CWiki::GetElementById($arElement['ID'], array('IBLOCK_ID' => $arElement['IBLOCK_ID']));
$CWikiParser = new CWikiParser();
$parserLog = new logTextParser();
$arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N", "TABLE" => "N");
$text4message = $CWikiParser->Parse($arElement['DETAIL_TEXT'], $arElement['DETAIL_TEXT_TYPE'], $arWikiElement['IMAGES']);
$text4message = preg_replace("#<br[\\s]*\\/>#is", "#BR#", $text4message);
$text4message = htmlspecialcharsback($parserLog->convert($text4message, array(), $arAllow));
$text4message = preg_replace("#\\#BR\\##is", "\n", $text4message);
$text4message = $CWikiParser->Clear($text4message);
$url = str_replace(array('#group_id#', '#wiki_name#'), array(intval($this->SonetGroupID), urlencode($arElement['NAME'])), $this->arPath['PATH_TO_POST']);
$arSoFields = array('ENTITY_TYPE' => SONET_SUBSCRIBE_ENTITY_GROUP, 'IS_CUSTOM_ET' => 'N', 'ENTITY_ID' => intval($this->SonetGroupID), 'EVENT_ID' => 'wiki', 'USER_ID' => $arElement['CREATED_BY'], 'LOG_DATE' => $arElement['DATE_CREATE'], 'LOG_UPDATE' => $arElement['DATE_CREATE'], 'TITLE_TEMPLATE' => GetMessage('WIKI_SONET_LOG_TITLE_TEMPLATE'), 'TITLE' => $arElement['NAME'], 'MESSAGE' => $text4message, 'TEXT_MESSAGE' => '', 'MODULE_ID' => 'wiki', 'URL' => $url, 'CALLBACK_FUNC' => false, 'SOURCE_ID' => $arFields['PARAM2'], 'PARAMS' => 'forum_id=' . $this->ForumID, 'RATING_TYPE_ID' => 'IBLOCK_ELEMENT', 'RATING_ENTITY_ID' => intval($arFields['PARAM2']));
$log_id = CSocNetLog::Add($arSoFields, false);
if (intval($log_id) > 0) {
CSocNetLog::Update($log_id, array("TMP_ID" => $log_id));
CSocNetLogRights::SetForSonet($log_id, SONET_SUBSCRIBE_ENTITY_GROUP, intval($this->SonetGroupID), "wiki", "view", true);
}
}
}
if (intval($log_id) > 0) {
$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");
$sAuthorForMail = str_replace('#TITLE#', $arMessage['AUTHOR_NAME'], GetMessage('SONET_FORUM_LOG_TEMPLATE_GUEST'));
if ($bSocNetLogRecordExists) {
$arMessage = CForumMessage::GetByIDEx($ID);
$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']->CurrentTimeFunction(), 'MESSAGE' => $parser->convert($arMessage['POST_MESSAGE'], $arAllow), 'TEXT_MESSAGE' => $parser->convert4mail($arMessage['POST_MESSAGE'] . $sAuthorForMail), 'URL' => $url, 'MODULE_ID' => false, 'SOURCE_ID' => $ID, 'LOG_ID' => $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'];
}
CSocNetLogComments::Add($arFieldsForSocnet);
} else {
$dbMessage = CForumMessage::GetListEx(array(), array('TOPIC_ID' => $arFields["TOPIC_ID"], "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' => $url, 'MODULE_ID' => false, 'SOURCE_ID' => $ID, 'LOG_ID' => $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'];
}
CSocNetLogComments::Add($arFieldsForSocnet);
}
}
}
}
}
示例7: 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");
}
}
示例8: 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");
}
}
}
示例9: array
CSocNetLogRights::SetForSonet($log_id, $arParams["MODE"] == "GROUP" ? SONET_ENTITY_GROUP : SONET_ENTITY_USER, $arParams["MODE"] == "GROUP" ? $arParams["SOCNET_GROUP_ID"] : $arParams["USER_ID"], "forum", "view");
}
}
if (intval($log_id) > 0) {
$arFieldsForSocnet = array("ENTITY_TYPE" => $arParams["MODE"] == "GROUP" ? SONET_ENTITY_GROUP : SONET_ENTITY_USER, "ENTITY_ID" => $arParams["MODE"] == "GROUP" ? $arParams["SOCNET_GROUP_ID"] : $arParams["USER_ID"], "EVENT_ID" => "forum", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE" => $sText, "TEXT_MESSAGE" => $parser->convert4mail($sText), "URL" => str_replace("#result#", $arParams["MID"], $url), "MODULE_ID" => false, "SOURCE_ID" => $arParams["MID"], "LOG_ID" => $log_id, "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => intval($arParams["MID"]));
if ($bSocNetLogRecordExists) {
if (intVal($arResult["MESSAGE"]["AUTHOR_ID"]) > 0) {
$arFieldsForSocnet["USER_ID"] = $arResult["MESSAGE"]["AUTHOR_ID"];
}
CSocNetLogComments::Add($arFieldsForSocnet);
} else {
$dbComments = CForumMessage::GetListEx(array("ID" => "ASC"), array('TOPIC_ID' => $arParams["TID"], "NEW_TOPIC" => "N"));
if ($dbComments && ($arComment = $dbComments->Fetch())) {
do {
$arSocLog = array("=LOG_DATE" => $DB->CharToDateFunction($arComment['POST_DATE'], "FULL", SITE_ID), "MESSAGE" => $arComment['POST_MESSAGE'], "TEXT_MESSAGE" => $parser->convert4mail($arComment['POST_MESSAGE']), "SOURCE_ID" => intval($arComment["ID"]), "RATING_ENTITY_ID" => intval($arComment["ID"])) + (!!$arComment['AUTHOR_ID'] ? array("USER_ID" => $arComment["ID"]) : array());
CSocNetLogComments::Add(array_merge($arFieldsForSocnet, $arSocLog));
} while ($arComment = $dbComments->Fetch());
}
}
}
}
}
$res = $arParams["MID"];
}
if (!$res) {
$bVarsFromForm = true;
} else {
$arNote = array("code" => $action, "title" => $strOKMessage, "link" => $url);
}
$arResult['RESULT'] = $res;
if (isset($_REQUEST['AJAX_CALL']) && in_array($action, array('SHOW', 'HIDE', 'DEL'))) {
示例10: 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");
}
}
}
}
示例11: while
while ($arLog = $dbLog->Fetch()) {
$arLogComments[] = $arLog;
}
foreach ($arLogComments as $arLogComment) {
if (intval($arLogComment["SOURCE_ID"]) > 0) {
$log_tmp_id = false;
$arBlogComment = CBlogComment::GetByID($arLogComment["SOURCE_ID"]);
if ($arBlogComment) {
$dbLog = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "blog_post", "SOURCE_ID" => $arBlogComment["POST_ID"]), false, array("nTopCount" => 1), array("ID", "TMP_ID"));
if ($arLog = $dbLog->Fetch()) {
$log_tmp_id = $arLog["TMP_ID"];
}
}
if (intval($log_tmp_id) > 0) {
$arFields = array("ENTITY_TYPE" => $arLogComment["ENTITY_TYPE"], "ENTITY_ID" => $arLogComment["ENTITY_ID"], "EVENT_ID" => "blog_comment", "LOG_DATE" => $arLogComment["LOG_DATE"], "MESSAGE" => $arLogComment["MESSAGE"], "TEXT_MESSAGE" => $arLogComment["TEXT_MESSAGE"], "URL" => $arLogComment["URL"], "MODULE_ID" => false, "SOURCE_ID" => $arLogComment["SOURCE_ID"], "LOG_ID" => $log_tmp_id, "USER_ID" => $arLogComment["USER_ID"]);
CSocNetLogComments::Add($arFields, false, false, false);
CSocNetLog::Delete($arLogComment["ID"]);
}
}
}
}
$dbLog = CSocNetLog::GetList(array("LOG_DATE" => "ASC"), array("COMMENTS_COUNT" => false), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID", "LOG_DATE", "MESSAGE", "TEXT_MESSAGE", "URL", "SOURCE_ID", "USER_ID"));
while ($arLog = $dbLog->Fetch()) {
CSocNetLog::Update($arLog["ID"], array("LOG_UPDATE" => $arLog["LOG_DATE"]));
}
if (IsModuleInstalled("intranet")) {
$dbResult = CSocNetEventUserView::GetList(array("ENTITY_ID" => "ASC"), array("ENTITY_TYPE" => "N"));
$arResult = $dbResult->Fetch();
if (!$arResult) {
CSocNetEventUserView::Add(array("ENTITY_TYPE" => "N", "ENTITY_ID" => 0, "EVENT_ID" => "news", "USER_ID" => 0, "USER_ANONYMOUS" => "N"));
CSocNetEventUserView::Add(array("ENTITY_TYPE" => "N", "ENTITY_ID" => 0, "EVENT_ID" => "news_comment", "USER_ID" => 0, "USER_ANONYMOUS" => "N"));
示例12: array
CSocNetLog::Update($logID, array("TMP_ID" => $logID));
CSocNetLogRights::DeleteByLogID($logID);
CSocNetLogRights::Add($logID, $socnetPerms);
}
}
foreach ($categoryID as $v) {
CBlogPostCategory::Add(array("BLOG_ID" => $blogID, "POST_ID" => $postID, "CATEGORY_ID" => $v));
}
$arBlogCommentFields = array("TITLE" => GetMessage("BLOG_DEMO_COMMENT_TITLE"), "POST_TEXT" => GetMessage("BLOG_DEMO_COMMENT_BODY"), "BLOG_ID" => $blogID, "POST_ID" => $postID, "PARENT_ID" => 0, "AUTHOR_ID" => 1, "DATE_CREATE" => ConvertTimeStamp(false, "FULL"), "AUTHOR_IP" => "192.168.0.108");
$commmentId = CBlogComment::Add($arBlogCommentFields);
if (CModule::IncludeModule("socialnetwork")) {
$arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N");
$text4message = $parserBlog->convert($arBlogCommentFields["POST_TEXT"], false, array(), $arAllow);
$text4mail = $parserBlog->convert4mail($arBlogCommentFields["POST_TEXT"]);
$arBlogUser = CBlogUser::GetByID(1, BLOG_BY_USER_ID);
$arBlogUser = CBlogTools::htmlspecialcharsExArray($arBlogUser);
$AuthorName = CBlogUser::GetUserName($arBlogUser["~ALIAS"], $arUser["~NAME"], $arUser["~LAST_NAME"], $arUser["~LOGIN"]);
$commentUrl = CComponentEngine::MakePathFromTemplate(WIZARD_SITE_DIR . "company/personal/user/#user_id#/blog/#post_id#/", array("post_id" => $postID, "user_id" => 1));
if (strpos($commentUrl, "?") !== false) {
$commentUrl .= "&";
} else {
$commentUrl .= "?";
}
$commentUrl .= "commentId=" . $commmentId . "#" . $commmentId;
$arSoFields = array("ENTITY_TYPE" => "U", "ENTITY_ID" => 1, "EVENT_ID" => "blog_comment", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE" => $text4message, "TEXT_MESSAGE" => $text4mail, "URL" => $commentUrl, "MODULE_ID" => false, "SOURCE_ID" => $commmentId, "USER_ID" => 1, "LOG_ID" => $logID, "RATING_TYPE_ID" => "BLOG_COMMENT", "RATING_ENTITY_ID" => intval($commmentId));
CSocNetLogComments::Add($arSoFields);
}
//CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH."/community/index.php", Array("SONET_GROUP_ID" => $SocNetGroupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/company/personal.php", array("BLOG_GROUP_ID" => $SocNetGroupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/index_b24.php", array("BLOG_GROUP_ID" => $SocNetGroupID));
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/workgroups/index.php", array("BLOG_GROUP_ID" => $SocNetGroupID));
示例13: array
$log_id = CBlogPost::Notify($arPost, $arBlog, $arParamsNotify);
}
$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();
示例14: array
$update_id = $arRes["ID"];
$update_log_id = $arRes["LOG_ID"];
$update_user_id = $arRes["USER_ID"];
$update_source_id = $arRes["SOURCE_ID"];
}
}
if (intval($update_id) > 0) {
$bAllowUpdate = CSocNetLogComponent::canUserChangeComment(array("ACTION" => "EDIT", "LOG_ID" => $update_log_id, "LOG_EVENT_ID" => $arLog["EVENT_ID"], "LOG_SOURCE_ID" => $arLog["SOURCE_ID"], "COMMENT_ID" => $update_id, "COMMENT_USER_ID" => $update_user_id));
}
if ($bAllowUpdate) {
$commentIdres = CSocNetLogComments::Update($update_id, $arFields, true);
} else {
$commentIdres = array("MESSAGE" => GetMessage("SONET_LOG_COMMENT_NO_PERMISSIONS_UPDATE"));
}
} else {
$commentIdres = CSocNetLogComments::Add($arFields, true, false);
}
if (!is_array($commentIdres) && intval($commentIdres) > 0) {
if ($editCommentSourceID <= 0) {
$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 {
示例15: AddComment
private function AddComment()
{
global $DB;
$arNotification = $this->Notify->getNotification();
$arLog = CSocNetLog::GetList(
array("ID" => "DESC"),
array("SOURCE_ID" => $arNotification["POST_ID"]),
false,
false,
array("ID", "RATING_ENTITY_ID")
)->Fetch();
if($arLog)
{
$arNotify = Array(
"EVENT_ID" => "idea_comment",
"=LOG_DATE" => $DB->CurrentTimeFunction(),
"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($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);
elseif($arNotification["ACTION"] == "UPDATE")
{
$arLogComment = CSocNetLogComments::GetList(
array("ID" => "DESC"),
array("SOURCE_ID" => $arNotification["ID"]),
false,
false,
array("ID")
)->Fetch();
if($arLogComment)
$LogCommentID = CSocNetLogComments::Update($arLogComment["ID"], $arNotify);
}
}
return $LogCommentID>0;
}