本文整理汇总了PHP中CForumTopic::GetById方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumTopic::GetById方法的具体用法?PHP CForumTopic::GetById怎么用?PHP CForumTopic::GetById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumTopic
的用法示例。
在下文中一共展示了CForumTopic::GetById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CAdminException
if (!empty($arMsg)) {
$err = new CAdminException($arMsg);
$lAdmin->AddFilterError($err->GetString());
}
/*******************************************************************/
if ($lAdmin->EditAction() && $forumModulePermissions >= "R") {
$sError = "";
$sOk = "";
foreach ($FIELDS as $ID => $arFields) {
$ID = intVal($ID);
if (!$lAdmin->IsUpdated($ID)) {
continue;
} elseif (!CForumTopic::CanUserUpdateTopic($ID, $USER->GetUserGroupArray(), $USER->GetID())) {
continue;
}
$res = CForumTopic::GetById($ID, array("NoFilter" => true));
if (is_set($arFields, "APPROVED")) {
$arFields["APPROVED"] = $arFields["APPROVED"] == "N" ? "N" : "Y";
if ($res["APPROVED"] != $arFields["APPROVED"]) {
ForumActions($arFields["APPROVED"] == "Y" ? "SHOW_TOPIC" : "HIDE_TOPIC", array("TID" => $ID), $sError, $sOk);
}
unset($arFields["APPROVED"]);
}
if (is_set($arFields, "FORUM_ID")) {
if ($res["FORUM_ID"] != $arFields["FORUM_ID"]) {
$result = CForumTopic::MoveTopic2Forum(array($res["ID"]), $arFields["FORUM_ID"], "N");
}
unset($arFields["FORUM_ID"]);
}
foreach ($arFields as $key => $val) {
if ($val == $res[$key]) {
示例2: CheckFields
function CheckFields($ACTION, &$arFields, $ID = 0, $arParams = array())
{
$aMsg = array();
$ID = intVal($ID);
$arMessage = $arFields;
if ($ACTION != "ADD" && $ID > 0 && (!is_set($arFields, "AUTHOR_NAME") || !is_set($arFields, "TOPIC_ID") || !is_set($arFields, "FORUM_ID"))) {
$arMessage = CForumMessage::GetByID($ID, array("FILTER" => "N"));
}
$bDeduplication = true;
if ((is_set($arFields, "FORUM_ID") || $ACTION == "ADD") && intVal($arFields["FORUM_ID"]) <= 0) {
$aMsg[] = array("id" => 'empty_forum_id', "text" => GetMessage("F_ERR_EMPTY_FORUM_ID"));
} else {
$forumID = $ACTION == 'ADD' ? intVal($arFields["FORUM_ID"]) : intVal($arMessage["FORUM_ID"]);
$arForum = CForumNew::GetByID($forumID);
if (!is_array($arForum)) {
$aMsg[] = array("id" => 'invalid_forum_id', "text" => GetMessage("F_ERR_INVALID_FORUM_ID"));
} else {
$bDeduplication = $arForum['DEDUPLICATION'] === 'Y';
}
}
if ((is_set($arFields, "TOPIC_ID") || $ACTION == "ADD") && intVal($arFields["TOPIC_ID"]) <= 0) {
$aMsg[] = array("id" => 'empty_topic_id', "text" => GetMessage("F_ERR_EMPTY_TOPIC_ID"));
}
if ((is_set($arFields, "AUTHOR_NAME") || $ACTION == "ADD") && strLen($arFields["AUTHOR_NAME"]) <= 0) {
$aMsg[] = array("id" => 'empty_author_name', "text" => GetMessage("F_ERR_EMPTY_AUTHOR_NAME"));
}
if ((is_set($arFields, "POST_MESSAGE") || $ACTION == "ADD") && strLen($arFields["POST_MESSAGE"]) <= 0 && (!is_set($arFields, 'FILES') || sizeof($arFields['FILES']) < 1)) {
$aMsg[] = array("id" => 'empty_post_message', "text" => GetMessage("F_ERR_EMPTY_POST_MESSAGE"));
} elseif (is_set($arFields, "POST_MESSAGE") && $arFields["NEW_TOPIC"] != "Y") {
$arFields["POST_MESSAGE_CHECK"] = md5($arFields["POST_MESSAGE"] . (is_set($arFields, 'FILES') ? serialize($arFields['FILES']) : ''));
if ($bDeduplication) {
$iCnt = CForumMessage::GetList(array(), array("TOPIC_ID" => $arMessage["TOPIC_ID"], "!ID" => $ID, "AUTHOR_NAME" => $arMessage["AUTHOR_NAME"], "POST_MESSAGE_CHECK" => $arFields["POST_MESSAGE_CHECK"]), true);
if (intVal($iCnt) > 0) {
$aMsg[] = array("id" => 'message_already_exists', "text" => GetMessage("F_ERR_MESSAGE_ALREADY_EXISTS"));
}
}
}
if (!is_set($arFields, "FILES")) {
$arFields["FILES"] = array();
}
if (is_set($arFields, "ATTACH_IMG")) {
if (!empty($arFields["ATTACH_IMG"])) {
$arFields["FILES"][] = $arFields["ATTACH_IMG"];
}
unset($arFields["ATTACH_IMG"]);
}
if (!empty($arFields["FILES"])) {
if ($ID > 0) {
$arParams = !empty($arParams) ? $arParams : CForumMessage::GetByID($ID, array("FILTER" => "N"));
$arParams["MESSAGE_ID"] = $ID;
} else {
$arParams = array("FORUM_ID" => $arMessage["FORUM_ID"], "MESSAGE_ID" => 0, "USER_ID" => $arFields["AUTHOR_ID"]);
}
if (!CForumFiles::CheckFields($arFields["FILES"], $arParams)) {
$res = $GLOBALS["APPLICATION"]->GetException();
$aMsg[] = array("id" => 'attach_error', "text" => $res->GetString());
}
} else {
unset($arFields["FILES"]);
}
if (intVal($arFields["TOPIC_ID"]) > 0) {
$res = CForumTopic::GetById($arFields["TOPIC_ID"]);
if (!$res) {
$aMsg[] = array("id" => 'topic_is_not_exists', "text" => GetMessage("F_ERR_TOPIC_IS_NOT_EXISTS"));
} elseif ($res["STATE"] == "L") {
$aMsg[] = array("id" => 'topic_is_link', "text" => GetMessage("F_ERR_TOPIC_IS_LINK"));
}
}
if (!empty($aMsg)) {
$e = new CAdminException(array_reverse($aMsg));
$GLOBALS["APPLICATION"]->ThrowException($e);
return false;
} else {
if (!$GLOBALS["USER_FIELD_MANAGER"]->CheckFields("FORUM_MESSAGE", $ID, $arFields)) {
return false;
}
}
if (is_set($arFields, "AUTHOR_ID") || $ACTION == "ADD") {
$arFields["AUTHOR_ID"] = intVal($arFields["AUTHOR_ID"]) <= 0 ? false : $arFields["AUTHOR_ID"];
}
if (is_set($arFields, "USE_SMILES") || $ACTION == "ADD") {
$arFields["USE_SMILES"] = $arFields["USE_SMILES"] == "N" ? "N" : "Y";
}
if (is_set($arFields, "NEW_TOPIC") || $ACTION == "ADD") {
$arFields["NEW_TOPIC"] = $arFields["NEW_TOPIC"] == "Y" ? "Y" : "N";
}
if (is_set($arFields, "APPROVED") || $ACTION == "ADD") {
$arFields["APPROVED"] = $arFields["APPROVED"] == "N" ? "N" : "Y";
}
if (is_set($arFields, "SOURCE_ID") || $ACTION == "ADD") {
$arFields["SOURCE_ID"] = $arFields["SOURCE_ID"] == "EMAIL" ? "EMAIL" : "WEB";
}
// ********************************* QUOTA ********************************* //
// if ((!empty($arFields["POST_MESSAGE"])) && (COption::GetOptionInt("main", "disk_space") > 0))
// {
// $quota = new CDiskQuota();
// if (!$quota->checkDiskQuota(strLen($arFields["POST_MESSAGE"])))
// return false;
// }
// ********************************* QUOTA ********************************* //
//.........这里部分代码省略.........