本文整理汇总了PHP中CForumMessage::GetListEx方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumMessage::GetListEx方法的具体用法?PHP CForumMessage::GetListEx怎么用?PHP CForumMessage::GetListEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumMessage
的用法示例。
在下文中一共展示了CForumMessage::GetListEx方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$USER->GetUserGroupArray(),
$arResult["FORUM_TOPIC_ID"],
array(
"ORDER_DIRECTION" => ($arParams["PREORDER"] == "N" ? "DESC" : "ASC"),
"PERMISSION_EXTERNAL" => $arResult["USER"]["PERMISSION"],
"FILTER" => array("!PARAM1" => "IB")
)
);
if ($page_number > 0)
$arFields["iNumPage"] = intVal($page_number);
}
$arFilter = array("FORUM_ID"=>$arParams["FORUM_ID"], "TOPIC_ID"=>$arResult["FORUM_TOPIC_ID"], "!PARAM1" => "IB");
if ($arResult["USER"]["RIGHTS"]["MODERATE"] != "Y")
$arFilter["APPROVED"] = "Y";
$db_res = CForumMessage::GetListEx($arOrder, $arFilter, false, 0, $arFields);
$db_res->NavStart($arParams["MESSAGES_PER_PAGE"], false, ($arFields["iNumPage"] > 0 ? $arFields["iNumPage"] : false));
$arResult["NAV_RESULT"] = $db_res;
if ($db_res)
{
$arResult["NAV_STRING"] = $db_res->GetPageNavStringEx($navComponentObject, GetMessage("NAV_OPINIONS"), $arParams["PAGE_NAVIGATION_TEMPLATE"]);
$arResult["NAV_STYLE"] = $APPLICATION->GetAdditionalCSS();
$arResult["PAGE_COUNT"] = $db_res->NavPageCount;
$arResult['PAGE_NUMBER'] = $db_res->NavPageNomer;
$number = intVal($db_res->NavPageNomer-1)*$arParams["MESSAGES_PER_PAGE"] + 1;
while ($res = $db_res->GetNext())
{
/************** Message info ***************************************/
// number in topic
$res["NUMBER"] = $number++;
// data
示例2: getCommentsFiles
/**
* @deprecated
*/
private static function getCommentsFiles($forumTopicId)
{
$arFilesIds = array();
if (CModule::IncludeModule('forum') && ($forumId = CTasksTools::GetForumIdForIntranet()) && $forumId >= 1) {
$rc = CForumMessage::GetListEx(array(), array('FORUM_ID' => $forumId, 'TOPIC_ID' => $forumTopicId));
$arMessagesIds = array();
while ($arMsg = $rc->fetch()) {
$arMessagesIds[] = (int) $arMsg['ID'];
}
foreach ($arMessagesIds as $msgId) {
$arUF = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("FORUM_MESSAGE", $msgId, LANGUAGE_ID, 1);
if (isset($arUF['UF_FORUM_MESSAGE_DOC'], $arUF['UF_FORUM_MESSAGE_DOC']['VALUE'])) {
if (is_array($arUF['UF_FORUM_MESSAGE_DOC']['VALUE'])) {
$arFilesIds = array_merge($arFilesIds, $arUF['UF_FORUM_MESSAGE_DOC']['VALUE']);
}
}
}
}
$arFilesIds = array_unique(array_map('intval', $arFilesIds));
return $arFilesIds;
/*
if (CModule::IncludeModuel("forum"))
{
$arFilter = (is_array($arFilter) ? $arFilter : array($arFilter));
$arFilter[">UF_FORUM_MESSAGE_DOC"] = 0;
$db_res = CForumMessage::GetList(array("ID" => "ASC"), $arFilter, false, 0, array("SELECT" => array("UF_FORUM_MESSAGE_DOC")));
$arDocs = array();
if ($db_res && ($res = $db_res->Fetch()))
{
do {
if (!empty($res["UF_FORUM_MESSAGE_DOC"]) && is_array($res["UF_FORUM_MESSAGE_DOC"]))
$arDocs = array_merge($arDocs, $res["UF_FORUM_MESSAGE_DOC"]);
} while ($res = $db_res->Fetch());
}
}
*/
}
示例3: array
}
/********************************************************************
/Action
********************************************************************/
/********************************************************************
Data
********************************************************************/
$arFilter = array("APPROVED" => "N", "FORUM_ID" => $arParams["FID"]);
if ($arParams["TID"] > 0)
$arFilter["TOPIC_ID"] = $arParams["TID"];
$db_Message = CForumMessage::GetListEx(
array("ID" => "ASC"),
$arFilter,
false, false,
array(
"bDescPageNumbering" => false,
"nPageSize" => $arParams["MESSAGES_PER_PAGE"],
"bShowAll" => false,
"sNameTemplate" => $arParams["NAME_TEMPLATE"]
));
$db_Message->nPageWindow = $arParams["PAGE_NAVIGATION_WINDOW"];
$db_Message->NavStart($arParams["MESSAGES_PER_PAGE"], false);
$arResult["NAV_RESULT"] = $db_Message;
$arResult["NAV_STRING"] = $db_Message->GetPageNavStringEx($navComponentObject, GetMessage("F_TITLE_NAV"), $arParams["PAGE_NAVIGATION_TEMPLATE"]);
if ($db_Message && ($res = $db_Message->GetNext()))
{
$iCount = 1;
$arResult["SHOW_RESULT"] = "Y";
do
{
示例4: 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);
}
}
}
}
}
示例5: array
}
if ($this->StartResultCache($arParams["CACHE_TIME"], array($cache_id_array, $arParams["DESIGN_MODE"]), "/" . SITE_ID . "/forum/rss/" . $arParams["TYPE"] . "/" . $arParams["MODE_DATA"] . "/")) {
$arFilter = array("TOPIC_ID" => $arParams["TID"], "APPROVED" => "Y", "@FORUM_ID" => implode(",", array_keys($arResult["FORUMS"])), "TOPIC" => "GET_TOPIC_INFO");
if ($arParams["MODE_DATA"] != "topic") {
$arFilter = array();
if (intVal($arParams["FID"]) > 0) {
$arFilter["FORUM_ID"] = $arParams["FID"];
} else {
$arFilter["@FORUM_ID"] = implode(",", array_keys($arResult["FORUMS"]));
}
$arFilter["APPROVED"] = "Y";
$arFilter["NEW_TOPIC"] = "Y";
$arFilter["TOPIC"] = "GET_TOPIC_INFO";
}
CTimeZone::Disable();
$db_res = CForumMessage::GetListEx(array("ID" => "DESC"), $arFilter, 0, $arParams["COUNT"], array("sNameTemplate" => $arParams["NAME_TEMPLATE"]));
CTimeZone::Enable();
if ($db_res && ($res = $db_res->Fetch())) {
do {
foreach ($res as $key => $val) {
$res["~" . $key] = $val;
$res[$key] = htmlspecialcharsbx($val);
}
/************** Message info ***************************************/
// data
$arDate = ParseDateTime($res["POST_DATE"], false);
$date = date("r", mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));
if ($arParams["TYPE"] == "ATOM") {
$timeISO = mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]);
$date = date("Y-m-d\\TH:i:s", $timeISO) . substr(date("O", $timeISO), 0, 3) . ":" . substr(date("O", $timeISO), -2, 2);
}
示例6: array
if ($db_res) {
$arResult['NAV_PAGE_COUNT'] = $db_res->NavPageCount;
}
if (is_array($res["Nav"])) {
$arResult["NAV_PAGE_COUNT"] = $res["Nav"]["NAV_PAGE_COUNT"];
$arResult["NAV_STRING"] = $res["Nav"]["NAV_STRING"];
}
}
}
if (empty($arMessages)) {
$arOrder = array("ID" => $ORDER_DIRECTION);
$arFields = array("bDescPageNumbering" => false, "nPageSize" => $arParams["MESSAGES_PER_PAGE"], 'iNumPage' => $arFields["iNumPage"] > 0 ? $arFields["iNumPage"] : false, "bShowAll" => false);
if (intVal($MID) > 0 && $pageNo > 0) {
$arFields["iNumPage"] = intVal($pageNo);
}
$db_res = CForumMessage::GetListEx($arOrder, array("FORUM_ID" => $arParams["FORUM_ID"], "TOPIC_ID" => $arResult["FORUM_TOPIC_ID"], "APPROVED" => "Y"), false, 0, $arFields);
$arResult["NAV_PAGE_COUNT"] = false;
if ($db_res) {
$arResult['NAV_PAGE_COUNT'] = $db_res->NavPageCount;
}
$arAvatars = array();
if ($db_res) {
$arResult["NAV_STRING"] = $db_res->GetPageNavStringEx($navComponentObject, GetMessage("NAV_OPINIONS"), $arParams["PAGE_NAVIGATION_TEMPLATE"]);
$number = intVal($db_res->NavPageNomer - 1) * $arParams["MESSAGES_PER_PAGE"] + 1;
while ($res = $db_res->GetNext()) {
/* * ************ Message info ************************************** */
// number in topic
$res["NUMBER"] = $number++;
// data
$res["~POST_DATE"] = $res["POST_DATE"];
$res["~EDIT_DATE"] = $res["EDIT_DATE"];
示例7: CPHPCache
{
$description = '';
$cache = new CPHPCache();
$cache_path = $GLOBALS['CACHE_MANAGER']->GetCompCachePath(CComponentEngine::MakeComponentPath($this->__name));
$arCacheID = array($arParams['FID'], $arParams['TID']);
$cache_id = "forum_topic_desc_".md5(serialize($arCacheID));
if ($cache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path))
{
$descRes = $cache->GetVars();
$description = $descRes["Description"];
}
if ($description == '')
{
$db_res = CForumMessage::GetListEx(array("ID" => "ASC"), array("TOPIC_ID" => $arParams["TID"]), 0, 1);
if ($db_res && $arRes = $db_res->GetNext())
{
$description = HTMLToTxt($parser->convert($arRes['POST_MESSAGE'], $arAllow),'', array(
"/(<img\s.*?src\s*=\s*)([\"']?)(\\/.*?)(\\2)(\s.+?>|\s*>)/is", // from HTMLToTxt
"/(<img\s.*?src\s*=\s*)([\"']?)(.*?)(\\2)(\s.+?>|\s*>)/is",
"/(<a\s.*?href\s*=\s*)([\"']?)(\\/.*?)(\\2)(.*?>)(.*?)<\\/a>/is",
"/(<a\s.*?href\s*=\s*)([\"']?)(.*?)(\\2)(.*?>)(.*?)<\\/a>/is",
));
$description = str_replace(array("\r", "\n"), "", $description);
if (strlen($description) > 512)
{
$description = substr($description,0,512);
$rSpace = strrpos($description, ' ');
if ($rSpace !== false)
$description = substr($description, 0, $rSpace).'...';
示例8: ShowMessage
echo ShowMessage(array("MESSAGE" => $strErrorMessage, "TYPE" => "ERROR"));
echo ShowMessage(array("MESSAGE" => $strOKMessage, "TYPE" => "OK"));
$tmp = 0;
$db_res = CForumMessage::GetList(array("ID" => "DESC"), array("TOPIC_ID" => $TID), false, 1);
if ($ar_res = $db_res->Fetch()) {
$tmp = IntVal($ar_res["ID"]);
}
$arTopic["iLAST_TOPIC_MESSAGE"] = $tmp;
$arFilter = array("TOPIC_ID" => $TID);
if ($PermissionUser < "Q") {
$arFilter["APPROVED"] = "Y";
}
if ($USER->IsAuthorized()) {
$arFilter["POINTS_TO_AUTHOR_ID"] = $USER->GetID();
}
$db_Message = CForumMessage::GetListEx(array("ID" => "ASC"), $arFilter);
global $HTTP_GET_VARS;
unset($_GET["MID"]);
unset($HTTP_GET_VARS["MID"]);
unset($_GET["ACTION"]);
unset($HTTP_GET_VARS["ACTION"]);
if ($MID > 0) {
$db_Message->NavStart($GLOBALS["FORUM_MESSAGES_PER_PAGE"], false, CForumMessage::GetMessagePage($MID, $GLOBALS["FORUM_MESSAGES_PER_PAGE"], $USER->GetUserGroupArray()));
} else {
$db_Message->NavStart($GLOBALS["FORUM_MESSAGES_PER_PAGE"], false);
}
$UserInfo = array();
$arCurrUser = array();
$arCurrUser["Rank"] = CForumUser::GetUserRank(IntVal($USER->GetParam("USER_ID")));
$arCurrUser["bCanUserDeleteMessages"] = CForumTopic::CanUserDeleteTopicMessage($TID, $USER->GetUserGroupArray(), $USER->GetID());
$arCurrUser["Perms"] = ForumCurrUserPermissions($FID);
示例9: 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);
}
}
}
}
}
示例10: array
$err = $GLOBALS['APPLICATION']->GetException();
$arResult["ERROR_MESSAGE"] .= $err->GetString();
}
$arResult["OK_MESSAGE"] = $strOKMessage;
}
/********************************************************************
/Action
********************************************************************/
/********************************************************************
Data
********************************************************************/
$arFilter = array("APPROVED" => "N", "FORUM_ID" => $arParams["FID"]);
if ($arParams["TID"] > 0) {
$arFilter["TOPIC_ID"] = $arParams["TID"];
}
$db_Message = CForumMessage::GetListEx(array("ID" => "ASC"), $arFilter, false, 0, array("sNameTemplate" => $arParams["NAME_TEMPLATE"]));
$db_Message->nPageWindow = $arParams["PAGE_NAVIGATION_WINDOW"];
$db_Message->NavStart($arParams["MESSAGES_PER_PAGE"], false);
$arResult["NAV_RESULT"] = $db_Message;
$arResult["NAV_STRING"] = $db_Message->GetPageNavStringEx($navComponentObject, GetMessage("F_TITLE_NAV"), $arParams["PAGE_NAVIGATION_TEMPLATE"]);
if ($db_Message && ($res = $db_Message->GetNext())) {
$iCount = 1;
$arResult["SHOW_RESULT"] = "Y";
do {
$res["NUMBER"] = $iCount++;
// data
$res["POST_DATE"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["POST_DATE"], CSite::GetDateFormat()));
$res["EDIT_DATE"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["EDIT_DATE"], CSite::GetDateFormat()));
// text
$res["ALLOW"] = array_merge($arAllow, array("SMILES" => $res["USE_SMILES"] == "Y" ? $arResult["FORUM"]["ALLOW_SMILES"] : "N"));
$res["~POST_MESSAGE_TEXT"] = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $res["~POST_MESSAGE_FILTER"] : $res["~POST_MESSAGE"];
示例11: array
}
$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"]));
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 {
示例12: createLogComment
private function createLogComment($messageID, $bSocNetLogRecordExists, $iblockElementID, $topicID, $arLogParams)
{
$dbComment = CSocNetLogComments::GetList(array(), array('EVENT_ID' => 'wiki_comment', 'SOURCE_ID' => $messageID), false, false, array('ID'));
if (($arComment = $dbComment->Fetch()) && intval($arComment['ID']) > 0) {
return false;
}
$arForum = CForumNew::GetByID($this->ForumID);
$parser = new textParser(LANGUAGE_ID, $this->arPath['PATH_TO_SMILE']);
$parser->image_params['width'] = false;
$parser->image_params['height'] = false;
$arAllow = array('HTML' => "N", 'ANCHOR' => "N", 'BIU' => "N", 'IMG' => "N", 'LIST' => "N", 'QUOTE' => "N", 'CODE' => "N", 'FONT' => "N", 'UPLOAD' => $arForum['ALLOW_UPLOAD'], 'NL2BR' => "N", 'SMILES' => "N");
if ($bSocNetLogRecordExists) {
$arMessage = CForumMessage::GetByIDEx($messageID);
$sAuthorForMail = str_replace('#TITLE#', $arMessage['AUTHOR_NAME'], GetMessage('SONET_FORUM_LOG_TEMPLATE_GUEST'));
$parser = new textParser(LANGUAGE_ID, $this->arPath['PATH_TO_SMILE']);
$parser->image_params['width'] = false;
$parser->image_params['height'] = false;
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$sAuthorForMail = str_replace(array('#URL#', '#TITLE#'), array('http://' . SITE_SERVER_NAME . CComponentEngine::MakePathFromTemplate($this->arPath['PATH_TO_USER'], array('user_id' => $arMessage['AUTHOR_ID'])), $arMessage['AUTHOR_NAME']), GetMessage('SONET_FORUM_LOG_TEMPLATE_AUTHOR'));
}
$arFieldsForSocnet = array('ENTITY_TYPE' => SONET_SUBSCRIBE_ENTITY_GROUP, 'ENTITY_ID' => intval($this->SonetGroupID), 'EVENT_ID' => 'wiki_comment', '=LOG_DATE' => $GLOBALS['DB']->CharToDateFunction($arMessage['POST_DATE'], "FULL", SITE_ID), 'MESSAGE' => $parser->convert($arMessage['POST_MESSAGE'], $arAllow), 'TEXT_MESSAGE' => $parser->convert4mail($arMessage['POST_MESSAGE'] . $sAuthorForMail), 'URL' => $arLogParams["URL"], 'MODULE_ID' => false, 'SOURCE_ID' => $messageID, 'LOG_ID' => $arLogParams["LOG_ID"], 'RATING_TYPE_ID' => 'FORUM_POST', 'RATING_ENTITY_ID' => intval($arMessage['ID']));
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$arFieldsForSocnet['USER_ID'] = $arMessage['AUTHOR_ID'];
}
$log_comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
if ($log_comment_id) {
CSocNetLog::CounterIncrement($log_comment_id, false, false, "LC");
if (CModule::IncludeModule("im") && intval($arMessage["AUTHOR_ID"]) > 0 && $arMessage["AUTHOR_ID"] != $arLogParams["LOG_USER_ID"]) {
$rsUnFollower = CSocNetLogFollow::GetList(array("USER_ID" => $arLogParams["LOG_USER_ID"], "CODE" => "L" . $arLogParams["LOG_ID"], "TYPE" => "N"), array("USER_ID"));
$arUnFollower = $rsUnFollower->Fetch();
if (!$arUnFollower) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arLogParams["LOG_USER_ID"], "FROM_USER_ID" => $arMessage["AUTHOR_ID"], "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "wiki", "NOTIFY_EVENT" => "comment");
$arParams["TITLE"] = str_replace(array("\r\n", "\n"), " ", $arLogParams["LOG_TITLE"]);
$arParams["TITLE"] = TruncateText($arParams["TITLE"], 100);
$arParams["TITLE_OUT"] = TruncateText($arParams["TITLE"], 255);
$arTmp = CSocNetLogTools::ProcessPath(array("ELEMENT_URL" => $arLogParams["URL"]), $arLogParams["LOG_USER_ID"]);
$serverName = $arTmp["SERVER_NAME"];
$url = $arTmp["URLS"]["ELEMENT_URL"];
$arMessageFields["NOTIFY_TAG"] = "WIKI|COMMENT|" . $iblockElementID;
$arMessageFields["NOTIFY_MESSAGE"] = GetMessage("WIKI_SONET_IM_COMMENT", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arParams["TITLE"]) . "</a>"));
$arMessageFields["NOTIFY_MESSAGE_OUT"] = GetMessage("WIKI_SONET_IM_COMMENT", array("#title#" => htmlspecialcharsbx($arParams["TITLE_OUT"]))) . " (" . $serverName . $url . ")#BR##BR#" . $arFieldsForSocnet["MESSAGE"];
CIMNotify::Add($arMessageFields);
}
}
}
} else {
$dbMessage = CForumMessage::GetListEx(array(), array("TOPIC_ID" => $topicID, "NEW_TOPIC" => "N"));
while ($arMessage = $dbMessage->GetNext()) {
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$sAuthorForMail = str_replace(array('#URL#', '#TITLE#'), array('http://' . SITE_SERVER_NAME . CComponentEngine::MakePathFromTemplate($this->arPath['PATH_TO_USER'], array('user_id' => $arMessage['AUTHOR_ID'])), $arMessage['AUTHOR_NAME']), GetMessage('SONET_FORUM_LOG_TEMPLATE_AUTHOR'));
}
$arFieldsForSocnet = array('ENTITY_TYPE' => SONET_SUBSCRIBE_ENTITY_GROUP, 'ENTITY_ID' => intval($this->SonetGroupID), 'EVENT_ID' => 'wiki_comment', '=LOG_DATE' => $GLOBALS['DB']->CharToDateFunction($arMessage['POST_DATE'], "FULL", SITE_ID), 'MESSAGE' => $parser->convert($arMessage['POST_MESSAGE'], $arAllow), 'TEXT_MESSAGE' => $parser->convert4mail($arMessage['POST_MESSAGE'] . $sAuthorForMail), 'URL' => $arLogParams["URL"], 'MODULE_ID' => false, 'SOURCE_ID' => $arMessage['ID'], 'LOG_ID' => $arLogParams["LOG_ID"], 'RATING_TYPE_ID' => 'FORUM_POST', 'RATING_ENTITY_ID' => intval($arMessage['ID']));
if (intVal($arMessage['AUTHOR_ID']) > 0) {
$arFieldsForSocnet['USER_ID'] = $arMessage['AUTHOR_ID'];
}
$log_comment_id = CSocNetLogComments::Add($arFieldsForSocnet, false, false);
CSocNetLog::CounterIncrement($log_comment_id, false, false, "LC");
}
}
}
示例13: array
$ids = array();
while ($res = $db_res->GetNext()) {
if (strlen($res["LAST_POST_DATE"]) > 0) {
$res["LAST_POST_DATE"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["LAST_POST_DATE"], CSite::GetDateFormat()));
}
$res["URL"] = array("AUTHOR" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["USER_START_ID"])), "~AUTHOR" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["USER_START_ID"])), "READ" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => intVal($res["LAST_MESSAGE_ID"]))) . "#message" . intVal($res["LAST_MESSAGE_ID"]), "~READ" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => $res["ID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => intVal($res["LAST_MESSAGE_ID"]))) . "#message" . intVal($res["LAST_MESSAGE_ID"]));
$res["user_start_id_profile"] = $res["URL"]["AUTHOR"];
// For custom
$res["read"] = $res["URL"]["READ"];
// For custom
$arTopics[$res["ID"]] = $res;
$ids[$res['ID']] = $res['LAST_MESSAGE_ID'];
}
}
if ($arParams['SHOW_TOPIC_POST_MESSAGE'] != 'NONE' && !empty($arTopics)) {
$db_res = CForumMessage::GetListEx(array("ID" => "ASC"), $arParams['SHOW_TOPIC_POST_MESSAGE'] == 'FIRST_POST' ? array("@TOPIC_ID" => array_keys($ids), 'APPROVED' => 'Y', 'NEW_TOPIC' => 'Y') : array("@ID" => array_values($ids), 'APPROVED' => 'Y'));
$ids = array();
while ($res = $db_res->GetNext()) {
$ids[] = $res["ID"];
$res["~POST_MESSAGE_TEXT"] = COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $res["~POST_MESSAGE_FILTER"] : $res["~POST_MESSAGE"];
if (!empty($arParams["NAME_TEMPLATE"]) && $res["SHOW_NAME"] != "Y") {
$name = CUser::FormatName($arParams["NAME_TEMPLATE"], array("NAME" => $res["NAME"], "LAST_NAME" => $res["LAST_NAME"], "SECOND_NAME" => $res["SECOND_NAME"], "LOGIN" => $res["LOGIN"]), true, false);
if (!!$name) {
$res["~AUTHOR_NAME"] = $name;
$res["AUTHOR_NAME"] = htmlspecialcharsbx($name);
}
}
$res["AUTHOR_ID"] = intval($res["AUTHOR_ID"]);
$res["AUTHOR_URL"] = "";
if (!empty($arParams["URL_TEMPLATES_PROFILE_VIEW"])) {
$res["AUTHOR_URL"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("user_id" => $res["AUTHOR_ID"]));
示例14: 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");
}
}
}
}
示例15: ForumGetFirstUnreadMessage
function ForumGetFirstUnreadMessage($FID, $TID)
{
global $USER, $DB;
$TID = intVal($TID);
if ($TID > 0) {
if (intVal($_SESSION["FORUM"]["LAST_VISIT_FORUM_0"]) <= 0) {
ForumInitParams();
}
$LastVisit = max(intVal($_SESSION["FORUM"]["LAST_VISIT_FORUM_0"]), intVal($_SESSION["FORUM"]["LAST_VISIT_FORUM_" . $FID]));
// client TZ
if ($USER->IsAuthorized()) {
$db_res = CForumMessage::GetListEx(array("ID" => "ASC"), array("TOPIC_ID" => $TID, "USER_ID" => $USER->GetId(), ">NEW_MESSAGE" => Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL", LANG)), $LastVisit)), 0, 1);
} else {
$LastVisit = max($LastVisit, intVal($_SESSION["FORUM"]["GUEST_TID"][$TID]));
$db_res = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $TID, ">POST_DATE" => Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL", LANG)), $LastVisit)), 0, 1);
}
if ($db_res && ($res = $db_res->Fetch())) {
return $res["ID"];
}
}
return false;
}