本文整理汇总了PHP中CForumTopic::GetByIDEx方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumTopic::GetByIDEx方法的具体用法?PHP CForumTopic::GetByIDEx怎么用?PHP CForumTopic::GetByIDEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumTopic
的用法示例。
在下文中一共展示了CForumTopic::GetByIDEx方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$arFields = array("TITLE" => trim($_REQUEST["TITLE"]), "DESCRIPTION" => trim($_REQUEST["DESCRIPTION"]), "ICON_ID" => intVal($_REQUEST["ICON_ID"]), "TAGS" => $_REQUEST["TAGS"]);
if (ForumMoveMessage($arParams["FID"], $arParams["TID"], $message, 0, $arFields, $strErrorMessage, $strOKMessage)) {
$res = CForumMessage::GetByID($message[0]);
$arParams["TID"] = intVal($res["TOPIC_ID"]);
LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_READ"], array("FID" => $arResult["FORUM"]["ID"], "TID" => $arParams["TID"], "MID" => "s")));
} else {
$arError[] = array("id" => "bad_move", "text" => $strErrorMessage);
}
}
if (!empty($arError)) {
$e = new CAdminException(array_reverse($arError));
$GLOBALS["APPLICATION"]->ThrowException($e);
$err = $GLOBALS['APPLICATION']->GetException();
$arResult["ERROR_MESSAGE"] .= $err->GetString();
if (!empty($arParams["newTID"])) {
$res = CForumTopic::GetByIDEx($arParams["newTID"]);
$arResult["NEW_TOPIC"] = array("TOPIC" => $res["TOPIC_INFO"], "FORUM" => $res["FORUM_INFO"]);
}
$arResult["VALUES"]["TITLE"] = htmlspecialcharsEx($_REQUEST["TITLE"]);
$arResult["VALUES"]["DESCRIPTION"] = htmlspecialcharsEx($_REQUEST["DESCRIPTION"]);
$arResult["VALUES"]["ICON_ID"] = intVal($_REQUEST["ICON_ID"]);
}
$arResult["OK_MESSAGE"] .= $strOKMessage;
}
/********************************************************************
/Action
********************************************************************/
/********************************************************************
Data
********************************************************************/
$arMessage = array();
示例2: Create
function Create($site_id, $max_execution_time, $NS, $arOptions = array())
{
@set_time_limit(0);
if (!is_array($NS)) {
$NS = array("ID" => 0, "CNT" => 0, "FILE_SIZE" => 0, "FILE_ID" => 1, "FILE_URL_CNT" => 0, "ERROR_CNT" => 0, "PARAM2" => 0);
} else {
$NS = array("ID" => intval($NS["ID"]), "CNT" => intval($NS["CNT"]), "FILE_SIZE" => intval($NS["FILE_SIZE"]), "FILE_ID" => intval($NS["FILE_ID"]), "FILE_URL_CNT" => intval($NS["FILE_URL_CNT"]), "ERROR_CNT" => intval($NS["ERROR_CNT"]), "PARAM2" => intval($NS["ID"]));
}
if (is_array($max_execution_time)) {
$record_limit = $max_execution_time[1];
$max_execution_time = $max_execution_time[0];
} else {
$record_limit = 5000;
}
if ($max_execution_time > 0) {
$end_of_execution = time() + $max_execution_time;
} else {
$end_of_execution = 0;
}
if (is_array($arOptions) && $arOptions["FORUM_TOPICS_ONLY"] == "Y") {
$bForumTopicsOnly = CModule::IncludeModule("forum");
} else {
$bForumTopicsOnly = false;
}
if (is_array($arOptions) && $arOptions["BLOG_NO_COMMENTS"] == "Y") {
$bBlogNoComments = CModule::IncludeModule("blog");
} else {
$bBlogNoComments = false;
}
if (is_array($arOptions) && $arOptions["USE_HTTPS"] == "Y") {
$strProto = "https://";
} else {
$strProto = "http://";
}
$rsSite = CSite::GetByID($site_id);
if ($arSite = $rsSite->Fetch()) {
$SERVER_NAME = trim($arSite["SERVER_NAME"]);
if (strlen($SERVER_NAME) <= 0) {
$this->m_error = GetMessage("SEARCH_ERROR_SERVER_NAME", array("#SITE_ID#" => '<a href="site_edit.php?LID=' . urlencode($site_id) . '&lang=' . urlencode(LANGUAGE_ID) . '">' . htmlspecialcharsbx($site_id) . '</a>')) . "<br>";
return false;
}
//Cache events
$this->m_events = GetModuleEvents("search", "OnSearchGetURL", true);
//Clear error file
if ($NS["ID"] == 0 && $NS["CNT"] == 0) {
$e = fopen($arSite["ABS_DOC_ROOT"] . $arSite["DIR"] . "sitemap_errors.xml", "w");
$strBegin = "<?xml version='1.0' encoding='UTF-8'?>\n<urlset xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
fwrite($e, $strBegin);
} else {
$e = fopen($arSite["ABS_DOC_ROOT"] . $arSite["DIR"] . "sitemap_errors.xml", "a");
}
if (!$e) {
$this->m_error = GetMessage("SEARCH_ERROR_OPEN_FILE") . " " . $arSite["ABS_DOC_ROOT"] . $arSite["DIR"] . "sitemap_errors.xml" . "<br>";
return false;
}
//Open current sitemap file
if ($NS["FILE_SIZE"] == 0) {
$f = fopen($arSite["ABS_DOC_ROOT"] . $arSite["DIR"] . "sitemap_" . sprintf("%03d", $NS["FILE_ID"]) . ".xml", "w");
$strBegin = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
fwrite($f, $strBegin);
$NS["FILE_SIZE"] += strlen($strBegin);
} else {
$f = fopen($arSite["ABS_DOC_ROOT"] . $arSite["DIR"] . "sitemap_" . sprintf("%03d", $NS["FILE_ID"]) . ".xml", "a");
}
if (!$f) {
$this->m_error = GetMessage("SEARCH_ERROR_OPEN_FILE") . " " . $arSite["ABS_DOC_ROOT"] . $arSite["DIR"] . "sitemap_" . sprintf("%03d", $NS["FILE_ID"]) . ".xml" . "<br>";
return false;
}
CTimeZone::Disable();
$this->GetURLs($site_id, $NS["ID"], $record_limit);
$bFileIsFull = false;
while (!$bFileIsFull && ($ar = $this->Fetch())) {
$record_limit--;
$NS["ID"] = $ar["ID"];
if (strlen($ar["URL"]) < 1) {
continue;
}
if ($bForumTopicsOnly && $ar["MODULE_ID"] == "forum") {
//Forum topic ID
$PARAM2 = intval($ar["PARAM2"]);
if ($NS["PARAM2"] < $PARAM2) {
$NS["PARAM2"] = $PARAM2;
$arTopic = CForumTopic::GetByIDEx($PARAM2);
if ($arTopic) {
$ar["FULL_DATE_CHANGE"] = $arTopic["LAST_POST_DATE"];
}
} else {
continue;
}
}
if ($bBlogNoComments && $ar["MODULE_ID"] == "blog") {
if (substr($ar["ITEM_ID"], 0, 1) === "C") {
continue;
}
}
if (preg_match("/^[a-z]+:\\/\\//", $ar["URL"])) {
$strURL = $ar["URL"];
} else {
$strURL = $strProto . $ar["SERVER_NAME"] . $ar["URL"];
}
//.........这里部分代码省略.........
示例3: array
endif;
endif;
if ($arParams["FID"] > 0)
{
$arValidSites = CForumNew::GetSites($arParams["FID"]);
if (!isset($arValidSites[SITE_ID]) && ($arParams["SHOW_FORUM_ANOTHER_SITE"] == "N" || $GLOBALS["APPLICATION"]->GetGroupRight("forum") < "W"))
{
$arError = array(
"code" => "404",
"title" => GetMessage("F_ERROR_TID_IS_LOST"));
}
}
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"),
示例4: array
break;
}
$res = array($PARENT_ID => __array_merge($arResult["GROUPS"][$PARENT_ID], $res));
$PARENT_ID = $arResult["GROUPS"][$PARENT_ID]["PARENT_ID"];
$res = array("GROUPS" => $res);
if ($PARENT_ID > 0)
$res = __array_merge($arResult["GROUPS"][$PARENT_ID], $res);
}
if ($bResult == true)
$arGroups = __array_merge($arGroups, $res);
}
$arResult["GROUPS_FORUMS"] = $arGroups;
/************** Topics *********************************************/
if ($arResult["TID"] > 0)
{
$res = CForumTopic::GetByIDEx($arResult["TID"]);
if (!empty($res) && $res["STATE"] != "L" && !empty($arResult["FORUMS"][$res["FORUM_ID"]]))
{
$arResult["TOPIC"] = $res;
$arResult["FORUM"] = $arResult["FORUMS"][$res["FORUM_ID"]];
$arResult["TOPIC"]["~TITLE"] = $arResult["TOPIC"]["TITLE"];
$arResult["TOPIC"]["TITLE"] = Cutil::JSEscape($arResult["TOPIC"]["TITLE"]);
$arResult["TOPIC"]["LINK"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_READ"],
array("FID" => $arResult["FORUM"]["ID"], "TID" => $arResult["TOPIC"]["ID"], "MID" => "s"));
$arResult["FORUM"]["LINK"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_LIST"],
array("FID" => $arResult["FORUM"]["ID"]));
}
}
elseif (strlen($_REQUEST["search_template"]) > 0)
{
示例5: IntVal
$MID = IntVal($_REQUEST["MID"]);
if (strToLower($_REQUEST["MID"]) == "unread_mid") {
$MID = ForumGetFirstUnreadMessage($FID, $TID);
}
$MID = IntVal($MID);
define("FORUM_MODULE_PAGE", "READ");
if ($MID > 0) {
$arMessage = CForumMessage::GetByID($MID);
if ($arMessage) {
$TID = IntVal($arMessage["TOPIC_ID"]);
$FID = IntVal($arMessage["FORUM_ID"]);
} else {
$MID = 0;
}
}
$arTopic = CForumTopic::GetByIDEx($TID);
if (!$arTopic) {
LocalRedirect("list.php?FID=" . $FID);
die;
}
$FID = IntVal($arTopic["FORUM_ID"]);
$arForum = CForumNew::GetByID($FID);
if (!$arForum) {
LocalRedirect("index.php");
die;
}
//*************************!Переменные*****************************************************************************
$View = false;
$strErrorMessage = "";
$strOKMessage = "";
$bVarsFromForm = false;