本文整理汇总了PHP中CSocNetLogComments::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogComments::Update方法的具体用法?PHP CSocNetLogComments::Update怎么用?PHP CSocNetLogComments::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetLogComments
的用法示例。
在下文中一共展示了CSocNetLogComments::Update方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnAfterSocNetLogCommentAdd
public static function OnAfterSocNetLogCommentAdd($ID, $arFields)
{
if (!IsModuleInstalled('bitrix24')) {
if ($arFields['ENTITY_TYPE'] == SONET_INTRANET_NEW_USER_ENTITY && $arFields['EVENT_ID'] == SONET_INTRANET_NEW_USER_COMMENT_EVENT_ID) {
$arUpdateFields = array('RATING_TYPE_ID' => 'INTRANET_NEW_USER_COMMENT', 'RATING_ENTITY_ID' => $ID);
CSocNetLogComments::Update($ID, $arUpdateFields);
}
}
}
示例2: UpdateLog
public static function UpdateLog($commentID, $arBlogUser, $arUser, $arComment, $arPost, $arParams)
{
if (!CModule::IncludeModule('socialnetwork'))
return;
$AuthorName = CBlogUser::GetUserName($arBlogUser["~ALIAS"], $arUser["~NAME"], $arUser["~LAST_NAME"], $arUser["~LOGIN"], $arUser["~SECOND_NAME"]);
$parserBlog = new blogTextParser(false, $arParams["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");
$text4message = $parserBlog->convert($arComment["POST_TEXT"], false, $arParams["IMAGES"], $arAllow, array("isSonetLog"=>true));
$text4mail = $parserBlog->convert4mail($arComment["POST_TEXT"], $arParams["IMAGES"]);
$arSoFields = Array(
"TITLE_TEMPLATE" => htmlspecialcharsback($AuthorName)." ".GetMessage("BLG_SONET_COMMENT_TITLE"),
"TITLE" => $arPost['~TITLE'],
"MESSAGE" => $text4message,
"TEXT_MESSAGE" => $text4mail
);
$dbRes = CSocNetLogComments::GetList(
array("ID" => "DESC"),
array(
"EVENT_ID" => array("blog_comment", "blog_comment_micro"),
"SOURCE_ID" => $commentID
),
false,
false,
array("ID")
);
while ($arRes = $dbRes->Fetch())
CSocNetLogComments::Update($arRes["ID"], $arSoFields);
}
示例3: elseif
CSocNetLogRights::SetForSonet($logID, $arSonetFields["ENTITY_TYPE"], $arSonetFields["ENTITY_ID"], "forum", "view", true);
CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
}
} elseif ($arParams["MESSAGE_TYPE"] == "EDIT") {
$dbRes = CSocNetLog::GetList(array(), array("EVENT_ID" => "forum", "SOURCE_ID" => $MID1), false, false, array("ID"));
if ($arRes = $dbRes->Fetch()) {
// topic
$arSonetFields = array_intersect_key($arSonetFields, array_flip(array("TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "PARAMS")));
CSocNetLog::Update($arRes["ID"], $arSonetFields);
CSocNetLogRights::SetForSonet($arRes["ID"], $arParams["MODE"] == "GROUP" ? SONET_ENTITY_GROUP : SONET_ENTITY_USER, $arParams["MODE"] == "GROUP" ? $arParams["SOCNET_GROUP_ID"] : $arParams["USER_ID"], "forum", "view");
} else {
$dbRes = CSocNetLogComments::GetList(array(), array("EVENT_ID" => "forum", "SOURCE_ID" => $MID1), false, false, array("ID"));
if ($arRes = $dbRes->Fetch()) {
// message/comment
$arSonetFields = array_intersect_key($arSonetFields, array_flip(array("MESSAGE", "TEXT_MESSAGE", "PARAMS")));
CSocNetLogComments::Update($arRes["ID"], $arSonetFields);
}
}
}
$url = ForumAddPageParams(CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $arParams["FID"], "TID" => $arParams["TID"], "MID" => intVal($arParams["MID"]), "UID" => $arParams["USER_ID"], "GID" => $arParams["SOCNET_GROUP_ID"])), array("result" => $arNote["code"]));
LocalRedirect($url);
} elseif (intVal($arFieldsG["PARAM2"]) > 0 && $arFieldsG["PARAM1"] == "VT") {
CVote::Delete($arFieldsG["PARAM2"]);
}
}
if (!empty($strErrorMessage)) {
$arError[] = array("id" => $arParams["MESSAGE_TYPE"], "text" => $strErrorMessage);
}
} elseif ($arResult["VIEW"] == "Y") {
$bVarsFromForm = true;
$arFields = array("FORUM_ID" => intVal($arParams["FID"]), "TOPIC_ID" => intVal($arParams["TID"]), "MESSAGE_ID" => intVal($arParams["MID"]), "USER_ID" => intVal($GLOBALS["USER"]->GetID()));
示例4: Add
//.........这里部分代码省略.........
&& array_key_exists("SOURCE_ID", $arFields)
&& intval($arFields["SOURCE_ID"]) > 0
)
)
{
$arInsert = $DB->PrepareInsert("b_sonet_log_comment", $arFields);
foreach ($arFields1 as $key => $value)
{
if (strlen($arInsert[0]) > 0)
$arInsert[0] .= ", ";
$arInsert[0] .= $key;
if (strlen($arInsert[1]) > 0)
$arInsert[1] .= ", ";
$arInsert[1] .= $value;
}
$ID = false;
if (strlen($arInsert[0]) > 0)
{
$strSql =
"INSERT INTO b_sonet_log_comment(".$arInsert[0].") ".
"VALUES(".$arInsert[1].")";
$DB->Query($strSql, False, "File: ".__FILE__."<br>Line: ".__LINE__);
$ID = IntVal($DB->LastID());
if ($ID > 0)
{
if (
!array_key_exists("RATING_TYPE_ID", $arFields)
|| empty($arFields["RATING_TYPE_ID"])
)
CSocNetLogComments::Update($ID, array(
"RATING_TYPE_ID" => "LOG_COMMENT",
"RATING_ENTITY_ID" => $ID
));
CSocNetLogFollow::Set(
$arFields["USER_ID"],
"L".$arFields["LOG_ID"],
"Y",
ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL")
);
$rsLog = CSocNetLog::GetList(
array(),
array("ID" => $arFields["LOG_ID"]),
false,
false,
array("ID", "USER_ID")
);
if (
($arLog = $rsLog->Fetch())
&& (intval($arLog["USER_ID"]) > 0)
)
{
$default_follow = CSocNetLogFollow::GetDefaultValue($arLog["USER_ID"]);
if ($default_follow != "Y")
{
$rsLogFollow = CSocNetLogFollow::GetList(
array(
"USER_ID" => $arLog["USER_ID"],
"CODE" => "L".$arFields["LOG_ID"]
),
array("TYPE")
示例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: GetMessage
if (strlen($comment_text) <= 0) {
$arResult["strMessage"] = GetMessage("SONET_LOG_COMMENT_EMPTY");
}
}
if (!isset($arResult["strMessage"])) {
$arAllow = array("HTML" => "N", "ANCHOR" => "Y", "LOG_ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "LIST" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "UPLOAD" => $arForum["ALLOW_UPLOAD"], "NL2BR" => "N", "SMILES" => "N");
if ($editCommentID > 0 && $arComment) {
$bHasEditCallback = is_array($arCommentEvent) && isset($arCommentEvent["UPDATE_CALLBACK"]) && ($arCommentEvent["UPDATE_CALLBACK"] == "NO_SOURCE" || is_callable($arCommentEvent["UPDATE_CALLBACK"]));
if ($bHasEditCallback && $arComment["USER_ID"] == $GLOBALS["USER"]->GetId()) {
$arFields = array("MESSAGE" => $comment_text, "TEXT_MESSAGE" => $comment_text, "EVENT_ID" => $arComment["EVENT_ID"]);
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);
示例7: 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;
}
示例8: __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;
//.........这里部分代码省略.........
示例9: Add
function Add($arFields, $bSetSource = false, $bSendEvent = true, $bSetLogUpDate = true)
{
global $DB;
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSocNetLogComments::CheckFields("ADD", $arFields)) {
return false;
}
$arCommentEvent = CSocNetLogTools::FindLogCommentEventByID($arFields["EVENT_ID"]);
if (!$arCommentEvent || !array_key_exists("ADD_CALLBACK", $arCommentEvent) || !is_callable($arCommentEvent["ADD_CALLBACK"])) {
$bSetSource = false;
}
$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetLogCommentAdd");
while ($arEvent = $db_events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
return false;
}
}
if ($bSetSource) {
$arSource = CSocNetLogComments::SetSource($arFields);
if (intval($arSource["SOURCE_ID"]) > 0) {
$arFields["SOURCE_ID"] = $arSource["SOURCE_ID"];
if (array_key_exists("RATING_ENTITY_ID", $arSource) && array_key_exists("RATING_TYPE_ID", $arSource) && intval($arSource["RATING_ENTITY_ID"]) > 0 && strlen($arSource["RATING_TYPE_ID"]) > 0) {
$arFields["RATING_TYPE_ID"] = $arSource["RATING_TYPE_ID"];
$arFields["RATING_ENTITY_ID"] = $arSource["RATING_ENTITY_ID"];
}
if (isset($arSource["MESSAGE"]) && strlen($arSource["MESSAGE"]) > 0) {
$arFields["MESSAGE"] = $arSource["MESSAGE"];
}
if (isset($arSource["TEXT_MESSAGE"]) && strlen($arSource["TEXT_MESSAGE"]) > 0) {
$arFields["TEXT_MESSAGE"] = $arSource["TEXT_MESSAGE"];
}
} else {
$strMessage = array_key_exists("ERROR", $arSource) && strlen($arSource["ERROR"]) > 0 ? $arSource["ERROR"] : (array_key_exists("NOTES", $arSource) && strlen($arSource["NOTES"]) > 0 ? $arSource["NOTES"] : "");
}
}
if (!$bSetSource || is_array($arSource) && array_key_exists("SOURCE_ID", $arFields) && intval($arFields["SOURCE_ID"]) > 0) {
$arInsert = $DB->PrepareInsert("b_sonet_log_comment", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($arInsert[0]) > 0) {
$arInsert[0] .= ", ";
}
$arInsert[0] .= $key;
if (strlen($arInsert[1]) > 0) {
$arInsert[1] .= ", ";
}
$arInsert[1] .= $value;
}
$ID = false;
if (strlen($arInsert[0]) > 0) {
$strSql = "INSERT INTO b_sonet_log_comment(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
$DB->Query($strSql, False, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = IntVal($DB->LastID());
if ($ID > 0) {
if (!array_key_exists("RATING_TYPE_ID", $arFields) || empty($arFields["RATING_TYPE_ID"])) {
CSocNetLogComments::Update($ID, array("RATING_TYPE_ID" => "LOG_COMMENT", "RATING_ENTITY_ID" => $ID));
}
CSocNetLogFollow::Set($arFields["USER_ID"], "L" . $arFields["LOG_ID"], "Y");
$rsLog = CSocNetLog::GetList(array(), array("ID" => $arFields["LOG_ID"]), false, false, array("ID", "USER_ID"));
if (($arLog = $rsLog->Fetch()) && intval($arLog["USER_ID"]) > 0) {
$default_follow = CSocNetLogFollow::GetDefaultValue($arLog["USER_ID"]);
if ($default_follow != "Y") {
$rsLogFollow = CSocNetLogFollow::GetList(array("USER_ID" => $arLog["USER_ID"], "CODE" => "L" . $arFields["LOG_ID"]), array("TYPE"));
$arLogFoillow = $rsLogFollow->Fetch();
if (!$arLogFoillow) {
CSocNetLogFollow::Set($arLog["USER_ID"], "L" . $arFields["LOG_ID"], "Y");
}
}
}
if ($bSendEvent) {
CSocNetLogComments::SendEvent($ID, "SONET_NEW_EVENT");
}
CSocNetLogComments::UpdateLogData($arFields["LOG_ID"], $bSetLogUpDate);
$db_events = GetModuleEvents("socialnetwork", "OnAfterSocNetLogCommentAdd");
while ($arEvent = $db_events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("SONET_LOG_" . $arFields["LOG_ID"]);
}
}
}
CSocNetLogTools::SetCacheLastLogID("comment", $ID);
return $ID;
} elseif ($bSetSource && strlen($strMessage) > 0) {
return array("ID" => false, "MESSAGE" => $strMessage);
} else {
return false;
}
}
示例10: onAfterCommentUpdate
public static function onAfterCommentUpdate($entityType, $entityId, $arData)
{
$log_event_id = CSocNetForumComments::FindLogEventIDByForumEntityID($entityType);
if (!$log_event_id)
return false;
$arLogCommentEvent = CSocNetLogTools::FindLogCommentEventByLogEventID($log_event_id);
if (!$arLogCommentEvent)
return false;
$arLogEvent = CSocNetLogTools::FindLogEventByID($log_event_id);
$entityId = intval($entityId);
if ($entityId <= 0)
return;
if (empty($arData["MESSAGE_ID"]))
return;
$parser = new CTextParser();
$parser->allow = array("HTML" => 'N',"ANCHOR" => 'Y',"BIU" => 'Y',"IMG" => "Y","VIDEO" => "Y","LIST" => 'N',"QUOTE" => 'Y',"CODE" => 'Y',"FONT" => 'Y',"SMILES" => "N","UPLOAD" => 'N',"NL2BR" => 'N',"TABLE" => "Y");
switch ($arData["ACTION"])
{
case "DEL":
case "HIDE":
$dbLogComment = CSocNetLogComments::GetList(
array("ID" => "DESC"),
array(
"EVENT_ID" => array($arLogCommentEvent["EVENT_ID"]),
"SOURCE_ID" => intval($arData["MESSAGE_ID"])
),
false,
false,
array("ID")
);
while ($arLogComment = $dbLogComment->Fetch())
CSocNetLogComments::Delete($arLogComment["ID"]);
break;
case "SHOW":
$dbLogComment = CSocNetLogComments::GetList(
array("ID" => "DESC"),
array(
"EVENT_ID" => array($arLogCommentEvent["EVENT_ID"]),
"SOURCE_ID" => intval($arData["MESSAGE_ID"])
),
false,
false,
array("ID")
);
$arLogComment = $dbLogComment->Fetch();
if (!$arLogComment)
{
$arMessage = CForumMessage::GetByID(intval($arData["MESSAGE_ID"]));
if ($arMessage)
{
$dbLog = CSocNetLog::GetList(
array("ID" => "DESC"),
array(
"EVENT_ID" => $log_event_id,
"SOURCE_ID" => $entityId
),
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"];
$sText = (COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"]);
$strURL = $GLOBALS['APPLICATION']->GetCurPageParam("", array("IFRAME", "MID", "SEF_APPLICATION_CUR_PAGE_URL", BX_AJAX_PARAM_ID, "result"));
$strURL = ForumAddPageParams(
$strURL,
array(
"MID" => intval($arData["MESSAGE_ID"]),
"result" => "reply"
),
false,
false
);
$arFieldsForSocnet = array(
"ENTITY_TYPE" => $entity_type,
"ENTITY_ID" => $entity_id,
"EVENT_ID" => $arLogCommentEvent["EVENT_ID"],
"MESSAGE" => $sText,
"TEXT_MESSAGE" => $parser->convert4mail($sText),
"URL" => str_replace("?IFRAME=Y", "", str_replace("&IFRAME=Y", "", str_replace("IFRAME=Y&", "", $strURL))),
"MODULE_ID" => (array_key_exists("MODULE_ID", $arLogCommentEvent) && strlen($arLogCommentEvent["MODULE_ID"]) > 0 ? $arLogCommentEvent["MODULE_ID"] : ""),
"SOURCE_ID" => intval($arData["MESSAGE_ID"]),
"LOG_ID" => $log_id,
"RATING_TYPE_ID" => "FORUM_POST",
"RATING_ENTITY_ID" => intval($arData["MESSAGE_ID"])
);
$arFieldsForSocnet["USER_ID"] = $arMessage["AUTHOR_ID"];
//.........这里部分代码省略.........
示例11: array
}
}
if (intval($update_id) <= 0) {
$rsRes = CSocNetLogComments::GetList(array(), array("ID" => $editCommentSourceID), false, false, array("ID", "USER_ID", "LOG_ID", "SOURCE_ID"));
if ($arRes = $rsRes->Fetch()) {
$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) {
示例12: array
<?php
if (CModule::IncludeModule("blog")) {
$arComments = array();
$dbLogComment = CSocNetLogComments::GetList(array("LOG_DATE" => "ASC"), array("EVENT_ID" => "blog_comment_micro", "SOURCE_ID" => false), false, false, array("ID", "LOG_SOURCE_ID", "USER_ID", "TEXT_MESSAGE", "LOG_DATE"));
while ($arLogComment = $dbLogComment->Fetch()) {
$arPost = CBlogPost::GetByID($arLogComment["LOG_SOURCE_ID"]);
if ($arPost) {
$arBlog = CBlog::GetByID($arPost["BLOG_ID"]);
$arFieldsComment = array("POST_ID" => $arPost["ID"], "BLOG_ID" => $arBlog["ID"], "POST_TEXT" => $arLogComment["TEXT_MESSAGE"], "DATE_CREATE" => $arLogComment["LOG_DATE"], "AUTHOR_ID" => $arLogComment["USER_ID"], "PARENT_ID" => false);
$commentId = CBlogComment::Add($arFieldsComment);
$arComments[$arLogComment["ID"]] = $commentId;
}
}
foreach ($arComments as $log_comment_id => $blog_comment_id) {
CSocNetLogComments::Update($log_comment_id, array("SOURCE_ID" => $blog_comment_id));
}
}
示例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");
}
}
}
}