本文整理汇总了PHP中CForumMessage::GetByIDEx方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumMessage::GetByIDEx方法的具体用法?PHP CForumMessage::GetByIDEx怎么用?PHP CForumMessage::GetByIDEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumMessage
的用法示例。
在下文中一共展示了CForumMessage::GetByIDEx方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowError
// A - NO ACCESS E - READ I - ANSWER
// M - NEW TOPIC Q - MODERATE U - EDIT Y - FULL_ACCESS
$arResult["VOTE_PERMISSION"] = $arParams['PERMISSION'] === 'A' ? 0 : ($arParams['PERMISSION'] === 'E' ? 1 : 2);
$arParams["SHOW_VOTE"] = $arResult["VOTE_PERMISSION"] <= 'A' ? "N" : "Y";
}
if (!CForumNew::CanUserViewForum($arParams["FID"], $USER->GetUserGroupArray(), $arParams["PERMISSION"])) {
ShowError(GetMessage("FORUM_SONET_NO_ACCESS"));
return false;
}
$arResult["CURRENT_PAGE"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_TOPIC"], array("UID" => $arParams["USER_ID"], "TID" => $arParams["TID"], "GID" => $arParams["SOCNET_GROUP_ID"], "FID" => $arParams["FID"]));
if (intVal($_REQUEST["PAGEN_" . $arParams["PAGEN"]]) > 1 && intVal($arParams["MID"]) <= 0) {
$arResult["CURRENT_PAGE"] = ForumAddPageParams($arResult["CURRENT_PAGE"], array("PAGEN_" . $arParams["PAGEN"] => intVal($_REQUEST["PAGEN_" . $arParams["PAGEN"]])));
}
/************** Message ********************************************/
if ($arParams["MID"] > 0) {
$res = CForumMessage::GetByIDEx($arParams["MID"], array("GET_TOPIC_INFO" => "Y"));
if (!(is_array($res) && $res["FORUM_ID"] == $arParams["FID"])) {
LocalRedirect($arResult["CURRENT_PAGE"]);
} elseif ($arParams["MODE"] == "GROUP" && $res["TOPIC_INFO"]["SOCNET_GROUP_ID"] == $arParams["SOCNET_GROUP_ID"] || $arParams["MODE"] != "GROUP" && $res["TOPIC_INFO"]["OWNER_ID"] == $arParams["USER_ID"]) {
$arResult["MESSAGE"] = $res;
$arParams["TID"] = $res["TOPIC_INFO"]["ID"];
if ($res["APPROVED"] != "Y" && $arParams["PERMISSION"] < "Q") {
$arNote[] = array("id" => "mid is not approved", "text" => GetMessage("F_MID_IS_NOT_APPROVED"));
}
}
}
/************** Topic **********************************************/
$arFilter = array("ID" => $arParams["TID"], "SOCNET_GROUP_ID" => false);
if ($arParams["MODE"] == "GROUP") {
$arFilter["SOCNET_GROUP_ID"] = $arParams["SOCNET_GROUP_ID"];
} else {
示例2: isset
return 0;
}
if ($arParams["SHOW_VOTE"] == "Y") {
CModule::IncludeModule("vote");
$permission = isset($arParams['PERMISSION']) && intval($arParams['PERMISSION'] > 0 || $arParams['PERMISSION'] === 0) ? intval($arParams['PERMISSION']) : CVoteChannel::GetGroupPermission($arParams["VOTE_CHANNEL_ID"]);
if ($permission < 2) {
$arParams["SHOW_VOTE"] = "N";
}
$res = array_intersect($USER->GetUserGroupArray(), $arParams["VOTE_GROUP_ID"]);
$arParams["SHOW_VOTE"] = empty($res) ? "N" : $arParams["SHOW_VOTE"];
}
/********************************************************************
Data
********************************************************************/
if ($arParams["MESSAGE_TYPE"] == "EDIT") {
$arMessage = CForumMessage::GetByIDEx($arParams["MID"], array("GET_FORUM_INFO" => "N", "GET_TOPIC_INFO" => "Y", "FILTER" => "N"));
if (empty($arMessage)) {
ShowError(GetMessage("F_ERROR_MESSAGE_NOT_FOUND"));
return 0;
}
$arResult["TOPIC"] = $arMessage["TOPIC_INFO"];
$arResult["TOPIC_FILTER"] = CForumTopic::GetByID($arMessage["TOPIC_ID"]);
$arResult["MESSAGE"] = $arMessage;
$arResult["MESSAGE"]["FILES"] = array();
$db_res = CForumFiles::GetList(array(), array("MESSAGE_ID" => $arParams["MID"]));
if ($db_res && ($res = $db_res->Fetch())) {
do {
$arResult["MESSAGE"]["FILES"][$res["FILE_ID"]] = $res;
} while ($res = $db_res->Fetch());
}
if ($arParams["SHOW_VOTE"] == "Y" && $arMessage["PARAM1"] == "VT" && intVal($arMessage["PARAM2"]) > 0) {
示例3: 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");
}
}
}
示例4: SendMailMessage
function SendMailMessage($MID, $arFields = array(), $strLang = false, $mailTemplate = false)
{
global $USER;
$MID = intVal($MID);
$arMessage = array();
$arTopic = array();
$arForum = array();
$arFiles = array();
$mailTemplate = $mailTemplate === false ? "NEW_FORUM_MESSAGE" : $mailTemplate;
$event = new CEvent();
if ($MID > 0) {
CTimeZone::Disable();
$arMessage = CForumMessage::GetByIDEx($MID, array("GET_TOPIC_INFO" => "Y", "GET_FORUM_INFO" => "Y", "FILTER" => "Y"));
CTimeZone::Enable();
$db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), array("MESSAGE_ID" => $MID));
if ($db_files && ($res = $db_files->Fetch())) {
do {
$arFiles[$res["ID"]] = CFile::GetFileArray($res["FILE_ID"]);
} while ($res = $db_files->Fetch());
}
}
if (empty($arMessage)) {
return false;
}
$arTopic = $arMessage["TOPIC_INFO"];
$arForum = $arMessage["FORUM_INFO"];
$TID = intVal($arMessage["TOPIC_ID"]);
$FID = intVal($arMessage["FORUM_ID"]);
if (!is_set($arFields, "FORUM_ID")) {
$arFields["FORUM_ID"] = $arMessage["FORUM_ID"];
}
if (!is_set($arFields, "FORUM_NAME")) {
$arFields["FORUM_NAME"] = $arForum["NAME"];
}
if (!is_set($arFields, "TOPIC_ID")) {
$arFields["TOPIC_ID"] = $arMessage["TOPIC_ID"];
}
if (!is_set($arFields, "MESSAGE_ID")) {
$arFields["MESSAGE_ID"] = $arMessage["ID"];
}
if (!is_set($arFields, "TOPIC_TITLE")) {
$arFields["TOPIC_TITLE"] = $arTopic["TITLE"];
}
if (!is_set($arFields, "MESSAGE_DATE")) {
$arFields["MESSAGE_DATE"] = $arMessage["POST_DATE"];
}
if (!is_set($arFields, "AUTHOR")) {
$arFields["AUTHOR"] = $arMessage["AUTHOR_NAME"];
}
if (!is_set($arFields, "TAPPROVED")) {
$arFields["TAPPROVED"] = $arTopic["APPROVED"];
}
if (!is_set($arFields, "MAPPROVED")) {
$arFields["MAPPROVED"] = $arMessage["APPROVED"];
}
if (!is_set($arFields, "FROM_EMAIL")) {
$arFields["FROM_EMAIL"] = COption::GetOptionString("forum", "FORUM_FROM_EMAIL", "nomail@nomail.nomail");
}
//If the message is from socialnetwork, check if mail processor exists for this social network
if ($arTopic["SOCNET_GROUP_ID"] > 0) {
if (CModule::IncludeModule("mail") && CModule::IncludeModule("socialnetwork")) {
$arMailParams = CForumEMail::GetForumFilters($FID, $arTopic["SOCNET_GROUP_ID"]);
//If the processor exists:
if ($arMailParams) {
global $DB;
if ($arMessage["XML_ID"] == '') {
//check if MSG_ID field exists, generate it if not
$arMessage["XML_ID"] = "M" . $MID . "." . md5(uniqid()) . "@" . ($_SERVER["SERVER_NAME"] != '' ? $_SERVER["SERVER_NAME"] : $_SERVER["SERVER_ADDR"]);
$DB->Query("UPDATE b_forum_message SET XML_ID='" . $DB->ForSQL($arMessage["XML_ID"]) . "' WHERE ID=" . $MID);
}
//get MSG_ID topics, it would be IN_REPLY_TO
if ($arTopic["XML_ID"] == '') {
$arTopic["XML_ID"] = "T" . $TID . "." . md5(uniqid()) . "@" . ($_SERVER["SERVER_NAME"] != '' ? $_SERVER["SERVER_NAME"] : $_SERVER["SERVER_ADDR"]);
$DB->Query("UPDATE b_forum_topic SET XML_ID='" . $DB->ForSQL($arTopic["XML_ID"]) . "' WHERE ID=" . $TID);
}
//fill FROM_EMAIL from AUTHOR_NAME + FROM_EMAIL or AUTHOR_EMAIL or from 'b_user' by AUTHOR_ID depending on the settings of mail processor
if ($arMailParams['USE_EMAIL'] == 'Y' && $arMessage["AUTHOR_EMAIL"] != '') {
$arFields["FROM_EMAIL"] = '"' . $arMessage['AUTHOR_NAME'] . '" <' . $arMessage['AUTHOR_EMAIL'] . '>';
} elseif ($arMailParams['USE_EMAIL'] == 'Y' && $arMessage["EMAIL"] != '') {
$arFields["FROM_EMAIL"] = '"' . $arMessage['AUTHOR_NAME'] . '" <' . $arMessage['EMAIL'] . '>';
} else {
$arFields["FROM_EMAIL"] = '"' . $arMessage['AUTHOR_NAME'] . '" <' . $arMailParams['EMAIL'] . '>';
}
if ($arMessage["NEW_TOPIC"] == "Y") {
$arFields["=Message-Id"] = $arFields["MSG_ID"] = "<" . $arTopic["XML_ID"] . ">";
} else {
$arFields["TOPIC_TITLE"] = "Re" . ($arMessage["TOPIC_INFO"]["POSTS"] > 1 ? "[" . $arMessage["TOPIC_INFO"]["POSTS"] . "]" : "") . ": " . $arFields["TOPIC_TITLE"];
$arFields["=Message-Id"] = $arFields["MSG_ID"] = "<" . $arMessage["XML_ID"] . ">";
$arFields["=In-Reply-To"] = $arFields["IN_REPLY_TO"] = "<" . $arTopic["XML_ID"] . ">";
}
//fill REPLY_TO from the settings of the mail processor
$arFields["=Reply-To"] = $arFields["REPLY_TO"] = $arMailParams["EMAIL"];
$arFields["FORUM_EMAIL"] = $arMailParams["EMAIL"];
$arSocNetGroup = CSocNetGroup::GetById($arTopic["SOCNET_GROUP_ID"]);
$arFields["FORUM_NAME"] = $arSocNetGroup["NAME"];
if ($arMailParams["SUBJECT_SUF"] != '') {
$arFields["TOPIC_TITLE"] .= ' ' . $arMailParams["SUBJECT_SUF"];
}
if ($arMailParams["USE_SUBJECT"] == "Y") {
$arFields["=Subject"] = $arFields["TOPIC_TITLE"];
//.........这里部分代码省略.........
示例5: array
}
}
}
if (!empty($arFiles)) {
$arFieldsG["FILES"] = $arFiles;
}
}
if ($arParams["MESSAGE_TYPE"] == "EDIT") {
$arFieldsG += array("EDIT_ADD_REASON" => $_REQUEST["EDIT_ADD_REASON"], "EDITOR_NAME" => $_REQUEST["EDITOR_NAME"], "EDITOR_EMAIL" => $_REQUEST["EDITOR_EMAIL"], "EDIT_REASON" => $_REQUEST["EDIT_REASON"]);
}
$TID1 = $arParams["MESSAGE_TYPE"] == "NEW" ? 0 : intVal($arParams["TID"]);
$MID1 = $arParams["MESSAGE_TYPE"] == "NEW" ? 0 : intVal($arParams["MID"]);
$MID1 = intVal(ForumAddMessage($arParams["MESSAGE_TYPE"], $arParams["FID"], $TID1, $MID1, $arFieldsG, $strErrorMessage, $strOKMessage, false, $_POST["captcha_word"], 0, $_POST["captcha_code"]));
if ($MID1 > 0 && empty($strErrorMessage)) {
$arParams["MID"] = $MID1;
$arResult["MESSAGE"] = CForumMessage::GetByIDEx($MID1, array("GET_TOPIC_INFO" => "Y", "GET_FORUM_INFO" => "Y"));
if ($arParams['AUTOSAVE']) {
$arParams['AUTOSAVE']->Reset();
}
$addParams = array();
if ($_REQUEST["TOPIC_SUBSCRIBE"] == "Y" || $_REQUEST["FORUM_SUBSCRIBE"] == "Y") {
$addParams["sessid"] = bitrix_sessid();
if ($_REQUEST["TOPIC_SUBSCRIBE"] == "Y") {
$addParams["TOPIC_SUBSCRIBE"] = "Y";
}
if ($_REQUEST["FORUM_SUBSCRIBE"] == "Y") {
$addParams["FORUM_SUBSCRIBE"] = "Y";
}
}
$arNote = array("code" => strToLower($arParams["MESSAGE_TYPE"]), "title" => $strOKMessage, "link" => ForumAddPageParams(CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => intVal($arParams["FID"]), "TID" => intVal($arResult["MESSAGE"]["TOPIC_INFO"]["ID"]), "TITLE_SEO" => $arResult["MESSAGE"]["TOPIC_INFO"]["TITLE_SEO"], "MID" => intVal($arParams["MID"]))), $addParams));
if ($arParams["AJAX_CALL"] == "N") {
示例6: OnAfterPhotoCommentAddForum
//.........这里部分代码省略.........
$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;
$dbSection = 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", "CODE", "CREATED_BY", "DEPTH_LEVEL", "LEFT_MARGIN", "RIGHT_MARGIN", "UF_PASSWORD"));
while ($arPath = $dbSection->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"];
}
if (!$arSiteWorkgroupsPage && IsModuleInstalled("extranet") && $entity_type == SONET_ENTITY_GROUP) {
$rsSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
while ($arSite = $rsSite->Fetch()) {
$arSiteWorkgroupsPage[$arSite["ID"]] = COption::GetOptionString("socialnetwork", "workgroups_page", $arSite["DIR"] . "workgroups/", $arSite["ID"]);
}
}
if (is_set($arLogParams["SECTION_URL"]) && is_array($arSiteWorkgroupsPage) && $entity_type == SONET_ENTITY_GROUP) {
foreach ($arSiteWorkgroupsPage as $groups_page) {
if (strpos($arLogParams["SECTION_URL"], $groups_page) === 0) {
$arLogParams["SECTION_URL"] = "#GROUPS_PATH#" . substr($arLogParams["SECTION_URL"], strlen($groups_page), strlen($arLogParams["SECTION_URL"]) - strlen($groups_page));
}
}
}
}
$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");
}
}
}
}
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", "VIDEO" => "N");
$url = $this->arPath["DETAIL_URL"];
if ($bSocNetLogRecordExists) {
$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" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "photo_comment", "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE" => $parser->convert(empty($arFields["POST_MESSAGE_FILTER"]) ? $arFields["POST_MESSAGE"] : $arFields["POST_MESSAGE_FILTER"], $arAllow), "TEXT_MESSAGE" => $parser->convert4mail(empty($arFields["POST_MESSAGE_FILTER"]) ? $arFields["POST_MESSAGE"] : $arFields["POST_MESSAGE_FILTER"]), "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);
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" => $arFields["PARAM2"], "PHOTO_AUTHOR_ID" => $log_user_id, "COMMENT_AUTHOR_ID" => $arMessage["AUTHOR_ID"]);
CSocNetPhotoCommentEvent::NotifyIm($arFieldsIM);
}
} else {
$dbComments = CForumMessage::GetListEx(array(), array('TOPIC_ID' => $arFields["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" => $entity_type, "ENTITY_ID" => $entity_id, "EVENT_ID" => "photo_comment", "=LOG_DATE" => $GLOBALS["DB"]->CharToDateFunction($arComment["POST_DATE"], "FULL", SITE_ID), "MESSAGE" => $parser->convert(empty($arComment["POST_MESSAGE_FILTER"]) ? $arComment["POST_MESSAGE"] : $arComment["POST_MESSAGE_FILTER"], $arAllow), "TEXT_MESSAGE" => $parser->convert4mail(empty($arComment["POST_MESSAGE_FILTER"]) ? $arComment["POST_MESSAGE"] : $arComment["POST_MESSAGE_FILTER"]), "MODULE_ID" => false, "SOURCE_ID" => $arComment["ID"], "LOG_ID" => $log_id, "RATING_TYPE_ID" => "FORUM_POST", "RATING_ENTITY_ID" => $arComment["ID"]);
if (intVal($arComment["AUTHOR_ID"]) > 0) {
$arFieldsForSocnet["USER_ID"] = $arComment["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" => $arFields["PARAM2"], "PHOTO_AUTHOR_ID" => $log_user_id, "COMMENT_AUTHOR_ID" => $arComment["AUTHOR_ID"]);
CSocNetPhotoCommentEvent::NotifyIm($arFieldsIM);
}
}
if ($arElement) {
self::InheriteAlbumFollow($arElement["IBLOCK_SECTION_ID"], $log_id, intVal($arElement["CREATED_BY"]) > 0 ? $arElement["CREATED_BY"] : false);
}
}
}
}
}
示例7: Add
function Add($arFields, $strUploadDir = false, $arParams = array())
{
global $DB;
$strUploadDir = ($strUploadDir === false ? "forum/upload" : $strUploadDir);
if (!CForumMessage::CheckFields("ADD", $arFields))
return false;
$arForum = CForumNew::GetByID($arFields["FORUM_ID"]);
$arParams["SKIP_STATISTIC"] = ($arParams["SKIP_STATISTIC"] == "Y" ? "Y" : "N");
$arParams["SKIP_INDEXING"] = ($arParams["SKIP_INDEXING"] == "Y" || $arForum["INDEXATION"] != "Y" ? "Y" : "N");
$POST_MESSAGE = $arFields["POST_MESSAGE"];
$parser = new forumTextParser(LANGUAGE_ID);
$allow = forumTextParser::GetFeatures($arForum);
$allow['SMILES'] = (($arFields["USE_SMILES"] != "Y") ? 'N' : $allow['SMILES']);
if (COption::GetOptionString("forum", "FILTER", "Y") == "Y")
{
$POST_MESSAGE = CFilterUnquotableWords::Filter($POST_MESSAGE);
$arFields["POST_MESSAGE_FILTER"] = (empty($POST_MESSAGE) ? "*" : $POST_MESSAGE);
}
/***************** Attach ******************************************/
$arFiles = array();
if (is_array($arFields["ATTACH_IMG"]))
$arFields["FILES"] = array($arFields["ATTACH_IMG"]);
unset($arFields["ATTACH_IMG"]);
if (is_array($arFields["FILES"]) && !empty($arFields["FILES"]))
{
$res = array("FORUM_ID" => $arFields["FORUM_ID"], "USER_ID" => $arFields["AUTHOR_ID"], "upload_dir" => $strUploadDir);
$arFiles = CForumFiles::Save($arFields["FILES"], $res, false);
if (!empty($arFiles))
{
$arFiles = array_keys($arFiles);
sort($arFiles);
$arFields["ATTACH_IMG"] = $arFiles[0];
$arFields["ATTACHED_FILES"] = $arFiles;
}
unset($arFields["FILES"]);
}
/***************** Attach/******************************************/
if (COption::GetOptionString("forum", "MESSAGE_HTML", "N") == "Y")
$POST_MESSAGE = $parser->convert($POST_MESSAGE, $allow, "html", $arFiles);
$arFields["POST_MESSAGE_HTML"] = $POST_MESSAGE;
/***************** Event onBeforeMessageAdd ************************/
foreach(GetModuleEvents("forum", "onBeforeMessageAdd", true) as $arEvent)
{
if (ExecuteModuleEventEx($arEvent, array(&$arFields, &$strUploadDir)) === false)
return false;
}
/***************** /Event ******************************************/
if (empty($arFields))
return false;
$arInsert = $DB->PrepareInsert("b_forum_message", $arFields, $strUploadDir);
$strDatePostField = "";
$strDatePostValue = "";
if (!is_set($arFields, "POST_DATE"))
{
$strDatePostField = ", POST_DATE";
$strDatePostValue = ", ".$DB->GetNowFunction()."";
}
$strSql = "INSERT INTO b_forum_message(".$arInsert[0].$strDatePostField.") VALUES(".$arInsert[1].$strDatePostValue.")";
$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
$ID = intVal($DB->LastID());
/***************** Attach ******************************************/
if (!empty($arFiles))
CForumFiles::UpdateByID($arFiles, array("FORUM_ID" => $arFields["FORUM_ID"],
"TOPIC_ID" => $arFields["TOPIC_ID"], "MESSAGE_ID" => $ID));
/***************** Attach/******************************************/
/***************** Quota *******************************************/
$_SESSION["SESS_RECOUNT_DB"] = "Y";
$GLOBALS["USER_FIELD_MANAGER"]->Update("FORUM_MESSAGE", $ID, $arFields);
if ($arParams["SKIP_STATISTIC"] == "Y" && $arParams["SKIP_INDEXING"] == "Y")
return $ID;
$arMessage = CForumMessage::GetByIDEx($ID, array("GET_FORUM_INFO" => "N", "GET_TOPIC_INFO" => "Y", "FILTER" => "Y"));
if ($arParams["SKIP_STATISTIC"] != "Y")
{
if (intVal($arMessage["AUTHOR_ID"]) > 0)
{
CForumUser::SetStat($arMessage["AUTHOR_ID"], array("MESSAGE" => $arMessage));
}
CForumTopic::SetStat($arMessage["TOPIC_ID"], array("MESSAGE" => $arMessage));
CForumNew::SetStat($arMessage["FORUM_ID"], array("MESSAGE" => $arMessage));
}
/***************** Events onAfterMessageAdd ************************/
foreach(GetModuleEvents("forum", "onAfterMessageAdd", true) as $arEvent)
ExecuteModuleEventEx($arEvent, array(&$ID, $arMessage, $arMessage["TOPIC_INFO"], $arMessage["FORUM_INFO"], $arFields));
/***************** /Events *****************************************/
if ($arMessage["APPROVED"] == "Y")
{
if ($arParams["SKIP_INDEXING"] != "Y" && CModule::IncludeModule("search"))
{
$arMessage["POST_MESSAGE"] = (COption::GetOptionString("forum", "FILTER", "Y") == "Y" ?
$arMessage["POST_MESSAGE_FILTER"] : $arMessage["POST_MESSAGE"]);
$arParams = array(
"PERMISSION" => array(),
//.........这里部分代码省略.........
示例8: 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);
}
}
}
}
}
示例9: array
$strOKMessage = "";
if (!check_bitrix_sessid()) {
$arError[] = array("id" => "bad_sessid", "text" => GetMessage("F_ERR_SESS_FINISH"));
} elseif ($arParams["action"] == "MOVE_TO_TOPIC") {
if (ForumMoveMessage($arParams["FID"], $arParams["TID"], $message, $arParams["newTID"], array(), $strErrorMessage, $strOKMessage)) {
$topic = CForumTopic::GetByID($arParams["newTID"]);
LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_READ"], array("FID" => $arResult["FORUM"]["ID"], "TID" => $topic["ID"], "TITLE_SEO" => $topic["TITLE_SEO"], "MID" => "s")));
} else {
$arError[] = array("id" => "bad_move", "text" => $strErrorMessage);
}
} elseif ($arParams["action"] == "MOVE_TO_NEW" && strLen(trim($_REQUEST["TITLE"])) <= 0) {
$arError[] = array("id" => "bad_move", "text" => GetMessage('FM_ERR_NO_DATA'));
} elseif ($arParams["action"] == "MOVE_TO_NEW") {
$arFields = array("TITLE" => trim($_REQUEST["TITLE"]), "TITLE_SEO" => trim($_REQUEST["TITLE_SEO"]), "DESCRIPTION" => trim($_REQUEST["DESCRIPTION"]), "ICON" => intVal($_REQUEST["ICON"]), "TAGS" => $_REQUEST["TAGS"]);
if (ForumMoveMessage($arParams["FID"], $arParams["TID"], $message, 0, $arFields, $strErrorMessage, $strOKMessage)) {
$res = CForumMessage::GetByIDEx($message[0], array("GET_TOPIC_INFO" => "Y"));
LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_READ"], array("FID" => $arResult["FORUM"]["ID"], "TID" => $res["TOPIC_INFO"]["ID"], "TITLE_SEO" => $res["TOPIC_INFO"]["TITLE_SEO"], "MID" => "s")));
} else {
$arError[] = array("id" => "bad_move", "text" => $strErrorMessage);
}
}
if (!empty($arError)) {
$e = new CAdminException(array_reverse($arError));
$GLOBALS["APPLICATION"]->ThrowException($e);
$err = $GLOBALS['APPLICATION']->GetException();
$arResult["ERROR_MESSAGE"] .= $err->GetString();
if (!empty($arParams["newTID"])) {
$res = CForumTopic::GetByIDEx($arParams["newTID"]);
$arResult["NEW_TOPIC"] = array("TOPIC" => $res["TOPIC_INFO"], "FORUM" => $res["FORUM_INFO"]);
}
$arResult["VALUES"]["TITLE"] = htmlspecialcharsEx($_REQUEST["TITLE"]);
示例10: array
}
$sText = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $result["POST_MESSAGE_FILTER"] : $result["POST_MESSAGE"];
if ($arParams["MODE"] == "GROUP") {
CSocNetGroup::SetLastActivity($arParams["SOCNET_GROUP_ID"]);
}
// calculate root MID
$dbFirstMessage = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $arParams["TID"]), false, 1);
if ($arFirstMessage = $dbFirstMessage->Fetch()) {
$bSocNetLogRecordExists = false;
$dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "forum", "SOURCE_ID" => $arFirstMessage["ID"]), false, false, array("ID", "TMP_ID"));
if ($arRes = $dbRes->Fetch()) {
$log_id = $arRes["TMP_ID"];
$bSocNetLogRecordExists = true;
} else {
// get root message
$arFirstMessage = CForumMessage::GetByIDEx($arFirstMessage["ID"], array("GET_TOPIC_INFO" => "Y", "getFiles" => "Y"));
$arTopic = $arFirstMessage["TOPIC_INFO"];
$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" => $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" => $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" => $sFirstMessageText, "TEXT_MESSAGE" => $parser->convert4mail($sFirstMessageText), "URL" => $sFirstMessageURL, "PARAMS" => serialize(array("PATH_TO_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("TID" => $arParams["TID"])))), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "SOURCE_ID" => $arFirstMessage["ID"], "RATING_TYPE_ID" => "FORUM_TOPIC", "RATING_ENTITY_ID" => intval($arParams["TID"]));
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, $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"]));
示例11: createLogComment
private function createLogComment($messageID, $bSocNetLogRecordExists, $iblockElementID, $topicID, $arLogParams)
{
$dbComment = CSocNetLogComments::GetList(array(), array('EVENT_ID' => 'wiki_comment', 'SOURCE_ID' => $messageID), false, false, array('ID'));
if (($arComment = $dbComment->Fetch()) && intval($arComment['ID']) > 0) {
return false;
}
$arForum = CForumNew::GetByID($this->ForumID);
$parser = new textParser(LANGUAGE_ID, $this->arPath['PATH_TO_SMILE']);
$parser->image_params['width'] = false;
$parser->image_params['height'] = false;
$arAllow = array('HTML' => "N", 'ANCHOR' => "N", 'BIU' => "N", 'IMG' => "N", 'LIST' => "N", 'QUOTE' => "N", 'CODE' => "N", 'FONT' => "N", 'UPLOAD' => $arForum['ALLOW_UPLOAD'], 'NL2BR' => "N", 'SMILES' => "N");
if ($bSocNetLogRecordExists) {
$arMessage = CForumMessage::GetByIDEx($messageID);
$sAuthorForMail = str_replace('#TITLE#', $arMessage['AUTHOR_NAME'], GetMessage('SONET_FORUM_LOG_TEMPLATE_GUEST'));
$parser = new textParser(LANGUAGE_ID, $this->arPath['PATH_TO_SMILE']);
$parser->image_params['width'] = false;
$parser->image_params['height'] = false;
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$sAuthorForMail = str_replace(array('#URL#', '#TITLE#'), array('http://' . SITE_SERVER_NAME . CComponentEngine::MakePathFromTemplate($this->arPath['PATH_TO_USER'], array('user_id' => $arMessage['AUTHOR_ID'])), $arMessage['AUTHOR_NAME']), GetMessage('SONET_FORUM_LOG_TEMPLATE_AUTHOR'));
}
$arFieldsForSocnet = array('ENTITY_TYPE' => SONET_SUBSCRIBE_ENTITY_GROUP, 'ENTITY_ID' => intval($this->SonetGroupID), 'EVENT_ID' => 'wiki_comment', '=LOG_DATE' => $GLOBALS['DB']->CharToDateFunction($arMessage['POST_DATE'], "FULL", SITE_ID), 'MESSAGE' => $parser->convert($arMessage['POST_MESSAGE'], $arAllow), 'TEXT_MESSAGE' => $parser->convert4mail($arMessage['POST_MESSAGE'] . $sAuthorForMail), 'URL' => $arLogParams["URL"], 'MODULE_ID' => false, 'SOURCE_ID' => $messageID, 'LOG_ID' => $arLogParams["LOG_ID"], 'RATING_TYPE_ID' => 'FORUM_POST', 'RATING_ENTITY_ID' => intval($arMessage['ID']));
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$arFieldsForSocnet['USER_ID'] = $arMessage['AUTHOR_ID'];
}
$log_comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
if ($log_comment_id) {
CSocNetLog::CounterIncrement($log_comment_id, false, false, "LC");
if (CModule::IncludeModule("im") && intval($arMessage["AUTHOR_ID"]) > 0 && $arMessage["AUTHOR_ID"] != $arLogParams["LOG_USER_ID"]) {
$rsUnFollower = CSocNetLogFollow::GetList(array("USER_ID" => $arLogParams["LOG_USER_ID"], "CODE" => "L" . $arLogParams["LOG_ID"], "TYPE" => "N"), array("USER_ID"));
$arUnFollower = $rsUnFollower->Fetch();
if (!$arUnFollower) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arLogParams["LOG_USER_ID"], "FROM_USER_ID" => $arMessage["AUTHOR_ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "wiki", "NOTIFY_EVENT" => "comment");
$arParams["TITLE"] = str_replace(array("\r\n", "\n"), " ", $arLogParams["LOG_TITLE"]);
$arParams["TITLE"] = TruncateText($arParams["TITLE"], 100);
$arParams["TITLE_OUT"] = TruncateText($arParams["TITLE"], 255);
$arTmp = CSocNetLogTools::ProcessPath(array("ELEMENT_URL" => $arLogParams["URL"]), $arLogParams["LOG_USER_ID"]);
$serverName = $arTmp["SERVER_NAME"];
$url = $arTmp["URLS"]["ELEMENT_URL"];
$arMessageFields["NOTIFY_TAG"] = "WIKI|COMMENT|" . $iblockElementID;
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("WIKI_SONET_IM_COMMENT", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("WIKI_SONET_IM_COMMENT", array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " (" . $serverName . $url . ")#BR##BR#" . $arFieldsForSocnet["MESSAGE"];
CIMNotify::Add($arMessageFields);
}
}
}
} else {
$dbMessage = CForumMessage::GetListEx(array(), array("TOPIC_ID" => $topicID, "NEW_TOPIC" => "N"));
while ($arMessage = $dbMessage->GetNext()) {
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$sAuthorForMail = str_replace(array('#URL#', '#TITLE#'), array('http://' . SITE_SERVER_NAME . CComponentEngine::MakePathFromTemplate($this->arPath['PATH_TO_USER'], array('user_id' => $arMessage['AUTHOR_ID'])), $arMessage['AUTHOR_NAME']), GetMessage('SONET_FORUM_LOG_TEMPLATE_AUTHOR'));
}
$arFieldsForSocnet = array('ENTITY_TYPE' => SONET_SUBSCRIBE_ENTITY_GROUP, 'ENTITY_ID' => intval($this->SonetGroupID), 'EVENT_ID' => 'wiki_comment', '=LOG_DATE' => $GLOBALS['DB']->CharToDateFunction($arMessage['POST_DATE'], "FULL", SITE_ID), 'MESSAGE' => $parser->convert($arMessage['POST_MESSAGE'], $arAllow), 'TEXT_MESSAGE' => $parser->convert4mail($arMessage['POST_MESSAGE'] . $sAuthorForMail), 'URL' => $arLogParams["URL"], 'MODULE_ID' => false, 'SOURCE_ID' => $arMessage['ID'], 'LOG_ID' => $arLogParams["LOG_ID"], 'RATING_TYPE_ID' => 'FORUM_POST', 'RATING_ENTITY_ID' => intval($arMessage['ID']));
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$arFieldsForSocnet['USER_ID'] = $arMessage['AUTHOR_ID'];
}
$log_comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
CSocNetLog::CounterIncrement($log_comment_id, false, false, "LC");
}
}
}
示例12: 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");
}
}
}
}
示例13: isset
$arResult["REVIEW_EMAIL"] = isset($arResult["~REVIEW_EMAIL"]) ? htmlspecialcharsEx($arResult["~REVIEW_EMAIL"]) : "";
$arResult["REVIEW_TEXT"] = isset($arResult["~REVIEW_TEXT"]) ? htmlspecialcharsEx($arResult["~REVIEW_TEXT"]) : "";
$arResult["REVIEW_USE_SMILES"] = $arResult["~REVIEW_USE_SMILES"];
$arResult["REVIEW_FILES"] = array();
foreach ($_REQUEST["FILES"] as $key => $val) {
if (intVal($val) <= 0) {
continue;
}
$resForumFile = CForumFiles::GetList(array(), array('FILE_ID' => $val));
if ($resForumFile && ($arForumFile = $resForumFile->Fetch())) {
$bFileAccessible = false;
// Workaround for just uploaded files
if ($arForumFile['MESSAGE_ID'] == 0 && $arForumFile['TOPIC_ID'] == 0) {
$bFileAccessible = true;
} else {
$arTmp['MESSAGE'] = CForumMessage::GetByIDEx($arForumFile['MESSAGE_ID'], array('GET_FORUM_INFO' => 'N', 'GET_TOPIC_INFO' => 'Y'));
if (isset($arTmp['MESSAGE']['TOPIC_INFO']['ID']) && CTasks::CanCurrentUserViewTopic($arTmp['MESSAGE']['TOPIC_INFO']['ID'])) {
$bFileAccessible = true;
}
}
if ($bFileAccessible) {
$arResult['REVIEW_FILES'][$val] = CFile::GetFileArray($val);
}
}
}
}
$arResult["SHOW_CLOSE_ALL"] = "N";
if ($arResult["FORUM"]["ALLOW_BIU"] == "Y" || $arResult["FORUM"]["ALLOW_FONT"] == "Y" || $arResult["FORUM"]["ALLOW_ANCHOR"] == "Y" || $arResult["FORUM"]["ALLOW_IMG"] == "Y" || $arResult["FORUM"]["ALLOW_QUOTE"] == "Y" || $arResult["FORUM"]["ALLOW_CODE"] == "Y" || $arResult["FORUM"]["ALLOW_LIST"] == "Y") {
$arResult["SHOW_CLOSE_ALL"] = "Y";
}
/* For custom template */
示例14: array
********************************************************************/
$arResult["MESSAGE"] = array();
$arResult["TOPIC"] = array();
if ($arParams["SHOW_VOTE"] == "Y" && CModule::IncludeModule("vote")) {
$permission = isset($arParams['PERMISSION']) && intval($arParams['PERMISSION'] > 0 || $arParams['PERMISSION'] === 0) ? intval($arParams['PERMISSION']) : CVoteChannel::GetGroupPermission($arParams["VOTE_CHANNEL_ID"]);
if ($permission < 2) {
$arParams["SHOW_VOTE"] = "N";
}
$res = array_intersect($USER->GetUserGroupArray(), $arParams["VOTE_GROUP_ID"]);
$arParams["SHOW_VOTE"] = empty($res) ? "N" : $arParams["SHOW_VOTE"];
}
if ($arParams["MESSAGE_TYPE"] == "EDIT") {
if ($arParams["MID"] <= 0) {
$arError = array("code" => "mid_is_lost", "title" => GetMessage("F_MID_IS_LOST"), "link" => $arResult["index"]);
} else {
$arResult["MESSAGE"] = CForumMessage::GetByIDEx($arParams["MID"], array("GET_TOPIC_INFO" => "Y", "GET_FORUM_INFO" => "Y", "FILTER" => "N"));
if (empty($arResult["MESSAGE"])) {
$arError = array("code" => "mid_is_lost", "title" => GetMessage("F_MID_IS_LOST"), "link" => $arResult["index"]);
} else {
$arResult["TOPIC"] = $arResult["MESSAGE"]["TOPIC_INFO"];
$arResult["FORUM"] = $arResult["MESSAGE"]["FORUM_INFO"];
$arParams["TID"] = $arResult["TOPIC"]["ID"];
$arParams["FID"] = $arResult["FORUM"]["ID"];
if ($arParams["SHOW_VOTE"] == "Y" && $arResult["MESSAGE"]["PARAM1"] == "VT" && intVal($arResult["MESSAGE"]["PARAM2"]) > 0) {
$db_res = CVoteQuestion::GetListEx(array("ID" => "ASC"), array("CHANNEL_ID" => $arParams["VOTE_CHANNEL_ID"], "VOTE_ID" => $arResult["MESSAGE"]["PARAM2"]));
if ($db_res && ($res = $db_res->Fetch())) {
do {
$arResult["~QUESTIONS"][$res["ID"]] = $res;
$arResult["~QUESTIONS"][$res["ID"]]["ANSWERS"] = array();
} while ($res = $db_res->Fetch());
}