} } break; case "FORUM_SUBSCRIBE": case "TOPIC_SUBSCRIBE": case "FORUM_SUBSCRIBE_TOPICS": if (ForumSubscribeNewMessagesEx($FID, $action == "FORUM_SUBSCRIBE" ? 0 : $TID, $action == "FORUM_SUBSCRIBE_TOPICS" ? "Y" : "N", $strErrorMessage, $strOKMessage)) { LocalRedirect("subscr_list.php?FID=" . $FID . "&TID=" . $TID); } break; case "MOVE_TOPIC": LocalRedirect("move.php?FID=" . $FID . "&TID=" . $TID); break; case "HIDE": case "SHOW": ForumModerateMessage($MID, $action, $strErrorMessage, $strOKMessage); LocalRedirect("read.php?FID=" . $FID . "&TID=" . $TID); break; case "SET_ORDINARY": case "SET_TOP": if ($action == "SET_ORDINARY") { $action = "ORDINARY"; $sort = "150"; } else { $action = "TOP"; $sort = "100"; } if (ForumTopOrdinaryTopic($TID, $action, $strErrorMessage, $strOKMessage)) { $arTopic["SORT"] = $sort; } LocalRedirect("read.php?FID=" . $FID . "&TID=" . $TID);
function ForumActions($action, $arFields, &$strErrorMessage, &$strOKMessage) { $result = false; $sError = ""; $sNote = ""; if (empty($action)) { $sError = GetMessage("FORUM_NO_ACTION"); } else { switch ($action) { case "REPLY": $result = ForumAddMessage("REPLY", $arFields["FID"], $arFields["TID"], 0, $arFields, $sError, $sNote, false, $arFields["captcha_word"], 0, $arFields["captcha_code"], $arFields["NAME_TEMPLATE"]); break; case "DEL": $result = ForumDeleteMessage($arFields["MID"], $sError, $sNote, $arFields); break; case "SHOW": case "HIDE": $result = ForumModerateMessage($arFields["MID"], $action, $sError, $sNote, $arFields); break; case "VOTE4USER": $result = ForumVote4User($arFields["UID"], $arFields["VOTES"], $arFields["VOTE"], $sError, $sNote, $arFields); break; case "FORUM_MESSAGE2SUPPORT": $result = ForumMoveMessage2Support($arFields["MID"], $sError, $sNote, $arFields); break; case "FORUM_SUBSCRIBE": case "TOPIC_SUBSCRIBE": case "FORUM_SUBSCRIBE_TOPICS": $result = ForumSubscribeNewMessagesEx($arFields["FID"], $arFields["TID"], $arFields["NEW_TOPIC_ONLY"], $sError, $sNote); break; case "SET_ORDINARY": case "SET_TOP": case "ORDINARY": case "TOP": if ($action == "SET_ORDINARY") { $action = "ORDINARY"; } elseif ($action == "SET_TOP") { $action = "TOP"; } $result = ForumTopOrdinaryTopic($arFields["TID"], $action, $sError, $sNote, $arFields); break; case "DEL_TOPIC": $result = ForumDeleteTopic($arFields["TID"], $sError, $sNote, $arFields); break; case "OPEN": case "CLOSE": case "STATE_Y": case "STATE_N": if ($action == "STATE_Y") { $action = "OPEN"; } elseif ($action == "STATE_N") { $action = "CLOSE"; } $result = ForumOpenCloseTopic($arFields["TID"], $action, $sError, $sNote, $arFields); break; case "SHOW_TOPIC": case "HIDE_TOPIC": $db_res = CForumMessage::GetList(array(), array("TOPIC_ID" => $arFields["TID"], "APPROVED" => $action == "HIDE_TOPIC" ? "Y" : "N")); $message = array(); if ($db_res && ($res = $db_res->Fetch())) { do { $message[] = $res["ID"]; } while ($res = $db_res->Fetch()); } if (!empty($message)) { $s = ""; $result = ForumModerateMessage($message, $action == "HIDE_TOPIC" ? "HIDE" : "SHOW", $sError, $s, $arFields); } else { $result = true; } CForumEventLog::Log("topic", $action == "HIDE_TOPIC" ? "unapprove" : "approve", $arFields["TID"], serialize(CForumTopic::GetByID($arFields["TID"]))); break; case "SPAM_TOPIC": $result = ForumSpamTopic($arFields["TID"], $sError, $sNote, $arFields); break; case "SPAM": $result = ForumSpamMessage($arFields["MID"], $sError, $sNote, $arFields); break; default: $sError = GetMessage("FORUM_NO_ACTION") . " (" . htmlspecialcharsbx($action) . ")"; break; } } $strErrorMessage = $sError; $strOKMessage = $sNote; return $result; }
} else { $bVarsFromForm = true; } } elseif ($_SERVER["REQUEST_METHOD"] == "GET" && CModule::IncludeModule("support") && $_GET["ACTION"] == "FORUM_MESSAGE2SUPPORT") { $SuID = ForumMoveMessage2Support($MID, $strErrorMessage, $strOKMessage); if (IntVal($SuID) > 0) { LocalRedirect("/bitrix/admin/ticket_list.php?lang=" . LANGUAGE_ID . "&strNote=" . urlencode("Сообщение форума было успешно перенесено в техподдержку в качестве обращения.")); } } elseif ($_SERVER["REQUEST_METHOD"] == "GET" && ($_GET["ACTION"] == "FORUM_SUBSCRIBE" || $_GET["ACTION"] == "TOPIC_SUBSCRIBE")) { if (ForumSubscribeNewMessages($FID, $_GET["ACTION"] == "FORUM_SUBSCRIBE" ? 0 : $TID, $strErrorMessage, $strOKMessage)) { LocalRedirect("subscr_list.php?FID=" . $FID . "&TID=" . $TID); } } elseif ($_SERVER["REQUEST_METHOD"] == "GET" && $_GET["ACTION"] == "HIDE") { ForumModerateMessage($MID, "HIDE", $strErrorMessage, $strOKMessage); } elseif ($_SERVER["REQUEST_METHOD"] == "GET" && $_GET["ACTION"] == "SHOW") { ForumModerateMessage($MID, "SHOW", $strErrorMessage, $strOKMessage); } elseif ($_SERVER["REQUEST_METHOD"] == "GET" && $_GET["ACTION"] == "SET_ORDINARY") { if (ForumTopOrdinaryTopic($TID, "ORDINARY", $strErrorMessage, $strOKMessage)) { $arTopic["SORT"] = "150"; } } elseif ($_SERVER["REQUEST_METHOD"] == "GET" && $_GET["ACTION"] == "SET_TOP") { if (ForumTopOrdinaryTopic($TID, "TOP", $strErrorMessage, $strOKMessage)) { $arTopic["SORT"] = "100"; } } elseif ($_SERVER["REQUEST_METHOD"] == "GET" && $_GET["ACTION"] == "DEL_TOPIC" && $TID > 0) { if (ForumDeleteTopic($TID, $strErrorMessage, $strOKMessage)) { LocalRedirect("list.php?FID=" . $FID); } } elseif ($_SERVER["REQUEST_METHOD"] == "GET" && $_GET["ACTION"] == "STATE_Y") { if (ForumOpenCloseTopic($TID, "OPEN", $strErrorMessage, $strOKMessage)) { $arTopic["STATE"] = "Y";