/*******************************************************************/ if ($lAdmin->EditAction() && $forumModulePermissions >= "R") { $sError = ""; $sOk = ""; foreach ($FIELDS as $ID => $arFields) { $ID = intVal($ID); if (!$lAdmin->IsUpdated($ID)) { continue; } elseif (!CForumTopic::CanUserUpdateTopic($ID, $USER->GetUserGroupArray(), $USER->GetID())) { continue; } $res = CForumTopic::GetById($ID, array("NoFilter" => true)); if (is_set($arFields, "APPROVED")) { $arFields["APPROVED"] = $arFields["APPROVED"] == "N" ? "N" : "Y"; if ($res["APPROVED"] != $arFields["APPROVED"]) { ForumActions($arFields["APPROVED"] == "Y" ? "SHOW_TOPIC" : "HIDE_TOPIC", array("TID" => $ID), $sError, $sOk); } unset($arFields["APPROVED"]); } if (is_set($arFields, "FORUM_ID")) { if ($res["FORUM_ID"] != $arFields["FORUM_ID"]) { $result = CForumTopic::MoveTopic2Forum(array($res["ID"]), $arFields["FORUM_ID"], "N"); } unset($arFields["FORUM_ID"]); } foreach ($arFields as $key => $val) { if ($val == $res[$key]) { unset($arFields[$key]); } } if (empty($arFields)) {
case "FORUM_SUBSCRIBE": case "TOPIC_SUBSCRIBE": case "FORUM_SUBSCRIBE_TOPICS": $arFields = array("FID" => $arParams["FID"], "TID" => $action == "FORUM_SUBSCRIBE" ? 0 : $arParams["TID"], "TITLE_SEO" => $arResult["TOPIC"]["TITLE_SEO"], "NEW_TOPIC_ONLY" => $action == "FORUM_SUBSCRIBE_TOPICS" ? "Y" : "N"); $url = ForumAddPageParams(CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_SUBSCR_LIST"], array()), array("FID" => $arParams["FID"], "TID" => $arParams["TID"])); break; case "MOVE": $tmp_message = ForumDataToArray($message); $url = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE_MOVE"], array("FID" => $arParams["FID"], "TID" => $arParams["TID"], "MID" => implode(",", $tmp_message))); break; case "MOVE_TOPIC": $url = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_TOPIC_MOVE"], array("FID" => $arParams["FID"], "TID" => $arParams["TID"])); break; } if ($action != "MOVE" && $action != "MOVE_TOPIC") { $result = ForumActions($action, $arFields, $strErrorMessage, $strOKMessage); if (($action == "REPLY" || $action == "EDIT_TOPIC") && $arParams["AUTOSAVE"]) { $arParams["AUTOSAVE"]->Reset(); } if ($action == "DEL") { $arFields = CForumTopic::GetByID($arParams["TID"]); if (empty($arFields)) { $url = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_LIST"], array("FID" => $arParams["FID"])); $action = "del_topic"; } else { $mid = intVal($message); if (is_array($message)) { sort($message); $mid = array_pop($message); } $arFilter = array("TOPIC_ID" => $arParams["TID"], ">ID" => $mid);
public static function DeleteCrmActivityComment($arFields) { if (!isset($arFields["SOURCE_ID"]) || intval($arFields["SOURCE_ID"]) <= 0) { return array("NO_SOURCE" => "Y"); } $dbResult = CSocNetLog::GetList(array(), array("ID" => $arFields["LOG_ID"]), false, false, array('ID', 'ENTITY_ID')); if ($arLog = $dbResult->Fetch()) { $dbCrmActivity = CCrmActivity::GetList(array(), array('ID' => $arLog['ENTITY_ID'], 'CHECK_PERMISSIONS' => 'N')); if ($arCrmActivity = $dbCrmActivity->Fetch()) { if ($arCrmActivity['TYPE_ID'] == CCrmActivityType::Task) { if (CModule::IncludeModule("forum")) { $res = ForumActions("DEL", array("MID" => intval($arFields["SOURCE_ID"])), $strErrorMessage, $strOKMessage); return array("ERROR" => $strErrorMessage, "NOTES" => $strOKMessage); } else { return array("ERROR" => GetMessage("CRM_SL_DELETE_COMMENT_SOURCE_ERROR_FORUM_NOT_INSTALLED"), "NOTES" => false); } } else { return array("NO_SOURCE" => "Y"); } } else { return array("NO_SOURCE" => "Y"); } } else { return array("NO_SOURCE" => "Y"); } }
function DeleteComment_Forum($arFields) { $arRes = array(); if (CModule::IncludeModule("forum") && isset($arFields["SOURCE_ID"]) && intval($arFields["SOURCE_ID"]) > 0 && isset($arFields["EVENT_ID"]) && strlen($arFields["EVENT_ID"]) > 0 && isset($arFields["LOG_SOURCE_ID"]) && intval($arFields["LOG_SOURCE_ID"]) > 0) { $logEventMeta = CSocNetLogTools::FindLogEventByCommentID($arFields["EVENT_ID"]); if (true || $logEventMeta["EVENT_ID"] == "forum") { if (CModule::IncludeModule("forum")) { ForumActions("DEL", array("MID" => intval($arFields["SOURCE_ID"]), "PERMISSION" => "Y"), $strErrorMessage, $strOKMessage); $arRes["ERROR"] = $strErrorMessage; $arRes["NOTES"] = $strOKMessage; } } else { if ($logEventMeta) { $arForumMetaData = CSocNetLogTools::GetForumCommentMetaData($logEventMeta["EVENT_ID"]); } if ($arForumMetaData) { $messageId = intval($arFields["SOURCE_ID"]); $rsMessage = CForumMessage::GetList(array(), array("ID" => $messageId), false, 0, array("SELECT" => array("FORUM_ID"))); if ($arMessage = $rsMessage->Fetch()) { $forumId = intval($arMessage["FORUM_ID"]); } if ($forumId && intval($forumId) > 0) { if (($arForumMetaData[0] == 'WF' || $arForumMetaData[0] == 'FORUM') && isset($arFields["LOG_ID"]) && intval($arFields["LOG_ID"]) > 0) { $rsLog = CSocNetLog::GetList(array(), array("ID" => intval($arFields["LOG_ID"])), false, false, array("MESSAGE", "RATING_ENTITY_ID")); if ($arLog = $rsLog->Fetch()) { if ($arForumMetaData[0] == 'WF') { $entityId = $arLog["MESSAGE"]; } elseif ($arForumMetaData[0] == 'FORUM') { $entityId = $arLog["RATING_ENTITY_ID"]; } } } elseif ($arForumMetaData[0] == 'FORUM' && isset($arFields["LOG_ID"]) && intval($arFields["LOG_ID"]) > 0) { $rsLog = CSocNetLog::GetList(array(), array("ID" => intval($arFields["LOG_ID"])), false, false, array("MESSAGE")); if ($arLog = $rsLog->Fetch()) { $entityId = $arLog["MESSAGE"]; } } else { $entityId = $arFields["LOG_SOURCE_ID"]; } $feed = new \Bitrix\Forum\Comments\Feed(intval($forumId), array("type" => $arForumMetaData[1], "id" => intval($arFields["LOG_SOURCE_ID"]), "xml_id" => $arForumMetaData[0] . "_" . $entityId)); if (!$feed->delete($messageId)) { $arRes["ERROR"] = ""; foreach ($feed->getErrors() as $error) { $arRes["ERROR"] .= $error->getMessage(); } } else { $arRes["NOTES"] = GetMessage("SONET_DELETE_COMMENT_SOURCE_SUCCESS"); } } } } } if (!isset($arRes["NOTES"])) { $arRes["ERROR"] = GetMessage("SONET_DELETE_COMMENT_SOURCE_ERROR"); } return $arRes; }
$res = is_array($res) ? $res : array(); foreach ($res as $key => $val) { $arFilesExists[$key] = $val; } $arFilesExists = array_keys($arFilesExists); sort($arFilesExists); $arResult["MESSAGE_VIEW"]["FILES"] = $_REQUEST["FILES"] = $arFilesExists; $arResult["MESSAGE_VIEW"]["POST_MESSAGE_TEXT"] = $parser->convert($_POST["REVIEW_TEXT"], $arAllow, "html", $arFilesExists); } if (isset($_REQUEST['REVIEW_ACTION'])) { $arFields = array(); if (empty($arError)) { if (isset($_REQUEST['MID']) && intval($_REQUEST['MID']) > 0) { $arFields = array("MID" => intval($_REQUEST['MID'])); } if (ForumActions($_REQUEST['REVIEW_ACTION'], $arFields, $strErrorMessage, $strOKMessage)) { ForumClearComponentCache($componentName); } } if (isset($_REQUEST['AJAX_CALL'])) { $GLOBALS['APPLICATION']->RestartBuffer(); if (empty($arError)) { $arRes = array('status' => $result, 'message' => $result ? $strOKMessage : $strErrorMessage); } else { $arRes = array('status' => false, 'message' => $arError[0]['title']); } echo CUtil::PhpToJSObject($arRes); die; } else { LocalRedirect($APPLICATION->GetCurPageParam("", array("REVIEW_ACTION", "sessid", "MID"))); }
$res = is_array($res) ? $res : array(); foreach ($res as $key => $val) { $arFilesExists[$key] = $val; } $arFilesExists = array_keys($arFilesExists); sort($arFilesExists); $arResult["MESSAGE_VIEW"]["FILES"] = $_REQUEST["FILES"] = $arFilesExists; $arResult["MESSAGE_VIEW"]["POST_MESSAGE_TEXT"] = $parser->convert($_POST["REVIEW_TEXT"], $arAllow, "html", $arFilesExists); } if (isset($_REQUEST['REVIEW_ACTION'])) { $arFields = array(); if (empty($arError)) { if (isset($_REQUEST['MID']) && intval($_REQUEST['MID']) > 0) { $arFields = array("MID" => intval($_REQUEST['MID'])); } if (($result = ForumActions($_REQUEST['REVIEW_ACTION'], $arFields, $strErrorMessage, $strOKMessage)) && $result) { ForumClearComponentCache($componentName); } } if (isset($_REQUEST['AJAX_CALL'])) { $APPLICATION->RestartBuffer(); if (empty($arError)) { $arRes = array('status' => $result, 'message' => $result ? !empty($arNote) ? $arNote[0]["text"] : $strOKMessage : $strErrorMessage); } else { $arRes = array('status' => false, 'message' => $arError[0]['title']); } echo CUtil::PhpToJSObject($arRes); die; } else { LocalRedirect($APPLICATION->GetCurPageParam("", array("REVIEW_ACTION", "sessid", "MID"))); }
function DeleteComment_Forum($arFields) { if (!CModule::IncludeModule("forum")) { return false; } if ( !isset($arFields["SOURCE_ID"]) || intval($arFields["SOURCE_ID"]) <= 0 ) { return false; } $messageId = intval($arFields["SOURCE_ID"]); $res = ForumActions("DEL", array("MID" => $messageId), $strErrorMessage, $strOKMessage); return array( "ERROR" => $strErrorMessage, "NOTES" => $strOKMessage ); }