} } if (empty($arResult["TOPIC"])): elseif ($arResult["TOPIC"]["STATE"] == "L" && intVal($arResult["TOPIC"]["TOPIC_ID"]) > 0): $res = CForumTopic::GetByIDEx($arResult["TOPIC"]["TOPIC_ID"], array("GET_FORUM_INFO" => "Y")); if (empty($res)): $arError = array( "code" => "404", "title" => GetMessage("F_ERROR_TID_IS_LOST")); else: $arResult["TOPIC"] = $res; $arResult["FORUM"] = $res["FORUM_INFO"]; endif; elseif (!CForumNew::CanUserViewForum($arResult["FORUM"]["ID"], $arUserGroups)): $APPLICATION->AuthForm(GetMessage("F_FPERMS")); elseif (!CForumTopic::CanUserViewTopic($arResult["TOPIC"]["ID"], $arUserGroups)): // Topic is approve? For moderation forum. $arError = array( "code" => "tid_not_approved", "title" => GetMessage("F_ERROR_TID_NOT_APPROVED"), "link" => CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_LIST"], array("FID" => $arParams["FID"]))); endif; /******************************************************************** /Main Data & Permissions ********************************************************************/ if ($arError["code"] == "404"): CHTTP::SetStatus("404 Not Found"); ShowError($arError["title"]); return false;
$bVarsFromForm = false; $PermissionUser = ForumCurrUserPermissions($arForum["ID"]); if ($PermissionUser < "E") { $APPLICATION->AuthForm(GetMessage("FR_FPERMS")); } //*************************!Subscribe****************************************************************************** if ($_REQUEST["TOPIC_SUBSCRIBE"] == "Y" || $_REQUEST["FORUM_SUBSCRIBE"] == "Y") { if ($_REQUEST["TOPIC_SUBSCRIBE"] == "Y") { ForumSubscribeNewMessagesEx($FID, $TID, "N", $strErrorMessage, $strOKMessage); } if ($_REQUEST["FORUM_SUBSCRIBE"] == "Y") { ForumSubscribeNewMessagesEx($FID, 0, "N", $strErrorMessage, $strOKMessage); } } //*************************!Subscribe****************************************************************************** if (!CForumTopic::CanUserViewTopic($TID, $USER->GetUserGroupArray())) { LocalRedirect("list.php?FID=" . $FID . "&TID=Y"); } ForumSetLastVisit($FID, $TID); ForumSetReadTopic($FID, $TID); //*************************!Action********************************************************************************* if ($_POST["MESSAGE_MODE"] != "VIEW" && (strLen(trim($_REQUEST["ACTION"])) > 0 || $_REQUEST["VOTE4USER"] == "Y" || $_POST["MESSAGE_TYPE"] == "REPLY") && check_bitrix_sessid()) { if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["MESSAGE_TYPE"] == "REPLY" && check_bitrix_sessid()) { $arFieldsG = array("POST_MESSAGE" => $_POST["POST_MESSAGE"], "AUTHOR_NAME" => trim($_POST["AUTHOR_NAME"]), "AUTHOR_EMAIL" => $_POST["AUTHOR_EMAIL"], "USE_SMILES" => $_POST["USE_SMILES"], "ATTACH_IMG" => $_FILES["ATTACH_IMG"]); $MID = ForumAddMessage("REPLY", $FID, $TID, 0, $arFieldsG, $strErrorMessage, $strOKMessage, false, $_POST["captcha_word"], 0, $_POST["captcha_code"]); $MID = IntVal($MID); if ($MID <= 0) { $bVarsFromForm = true; } else { LocalRedirect($APPLICATION->GetCurPage() . "?FID=" . $FID . "&TID=" . $TID . "&MID=" . $MID . "#message" . $MID); }