本文整理汇总了PHP中CForumNew::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumNew::GetByID方法的具体用法?PHP CForumNew::GetByID怎么用?PHP CForumNew::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumNew
的用法示例。
在下文中一共展示了CForumNew::GetByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Create new comment for task
*
* @param integer $taskId
* @param integet $commentId
* @param integer $commentEditorId - ID of user who is comment's editor
* @param string[] $arFields - fields to be updated, including text in BB code
*
* @throws TasksException, CTaskAssertException
*
* @return boolean
*/
public static function update($taskId, $commentId, $commentEditorId, $arFields)
{
CTaskAssert::assertLaxIntegers($taskId, $commentId, $commentEditorId);
CTaskAssert::assert(is_array($arFields) && !empty($arFields));
if (!CModule::includeModule('forum')) {
throw new TasksException('forum module can not be loaded', TasksException::TE_ACTION_FAILED_TO_BE_PROCESSED);
}
IncludeModuleLangFile(__FILE__);
$forumId = CTasksTools::GetForumIdForIntranet();
$oTask = CTaskItem::getInstance($taskId, $commentEditorId);
$arTask = $oTask->getData();
$outForumTopicId = $outStrUrl = null;
$arErrorCodes = array();
$arFields = array_merge(array('EDITOR_ID' => $commentEditorId), $arFields);
$messageId = self::__deprecated_Add($arFields['POST_MESSAGE'], $forumTopicId = $arTask['FORUM_TOPIC_ID'], $forumId, $nameTemplate = CSite::GetNameFormat(false), $arTask = $arTask, $permissions = 'Y', $commentId = $commentId, $givenUserId = $commentEditorId, $imageWidth = 300, $imageHeight = 300, $arSmiles = array(), $arForum = CForumNew::GetByID($forumId), $messagesPerPage = 10, $arUserGroupArray = CUser::GetUserGroup($commentEditorId), $backPage = null, $strMsgAddComment = GetMessage("TASKS_COMMENT_MESSAGE_ADD"), $strMsgEditComment = GetMessage("TASKS_COMMENT_MESSAGE_EDIT"), $strMsgNewTask = GetMessage("TASKS_COMMENT_SONET_NEW_TASK_MESSAGE"), $componentName = null, $outForumTopicId, $arErrorCodes, $outStrUrl, $arFields);
if (!($messageId >= 1)) {
throw new TasksException(serialize($arErrorCodes), TasksException::TE_ACTION_FAILED_TO_BE_PROCESSED | TasksException::TE_FLAG_SERIALIZED_ERRORS_IN_MESSAGE);
}
return true;
}
示例2: GetMessage
$arWarnings[] = GetMessage("CC_BSR_WARN_WIKI_GROUP_IBLOCK", array("#href#" => htmlspecialcharsbx(BX_ROOT . "/admin/iblock_edit.php?type=" . urlencode($arIBlock["IBLOCK_TYPE_ID"]) . "&lang=" . LANGUAGE_ID . "&ID=" . urlencode($arIBlock["ID"]) . "&admin=Y&return_url=" . urlencode($APPLICATION->GetCurPageParam()))));
}
$arSteps["group_wiki"] = GetMessage("CC_BSR_STEP_GROUPS_WIKI");
}
if (intval($arParams["FILES_USER_IBLOCK_ID"]) && CModule::IncludeModule('iblock')) {
$arIBlock = CIBlock::GetArrayByID($arParams["FILES_USER_IBLOCK_ID"]);
if ($arIBlock["INDEX_ELEMENT"] === "Y" || $arIBlock["INDEX_SECTION"] === "Y") {
$arWarnings[] = GetMessage("CC_BSR_WARN_FILE_USER_IBLOCK", array("#href#" => htmlspecialcharsbx(BX_ROOT . "/admin/iblock_edit.php?type=" . urlencode($arIBlock["IBLOCK_TYPE_ID"]) . "&lang=" . LANGUAGE_ID . "&ID=" . urlencode($arIBlock["ID"]) . "&admin=Y&return_url=" . urlencode($APPLICATION->GetCurPageParam()))));
}
if (strlen($arParams["PATH_TO_USER_FILES_ELEMENT"])) {
$arSteps["user_files"] = GetMessage("CC_BSR_STEP_USERS_FILES");
}
}
if (array_key_exists("group_files", $arSteps) || array_key_exists("user_files", $arSteps)) {
if (intval($arParams["FILES_FORUM_ID"]) && CModule::IncludeModule('forum')) {
$arForum = CForumNew::GetByID($arParams["FILES_FORUM_ID"]);
if ($arForum === false) {
$arWarnings[] = GetMessage("CC_BSR_WARN_FILES_FORUM_NOT_FOUND", array("#FORUM_ID#" => htmlspecialcharsbx($arParams["FILES_FORUM_ID"])));
} else {
if ($arForum["INDEXATION"] !== "Y") {
$arWarnings[] = GetMessage("CC_BSR_WARN_FILES_FORUM", array("#href#" => htmlspecialcharsbx(BX_ROOT . "/admin/forum_edit.php?lang=" . LANGUAGE_ID . "&ID=" . intval($arForum["ID"]))));
}
}
} else {
if ($arParams["FILES_USE_COMMENTS"] != "N") {
$arWarnings[] = GetMessage("CC_BSR_WARN_FILES_FORUM_NOT_SET");
}
}
}
if (count($arWarnings) > 0) {
$arWarnings[] = GetMessage("CC_BSR_WARN_REINDEX", array("#href#" => htmlspecialcharsbx(BX_ROOT . "/admin/search_reindex.php?lang=" . LANGUAGE_ID)));
示例3: elseif
case "FORUM_TOPIC_CLOSE":
case "FORUM_TOPIC_MOVE":
case "FORUM_TOPIC_EDIT":
if (intval($a_ITEM_ID) <= 0) {
continue;
} elseif (!array_key_exists($a_ITEM_ID, $arForumCache["TOPIC"])) {
CModule::IncludeModule("forum");
$res = CForumTopic::GetByID($a_ITEM_ID);
$res["MESSAGE_ID"] = $res["LAST_MESSAGE_ID"];
$res["TOPIC_ID"] = $res["ID"];
$arForumCache["TOPIC"][$a_ITEM_ID] = $res;
} else {
$res = $arForumCache["TOPIC"][$a_ITEM_ID];
}
if (!array_key_exists($res["FORUM_ID"], $arForumCache["FORUM"])) {
$arForumCache["FORUM"][$res["FORUM_ID"]] = CForumNew::GetByID($res["FORUM_ID"]);
if ($arForumCache["FORUM"][$res["FORUM_ID"]]) {
$arSitesPath = CForumNew::GetSites($res["FORUM_ID"]);
$arForumCache["FORUM"][$res["FORUM_ID"]]["PATH"] = array_shift($arSitesPath);
}
}
if ($arForumCache["FORUM"][$res["FORUM_ID"]]["PATH"]) {
$sPath = CForumNew::PreparePath2Message($arForumCache["FORUM"][$res["FORUM_ID"]]["PATH"], $res);
$row->AddViewField("ITEM_ID", '[<a href="' . $sPath . '">' . $a_ITEM_ID . '</a>] ' . GetMessage("MAIN_EVENTLOG_FORUM_TOPIC"));
} else {
$row->AddViewField("ITEM_ID", '[' . $a_ITEM_ID . '] ' . GetMessage("MAIN_EVENTLOG_FORUM_TOPIC"));
}
break;
case "FORUM_MESSAGE_DELETE":
$row->AddViewField("ITEM_ID", '[' . $a_ITEM_ID . '] ' . GetMessage("MAIN_EVENTLOG_FORUM_MESSAGE"));
break;
示例4: array
/Default values
********************************************************************/
/********************************************************************
Data
********************************************************************/
$db_res = CForumSubscribe::GetList(array("FORUM_ID" => "ASC", "TOPIC_ID" => "ASC", "START_DATE" => "ASC"), array("USER_ID" => $arParams["UID"]));
$db_res->NavStart($arParams["TOPICS_PER_PAGE"]);
$db_res->nPageWindow = $arParams["PAGE_NAVIGATION_WINDOW"];
$db_res->bShowAll = false;
$arResult["NAV_RESULT"] = $db_res;
$arResult["NAV_STRING"] = $db_res->GetPageNavStringEx($navComponentObject, GetMessage("F_SUBSCRIBE"), $arParams["PAGE_NAVIGATION_TEMPLATE"]);
if ($db_res && ($res = $db_res->GetNext())) {
$arResult["SHOW_SUBSCRIBE_LIST"] = "Y";
do {
if (!isset($arResult["FORUMS"][$res["FORUM_ID"]])) {
$arResult["FORUMS"][$res["FORUM_ID"]] = CForumNew::GetByID($res["FORUM_ID"]);
}
if (!isset($arResult["TOPICS"][$res["TOPIC_ID"]])) {
$arResult["TOPICS"][$res["TOPIC_ID"]] = htmlspecialcharsEx(CForumTopic::GetByID($res["TOPIC_ID"]));
}
$res["FORUM_INFO"] = $arResult["FORUMS"][$res["FORUM_ID"]];
$res["TOPIC_INFO"] = $arResult["TOPICS"][$res["TOPIC_ID"]];
$res["START_DATE"] = trim($res["START_DATE"]);
if (strLen($res["START_DATE"]) > 0) {
$res["START_DATE"] = CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["START_DATE"], CSite::GetDateFormat()));
}
$res["SUBSCRIBE_TYPE"] = intVal($res["TOPIC_ID"]) > 0 ? "TOPIC" : ($res["NEW_TOPIC_ONLY"] == "Y" ? "NEW_TOPIC_ONLY" : "ALL_MESSAGES");
$res["LAST_SEND"] = intVal($res["LAST_SEND"]);
$res["read"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_READ"], array("FID" => $res["FORUM_ID"], "TID" => $res["TOPIC_ID"], "MID" => "s"));
$res["list"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_LIST"], array("FID" => $res["FORUM_ID"]));
$res["read_last_send"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["FORUM_ID"], "TID" => intVal($res["TOPIC_ID"]), "MID" => intVal($res["LAST_SEND"]))) . "#message" . intVal($res["LAST_SEND"]);
示例5: CPHPCache
$cache = new CPHPCache();
$cache_path_main = str_replace(array(":", "//"), "/", "/" . SITE_ID . "/" . $componentName . "/");
/********************************************************************
/Default values
********************************************************************/
/********************************************************************
Action
********************************************************************/
if (strToUpper($_REQUEST["action"]) == "MOVE" && check_bitrix_sessid()) {
$strErrorMessage = "";
$strOKMessage = "";
$result = false;
if (intVal($arParams["newFID"]) <= 0) {
$strErrorMessage = GetMessage("FM_EMPTY_DEST_FORUM") . ". \n";
} else {
$arResult["FORUM_NEW"] = CForumNew::GetByID($arParams["newFID"]);
if (ForumCurrUserPermissions($arParams["newFID"]) < "Q" && $arResult["FORUM_NEW"]["ALLOW_MOVE_TOPIC"] != "Y") {
$strErrorMessage = GetMessage("FM_NO_DEST_FPERMS") . ". \n";
} else {
$result = CForumTopic::MoveTopic2Forum($topics, $arParams["newFID"], $_REQUEST["leaveLink"]);
}
}
if (!$result) {
if ($GLOBALS['APPLICATION']->GetException()) {
$arErr = $GLOBALS['APPLICATION']->ERROR_STACK;
if (is_array($arErr) && count($arErr) > 0) {
foreach ($arErr as $res) {
$strErrorMessage .= $res["msg"] . "\n";
}
}
$err = $GLOBALS['APPLICATION']->GetException();
示例6: AddComment_News
function AddComment_News($arFields)
{
if (!CModule::IncludeModule("forum")) {
return false;
}
if (!CModule::IncludeModule("iblock")) {
return false;
}
if (!CModule::IncludeModule("socialnetwork")) {
return false;
}
$dbResult = CSocNetLog::GetList(array("ID" => "DESC"), array("TMP_ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "PARAMS"));
$bFound = false;
if ($arLog = $dbResult->Fetch()) {
if (intval($arLog["SOURCE_ID"]) > 0) {
$arFilter = array("ID" => $arLog["SOURCE_ID"]);
$arSelectedFields = array("IBLOCK_ID", "ID", "CREATED_BY", "NAME", "PROPERTY_FORUM_TOPIC_ID", "PROPERTY_FORUM_MESSAGE_CNT");
$db_res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelectedFields);
if ($db_res && ($res = $db_res->GetNext())) {
$arElement = $res;
$val = COption::GetOptionString("intranet", "sonet_log_news_iblock_forum");
if (strlen($val) > 0) {
$arIBlockForum = unserialize($val);
} else {
$arIBlockForum = array();
}
if (array_key_exists($arElement["IBLOCK_ID"], $arIBlockForum)) {
$FORUM_ID = $arIBlockForum[$arElement["IBLOCK_ID"]];
}
if (intval($FORUM_ID) > 0) {
CSocNetLogTools::AddComment_Review_CheckIBlock($arElement);
$dbMessage = CForumMessage::GetList(array(), array("PARAM2" => $arElement["ID"]));
if (!($arMessage = $dbMessage->Fetch())) {
// Add Topic
$TOPIC_ID = CSocNetLogTools::AddComment_Review_CreateRoot($arElement, $FORUM_ID);
$bNewTopic = true;
} else {
$TOPIC_ID = $arMessage["TOPIC_ID"];
}
if (intval($TOPIC_ID) > 0) {
// Add comment
$messageID = false;
$bError = false;
if (CForumMessage::CanUserAddMessage($TOPIC_ID, $GLOBALS["USER"]->GetUserGroupArray(), $GLOBALS["USER"]->GetID(), false)) {
$bSHOW_NAME = true;
$res = CForumUser::GetByUSER_ID($GLOBALS["USER"]->GetID());
if ($res) {
$bSHOW_NAME = $res["SHOW_NAME"] == "Y";
}
if ($bSHOW_NAME) {
$AUTHOR_NAME = $GLOBALS["USER"]->GetFullName();
}
if (strlen(Trim($AUTHOR_NAME)) <= 0) {
$AUTHOR_NAME = $GLOBALS["USER"]->GetLogin();
}
if (strlen($AUTHOR_NAME) <= 0) {
$bError = true;
}
}
if (!$bError) {
$arFieldsMessage = array("POST_MESSAGE" => $arFields["TEXT_MESSAGE"], "USE_SMILES" => "Y", "APPROVED" => "Y", "PARAM2" => $arElement["ID"], "AUTHOR_NAME" => $AUTHOR_NAME, "AUTHOR_ID" => IntVal($GLOBALS["USER"]->GetParam("USER_ID")), "FORUM_ID" => $FORUM_ID, "TOPIC_ID" => $TOPIC_ID, "NEW_TOPIC" => "N", "GUEST_ID" => $_SESSION["SESS_GUEST_ID"], "ADD_TO_LOG" => "N");
$AUTHOR_IP = ForumGetRealIP();
$AUTHOR_IP_tmp = $AUTHOR_IP;
$AUTHOR_REAL_IP = $_SERVER['REMOTE_ADDR'];
if (COption::GetOptionString("forum", "FORUM_GETHOSTBYADDR", "N") == "Y") {
$AUTHOR_IP = @gethostbyaddr($AUTHOR_IP);
if ($AUTHOR_IP_tmp == $AUTHOR_REAL_IP) {
$AUTHOR_REAL_IP = $AUTHOR_IP;
} else {
$AUTHOR_REAL_IP = @gethostbyaddr($AUTHOR_REAL_IP);
}
}
$arFieldsMessage["AUTHOR_IP"] = $AUTHOR_IP !== False ? $AUTHOR_IP : "<no address>";
$arFieldsMessage["AUTHOR_REAL_IP"] = $AUTHOR_REAL_IP !== False ? $AUTHOR_REAL_IP : "<no address>";
$messageID = CForumMessage::Add($arFieldsMessage, false);
if (intVal($messageID) <= 0) {
$bError = true;
} else {
if (CModule::IncludeModule("statistic")) {
$arForum = CForumNew::GetByID($FORUM_ID);
$F_EVENT1 = $arForum["EVENT1"];
$F_EVENT2 = $arForum["EVENT2"];
$F_EVENT3 = $arForum["EVENT3"];
if (strlen($F_EVENT3) <= 0) {
$arForumSite_tmp = CForumNew::GetSites($FORUM_ID);
$F_EVENT3 = CForumNew::PreparePath2Message($arForumSite_tmp[SITE_ID], array("FORUM_ID" => $FORUM_ID, "TOPIC_ID" => $TOPIC_ID, "MESSAGE_ID" => $messageID));
}
CStatistic::Set_Event($F_EVENT1, $F_EVENT2, $F_EVENT3);
}
CForumMessage::SendMailMessage($messageID, array(), false, "NEW_FORUM_MESSAGE");
CSocNetLogTools::AddComment_Review_UpdateElement($arElement, $TOPIC_ID, $bNewTopic);
}
}
}
}
}
}
}
if (intval($messageID) <= 0) {
$strError = GetMessage("SONET_ADD_COMMENT_SOURCE_ERROR");
//.........这里部分代码省略.........
示例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: GetEventInfo
public static function GetEventInfo($row, $arParams)
{
if (CModule::IncludeModule('forum'))
{
$DESCRIPTION = unserialize($row['DESCRIPTION']);
$site_id = ($row['SITE_ID'] == "s1") ? "" : "site_".$row['SITE_ID']."/";
// messages
if (strpos($row['AUDIT_TYPE_ID'], "MESSAGE"))
{
$MID = $row['ITEM_ID'];
$TID = $DESCRIPTION['TOPIC_ID'];
$FID = $DESCRIPTION['FORUM_ID'];
if ($arMessage = CForumMessage::GetByID($MID))
$sPath = SITE_DIR.CComponentEngine::MakePathFromTemplate($arParams['FORUM_MESSAGE_PATH'], array("FORUM_ID" => $FID, "TOPIC_ID" => $TID, "MESSAGE_ID" => $MID, "SITE_ID" => $site_id));
else
if ($arTopic = CForumTopic::GetByID($TID))
$sPath = SITE_DIR.CComponentEngine::MakePathFromTemplate($arParams['FORUM_TOPIC_PATH'], array("FORUM_ID" => $FID, "TOPIC_ID" => $TID, "SITE_ID" => $site_id));
switch($row['AUDIT_TYPE_ID'])
{
case "FORUM_MESSAGE_APPROVE":
$EventPrint = GetMessage("LOG_FORUM_MESSAGE_APPROVE");
break;
case "FORUM_MESSAGE_UNAPPROVE":
$EventPrint = GetMessage("LOG_FORUM_MESSAGE_UNAPPROVE");
break;
case "FORUM_MESSAGE_MOVE":
$EventPrint = GetMessage("LOG_FORUM_MESSAGE_MOVE");
break;
case "FORUM_MESSAGE_EDIT":
$EventPrint = GetMessage("LOG_FORUM_MESSAGE_EDIT");
break;
case "FORUM_MESSAGE_DELETE":
$EventPrint = GetMessage("LOG_FORUM_MESSAGE_DELETE");
break;
}
}
else
// topics
{
$TID = $row["ITEM_ID"];
$FID = $DESCRIPTION['FORUM_ID'];
if ($arTopic = CForumTopic::GetByID($TID))
$sPath = SITE_DIR.CComponentEngine::MakePathFromTemplate($arParams['FORUM_TOPIC_PATH'], array("FORUM_ID" => $FID, "TOPIC_ID" => $TID, "SITE_ID" => $site_id));
switch($row['AUDIT_TYPE_ID'])
{
case "FORUM_TOPIC_APPROVE":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_APPROVE");
break;
case "FORUM_TOPIC_UNAPPROVE":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_UNAPPROVE");
break;
case "FORUM_TOPIC_STICK":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_STICK");
break;
case "FORUM_TOPIC_UNSTICK":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_UNSTICK");
break;
case "FORUM_TOPIC_OPEN":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_OPEN");
break;
case "FORUM_TOPIC_CLOSE":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_CLOSE");
break;
case "FORUM_TOPIC_DELETE":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_DELETE");
break;
case "FORUM_TOPIC_MOVE":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_MOVE", array("#FORUM#" => $DESCRIPTION["FORUM_TITLE"]));
break;
case "FORUM_TOPIC_EDIT":
$EventPrint = GetMessage("LOG_FORUM_TOPIC_EDIT");
break;
}
}
if($arForum = CForumNew::GetByID($FID))
{
$ForumPageURL = SITE_DIR.CComponentEngine::MakePathFromTemplate($arParams['FORUM_PATH'], array("FORUM_ID" => $FID, "SITE_ID" => $site_id));
$resForum = "<a href =".$ForumPageURL.">".$arForum["NAME"]."</a>";
}
else
{
$resForum = GetMessage("LOG_FORUM");
}
}
return array(
"eventType" => $EventPrint,
"eventName" => $DESCRIPTION['TITLE'],
"eventURL" => $sPath,
"pageURL" => $resForum
);
}
示例9: ForumMoveMessage
function ForumMoveMessage($FID, $TID, $Message, $NewTID = 0, $arFields, &$strErrorMessage, &$strOKMessage, $iFileSize = false)
{
global $USER, $DB;
$arError = array();
$arOK = array();
$NewFID = 0;
$arForum = array();
$arTopic = array();
$arNewForum = array();
$arNewTopic = array();
$arCurrUser = array();
$SendSubscribe = false;
//************************* Input params **************************************************************************
$TID = IntVal($TID);
$FID = IntVal($FID);
$NewTID = IntVal($NewTID);
$Message = ForumDataToArray($Message);
if (empty($Message)) {
$arError[] = GetMessage("FMM_NO_MESSAGE");
}
if ($TID <= 0) {
$arError[] = GetMessage("FMM_NO_TOPIC_SOURCE0");
} else {
$arTopic = CForumTopic::GetByID($TID);
if ($arTopic) {
$FID = IntVal($arTopic["FORUM_ID"]);
$arForum = CForumNew::GetByID($FID);
} else {
$arError[] = GetMessage("FMM_NO_TOPIC_SOURCE1");
}
}
if ($NewTID <= 0 && strLen(trim($arFields["TITLE"])) <= 0) {
$arError[] = GetMessage("FMM_NO_TOPIC_RECIPIENT0");
} elseif ($NewTID > 0) {
if ($NewTID == $TID) {
$arError[] = GetMessage("FMM_NO_TOPIC_EQUAL");
}
$arNewTopic = CForumTopic::GetByID($NewTID);
if (!$arNewTopic) {
$arError[] = GetMessage("FMM_NO_TOPIC_RECIPIENT1");
} elseif ($arNewTopic["STATE"] == "L") {
$arError[] = GetMessage("FMM_TOPIC_IS_LINK");
} else {
$NewFID = $arNewTopic["FORUM_ID"];
$arNewForum = CForumNew::GetByID($NewFID);
}
}
//*************************/Input params **************************************************************************
//*************************!Proverka prav pol'zovatelya na forume-istochnike i forume-poluchatele*********************
// Tak kak realizovan mehanizm peremeweniya tem s forumov, gde tekuwij pol'zovatel' yavlyaetsya moderatorom na forumy,
// gde on moderatorov ne yavlyaetsya, to v dannom sluchae budet ispol'zovan tot zhe samyj shablon dejstvij. Isklyucheniem
// yavlyaetsya to, chto esli pol'zovatel' na forume-poluchatele ne obladaet pravami moderirovaniya, tema budet neaktivna.
//*************************!Proverka prav pol'zovatelya*************************************************************
$arCurrUser["Perms"]["FID"] = ForumCurrUserPermissions($FID);
$arCurrUser["Perms"]["NewFID"] = ForumCurrUserPermissions($NewFID);
if ($arCurrUser["Perms"]["FID"] < "Q") {
$arError[] = GetMessage("FMM_NO_MODERATE");
}
//************************* Actions *******************************************************************************
$DB->StartTransaction();
if (count($arError) <= 0) {
// Create topic
if ($NewTID <= 0) {
$arFields["APPROVED"] = $arNewForum["MODERATION"] == "Y" ? "N" : "Y";
if ($arCurrUser["Perms"]["NewFID"] >= "Q") {
$arFields["APPROVED"] = "Y";
}
$arRes = array("NAME" => GetMessage("FR_GUEST"));
$ShowName = GetMessage("FR_GUEST");
$db_res = CForumMessage::GetList(array("ID" => "ASC"), array("@ID" => implode(",", $Message), "TOPIC_ID" => $TID));
if ($db_res && ($res = $db_res->Fetch())) {
$arRes["NAME"] = $res["AUTHOR_NAME"];
$arRes["ID"] = $res["AUTHOR_ID"];
}
$arFieldsTopic = array("TITLE" => $arFields["TITLE"], "TITLE_SEO" => $arFields["TITLE_SEO"], "DESCRIPTION" => $arFields["DESCRIPTION"], "ICON" => $arFields["ICON"], "TAGS" => $arFields["TAGS"], "FORUM_ID" => $FID, "USER_START_ID" => $arRes["ID"], "USER_START_NAME" => $arRes["NAME"], "LAST_POSTER_NAME" => $arRes["NAME"], "LAST_POSTER_ID" => $arRes["ID"], "APPROVED" => $arFields["APPROVED"]);
$NewTID = CForumTopic::Add($arFieldsTopic);
if (IntVal($NewTID) <= 0) {
$arError[] = GetMessage("FMM_NO_TOPIC_NOT_CREATED");
} else {
$arNewTopic = CForumTopic::GetByID($NewTID);
if ($arNewTopic) {
$NewFID = $FID;
$arNewForum = $arForum;
$SendSubscribe = true;
} else {
$arError[] = GetMessage("FMM_NO_TOPIC_NOT_CREATED");
}
}
}
}
if (count($arError) <= 0) {
// Move message
$db_res = CForumMessage::GetList(array(), array("@ID" => implode(",", $Message), "TOPIC_ID" => $TID));
if ($db_res && ($res = $db_res->Fetch())) {
do {
// echo "NewFID: ".$NewFID." -- FID:".$FID."<br/>";
$arMessage = array();
if ($NewFID != $FID) {
$arMessage["APPROVED"] = $arNewForum["MODERATION"] == "Y" ? "N" : "Y";
if ($arCurrUser["Perms"]["NewFID"] >= "Q") {
//.........这里部分代码省略.........
示例10: _check_iblock_prop
function _check_iblock_prop($arProperty = false)
{
static $dataType = 'IblockProperties';
$checked = $this->_dataCache($dataType);
if (!$checked) {
$arProps = $this->GetProperties();
foreach ($arProps as $code => &$arIBProp) {
if (!isset($arProperty[$code])) {
continue;
}
if ($arIBProp['PROPERTY_TYPE'] != $arProperty[$code]['type'] || $arIBProp['USER_TYPE'] != null) {
continue;
}
unset($arProperty[$code]);
}
$prp = new CIBlockProperty();
foreach ($arProperty as $sPropertyCode => $arPropertyParams) {
$properties = array("IBLOCK_ID" => $this->IBLOCK_ID, "ACTIVE" => "Y", "CODE" => $sPropertyCode, "MULTIPLE" => "N", "PROPERTY_TYPE" => $arPropertyParams["type"], "NAME" => $arPropertyParams["name"]);
if (isset($arPropertyParams["properties"])) {
$properties += $arPropertyParams["properties"];
}
$res = $prp->Add($properties);
}
if ($this->FORUM_ID !== null && empty($this->arRootSection) && CModule::IncludeModule('forum')) {
$arForum = CForumNew::GetByID($this->FORUM_ID);
if ($arForum['ACTIVE'] == 'Y') {
$arSites = CForumNew::GetSites($this->FORUM_ID);
foreach ($arSites as $siteID => $forumUrl) {
if (strpos($forumUrl, '/community/forum/') === 0) {
$arSites[$siteID] = str_replace(array('///', '//'), '/', $this->base_url . "/element/comment/#TOPIC_ID#/#MESSAGE_ID#/");
}
}
$arUpForum = array();
$arUpForum["SITES"] = $arSites;
CForumNew::Update($this->FORUM_ID, $arUpForum);
}
}
$this->_dataCache($dataType, true);
}
}
示例11: htmlspecialcharsEx
$ind++;
if ($NUM > 0 && $ind > $NUM) {
break;
}
?>
<font class="text">
<img src="/bitrix/templates/.default/forum/forum_pieces/images/news_bullet.gif" width="3" height="5" border="0"> <a href="<?php
echo $PATH2MESSAGES . (strpos($PATH2MESSAGES, "?") !== false ? "&" : "?") . "FID=" . $ar_Topic["FORUM_ID"] . "&TID=" . $ar_Topic["ID"];
?>
"><?php
echo htmlspecialcharsEx($ar_Topic["TITLE"]);
?>
</a>
<?php
if ($FID <= 0) {
$arForum = CForumNew::GetByID($ar_Topic["FORUM_ID"]);
?>
(<?php
echo str_replace("#FORUM#", htmlspecialcharsEx($arForum["NAME"]), GetMessage("FTP_IN_FORUM"));
?>
)
<?php
}
?>
<a href="<?php
echo $PATH2MESSAGES . (strpos($PATH2MESSAGES, "?") !== false ? "&" : "?") . "FID=" . $ar_Topic["FORUM_ID"] . "&TID=" . $ar_Topic["ID"] . "&MID=" . $ar_Topic["LAST_MESSAGE_ID"] . "#message" . $ar_Topic["LAST_MESSAGE_ID"];
?>
"><img src="/bitrix/templates/.default/forum/forum_pieces/images/icon_latest_reply.gif" width="18" height="9" border="0" alt="<?php
echo GetMessage("FTP_LAST_MESS");
?>
"></a>
示例12: 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);
}
}
}
}
}
示例13: 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");
}
}
}
示例14: forumTextParser
if ($arParams["FORUM_ID"]) {
$FORUM_TOPIC_ID = 0;
if ($arParams["REPORT_ID"]) {
$dbReport = CTimeManReportFull::GetByID($arParams["REPORT_ID"]);
$arReport = $dbReport->Fetch();
$FORUM_TOPIC_ID = $arReport["FORUM_TOPIC_ID"];
} else {
if ($arParams['ENTRY_ID']) {
$dbRes = CTimeManEntry::GetByID($arParams['ENTRY_ID']);
$arEntry = $dbRes->Fetch();
$FORUM_TOPIC_ID = $arEntry["FORUM_TOPIC_ID"];
}
}
if ($FORUM_TOPIC_ID > 0) {
CModule::IncludeModule("forum");
$parser = new forumTextParser(LANGUAGE_ID);
$allow = forumTextParser::GetFeatures(CForumNew::GetByID($arParams["FORUM_ID"]));
$db_res = CForumMessage::GetList(array("ID" => "ASC"), array("TOPIC_ID" => $FORUM_TOPIC_ID));
while ($ar_res = $db_res->Fetch()) {
$dbAuthor = CUser::GetByID($ar_res["AUTHOR_ID"]);
$arAuthor = $dbAuthor->Fetch();
$ar_res["AUTHOR_PHOTO"] = $arAuthor['PERSONAL_PHOTO'] > 0 ? CIntranetUtils::InitImage($arAuthor['PERSONAL_PHOTO'], 32, 0, BX_RESIZE_IMAGE_EXACT) : array();
$ar_res["AUTHOR_URL"] = str_replace(array('#ID#', '#USER_ID#'), $ar_res["AUTHOR_ID"], $user_url);
$ar_res["POST_MESSAGE_HTML"] = $parser->convert(COption::GetOptionString("forum", "FILTER", "Y") == "Y" ? $ar_res["POST_MESSAGE_FILTER"] : $ar_res["POST_MESSAGE"], $allow, "html");
$arResult["COMMENTS"][] = $ar_res;
}
}
$this->IncludeComponentTemplate();
}
// *****************************************************************************************
// *****************************************************************************************
示例15: SetStat
function SetStat($ID = 0, $arParams = array())
{
global $DB;
$ID = intVal($ID);
if ($ID <= 0) {
return false;
}
$arParams = is_array($arParams) ? $arParams : array();
$arMessage = is_array($arParams["MESSAGE"]) ? $arParams["MESSAGE"] : array();
if ($arMessage["FORUM_ID"] != $ID) {
$arMessage = array();
}
$arForum = CForumNew::GetByID($ID);
$arParams["ACTION"] = $arParams["ACTION"] == "DECREMENT" || $arParams["ACTION"] == "UPDATE" ? $arParams["ACTION"] : "INCREMENT";
$arParams["POSTS"] = intVal($arParams["POSTS"] > 0 ? $arParams["POSTS"] : 1);
$arFields = array();
if (empty($arMessage)) {
// full recount
} elseif ($arParams["ACTION"] == "INCREMENT") {
if ($arMessage["ID"] > $arForum["ABS_LAST_MESSAGE_ID"]) {
$arFields["ABS_LAST_POSTER_ID"] = intVal($arMessage["AUTHOR_ID"]) > 0 ? $arMessage["AUTHOR_ID"] : false;
$arFields["ABS_LAST_POSTER_NAME"] = $arMessage["AUTHOR_NAME"];
$arFields["ABS_LAST_POST_DATE"] = $arMessage["POST_DATE"];
$arFields["ABS_LAST_MESSAGE_ID"] = $arMessage["ID"];
if ($arMessage["APPROVED"] == "Y") {
$arFields["LAST_POSTER_ID"] = $arFields["ABS_LAST_POSTER_ID"];
$arFields["LAST_POSTER_NAME"] = $arFields["ABS_LAST_POSTER_NAME"];
$arFields["LAST_POST_DATE"] = $arFields["ABS_LAST_POST_DATE"];
$arFields["LAST_MESSAGE_ID"] = $arFields["ABS_LAST_MESSAGE_ID"];
}
}
if ($arMessage["APPROVED"] == "Y") {
$arFields["=POSTS"] = "POSTS+1";
if ($arMessage["NEW_TOPIC"] == "Y") {
$arFields["=TOPICS"] = "TOPICS+1";
}
} else {
$arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED+1";
}
} elseif ($arMessage["ID"] > $arForum["ABS_LAST_MESSAGE_ID"]) {
// full recount
} elseif ($arParams["ACTION"] == "DECREMENT" && ($arMessage["ID"] == $arForum["ABS_LAST_MESSAGE_ID"] || $arMessage["ID"] == $arForum["LAST_MESSAGE_ID"])) {
// full recount
} elseif ($arParams["ACTION"] == "DECREMENT") {
if ($arMessage["APPROVED"] == "Y") {
$arFields["=POSTS"] = "POSTS-1";
if ($arMessage["NEW_TOPIC"] == "Y") {
$arFields["=TOPICS"] = "TOPICS-1";
}
} else {
$arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED-1";
}
} elseif ($arParams["ACTION"] == "UPDATE") {
if ($arMessage["APPROVED"] == "Y") {
if ($arMessage["ID"] > $arForum["LAST_MESSAGE_ID"]) {
$arFields["LAST_POSTER_ID"] = intVal($arMessage["AUTHOR_ID"]) > 0 ? $arMessage["AUTHOR_ID"] : false;
$arFields["LAST_POSTER_NAME"] = $arMessage["AUTHOR_NAME"];
$arFields["LAST_POST_DATE"] = $arMessage["POST_DATE"];
$arFields["LAST_MESSAGE_ID"] = $arMessage["ID"];
}
$arFields["=POSTS"] = "POSTS+1";
$arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED-1";
if ($arMessage["NEW_TOPIC"] == "Y") {
$arFields["=TOPICS"] = "TOPICS+1";
}
} elseif ($arMessage["ID"] != $arForum["LAST_MESSAGE_ID"]) {
$arFields["=POSTS"] = "POSTS-1";
$arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED+1";
if ($arMessage["NEW_TOPIC"] == "Y") {
$arFields["=TOPICS"] = "TOPICS-1";
}
}
}
if (empty($arFields)) {
$res = CForumMessage::GetList(array(), array("FORUM_ID" => $ID), "cnt_not_approved");
$res = is_array($res) ? $res : array();
$res["CNT"] = intVal($res["CNT"]) - intVal($res["CNT_NOT_APPROVED"]);
$res["CNT"] = $res["CNT"] > 0 ? $res["CNT"] : 0;
$arFields = array("TOPICS" => CForumTopic::GetList(array(), array("FORUM_ID" => $ID, "APPROVED" => "Y"), true), "POSTS" => $res["CNT"], "LAST_POSTER_ID" => false, "LAST_POSTER_NAME" => false, "LAST_POST_DATE" => false, "LAST_MESSAGE_ID" => intVal($res["LAST_MESSAGE_ID"]), "POSTS_UNAPPROVED" => intVal($res["CNT_NOT_APPROVED"]), "ABS_LAST_POSTER_ID" => false, "ABS_LAST_POSTER_NAME" => false, "ABS_LAST_POST_DATE" => false, "ABS_LAST_MESSAGE_ID" => intVal($res["ABS_LAST_MESSAGE_ID"]));
if ($arFields["ABS_LAST_MESSAGE_ID"] > 0) {
$res = CForumMessage::GetByID($arFields["ABS_LAST_MESSAGE_ID"], array("FILTER" => "N"));
$arFields["ABS_LAST_POSTER_ID"] = intVal($res["AUTHOR_ID"]) > 0 ? $res["AUTHOR_ID"] : false;
$arFields["ABS_LAST_POSTER_NAME"] = $res["AUTHOR_NAME"];
$arFields["ABS_LAST_POST_DATE"] = $res["POST_DATE"];
if (intVal($arFields["LAST_MESSAGE_ID"]) > 0) {
if ($arFields["LAST_MESSAGE_ID"] < $arFields["ABS_LAST_MESSAGE_ID"]) {
$res = CForumMessage::GetByID($arFields["LAST_MESSAGE_ID"], array("FILTER" => "N"));
}
$arFields["LAST_POSTER_ID"] = intVal($res["AUTHOR_ID"]) > 0 ? $res["AUTHOR_ID"] : false;
$arFields["LAST_POSTER_NAME"] = $res["AUTHOR_NAME"];
$arFields["LAST_POST_DATE"] = $res["POST_DATE"];
}
}
}
if (!CForumNew::CheckFields("UPDATE", $arFields)) {
return false;
}
$strUpdate = $DB->PrepareUpdate("b_forum", $arFields);
if (!empty($arFields)) {
$res = array();
//.........这里部分代码省略.........