本文整理汇总了PHP中CForumFiles::getByMessageID方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumFiles::getByMessageID方法的具体用法?PHP CForumFiles::getByMessageID怎么用?PHP CForumFiles::getByMessageID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumFiles
的用法示例。
在下文中一共展示了CForumFiles::getByMessageID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetByIDEx
function GetByIDEx($ID, $arAddParams = array())
{
global $DB;
$ID = intVal($ID);
$res = false;
if ($ID <= 0) {
return false;
}
$arAddParams = is_array($arAddParams) ? $arAddParams : array($arAddParams);
$arAddParams["GET_TOPIC_INFO"] = $arAddParams["GET_TOPIC_INFO"] == "Y" ? "Y" : "N";
$arAddParams["FILTER_TOPIC_INFO"] = $arAddParams["FILTER_TOPIC_INFO"] == "N" ? "N" : "Y";
$arAddParams["GET_FORUM_INFO"] = $arAddParams["GET_FORUM_INFO"] == "Y" ? "Y" : "N";
$arAddParams["FILTER_FORUM_INFO"] = $arAddParams["FILTER_FORUM_INFO"] == "N" ? "N" : "Y";
$arAddParams["FILTER_MESSAGE_INFO"] = $arAddParams["FILTER_MESSAGE_INFO"] == "N" ? "N" : "Y";
if (COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
$arAddParams["FILTER"] = is_set($arAddParams, "FILTER") ? $arAddParams["FILTER"] : "P";
$arAddParams["FILTER"] = $arAddParams["FILTER"] == "Y" || $arAddParams["FILTER"] == "P" ? $arAddParams["FILTER"] : "N";
} else {
$arAddParams["FILTER"] = "N";
}
if ($arAddParams["FILTER"] == "N") {
$arAddParams["FILTER_TOPIC_INFO"] = "N";
$arAddParams["FILTER_FORUM_INFO"] = "N";
$arAddParams["FILTER_MESSAGE_INFO"] = "N";
} elseif ($arAddParams["FILTER"] == "P") {
$arAddParams["FILTER_MESSAGE_INFO"] = "N";
}
$arSqlSelect = array();
$arSqlFrom = array();
if ($arAddParams["GET_TOPIC_INFO"] == "Y") {
$arSqlSelect[] = CForumTopic::GetSelectFields(array("sPrefix" => "FT_", "sReturnResult" => "string"));
if ($arAddParams["FILTER_TOPIC_INFO"] != "N") {
$arSqlSelect[] = "FT.HTML as FT_HTML";
}
$arSqlSelect[] = "FT.XML_ID as FT_XML_ID";
$arSqlFrom[] = "INNER JOIN b_forum_topic FT ON (FM.TOPIC_ID = FT.ID)";
}
if ($arAddParams["GET_FORUM_INFO"] == "Y") {
$arSqlSelect[] = CForumNew::GetSelectFields(array("sPrefix" => "F_", "sReturnResult" => "string"));
if ($arAddParams["FILTER_FORUM_INFO"] != "N") {
$arSqlSelect[] = "F.HTML as F_HTML";
}
$arSqlFrom[] = "INNER JOIN b_forum F ON (FM.FORUM_ID = F.ID)";
}
$strSql = "SELECT FM.*, " . $DB->DateToCharFunction("FM.POST_DATE", "FULL") . " as POST_DATE,\n\t\t\t\tFU.SHOW_NAME, FU.DESCRIPTION, FU.NUM_POSTS, FU.POINTS as NUM_POINTS, FU.SIGNATURE, FU.AVATAR, FU.RANK_ID,\n\t\t\t\t" . $DB->DateToCharFunction("FU.DATE_REG", "SHORT") . " as DATE_REG,\n\t\t\t\tU.EMAIL, U.PERSONAL_ICQ, U.LOGIN, U.NAME, U.SECOND_NAME, U.LAST_NAME" . (!empty($arSqlSelect) ? ", " . implode(", ", $arSqlSelect) : "") . "\n\t\t\tFROM b_forum_message FM\n\t\t\t\tLEFT JOIN b_forum_user FU ON (FM.AUTHOR_ID = FU.USER_ID)\n\t\t\t\tLEFT JOIN b_user U ON (FM.AUTHOR_ID = U.ID)\n\t\t\t\t" . implode(" ", $arSqlFrom) . "\n\t\t\tWHERE FM.ID = " . $ID . "";
$db_res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($db_res && ($res = $db_res->Fetch())) {
if ($arAddParams["FILTER_MESSAGE_INFO"] == "N") {
unset($res["HTML"]);
}
if ($arAddParams["GET_TOPIC_INFO"] == "Y" && COption::GetOptionString("forum", "FILTER", "Y") == "Y") {
$arTopic = array();
foreach ($res as $key => $val) {
if (substr($key, 0, 3) == "FT_") {
$arTopic[substr($key, 3)] = $val;
}
}
if (!empty($arTopic)) {
$GLOBALS["FORUM_CACHE"]["TOPIC"][intVal($res["TOPIC_INFO"]["ID"])] = $arTopic;
$db_res_filter = new CDBResult();
$db_res_filter->InitFromArray(array($arTopic));
$db_res_filter = new _CTopicDBResult($db_res_filter);
if ($res_filter = $db_res_filter->Fetch()) {
$GLOBALS["FORUM_CACHE"]["TOPIC_FILTER"][intVal($res["TOPIC_INFO"]["ID"])] = $res_filter;
}
}
}
$db_res = new CDBResult();
$db_res->InitFromArray(array($res));
$db_res = new _CMessageDBResult($db_res, $arAddParams);
$res = $db_res->Fetch();
if ($arAddParams["GET_TOPIC_INFO"] == "Y" || $arAddParams["GET_FORUM_INFO"] == "Y") {
$res["TOPIC_INFO"] = array();
$res["FORUM_INFO"] = array();
$res["MESSAGE_INFO"] = array();
foreach ($res as $key => $val) {
if (substr($key, 0, 3) == "FT_") {
$res["TOPIC_INFO"][substr($key, 3)] = $val;
} elseif (substr($key, 0, 2) == "F_") {
$res["FORUM_INFO"][substr($key, 2)] = $val;
} else {
$res["MESSAGE_INFO"][$key] = $val;
}
}
if (COption::GetOptionString("forum", "FILTER", "Y") != "Y" && !empty($res["TOPIC_INFO"])) {
$GLOBALS["FORUM_CACHE"]["TOPIC"][intVal($res["TOPIC_INFO"]["ID"])] = $res["TOPIC_INFO"];
}
if (!empty($res["FORUM_INFO"])) {
$GLOBALS["FORUM_CACHE"]["FORUM"][intVal($res["FORUM_INFO"]["ID"])] = $res["FORUM_INFO"];
}
}
if ($arAddParams["getFiles"] == "Y" && !empty($res)) {
$res["FILES"] = CForumFiles::getByMessageID($ID);
}
return $res;
}
return false;
}
示例2: FormatEvent_Forum
function FormatEvent_Forum($arFields, $arParams, $bMail = false)
{
if ($bMail && strlen($arFields["MAIL_LANGUAGE_ID"]) > 0) {
IncludeModuleLangFile(__FILE__, $arFields["MAIL_LANGUAGE_ID"]);
}
$arResult = array("EVENT" => $arFields, "CREATED_BY" => CSocNetLogTools::FormatEvent_GetCreatedBy($arFields, $arParams, $bMail), "ENTITY" => CSocNetLogTools::FormatEvent_GetEntity($arFields, $arParams, $bMail), "EVENT_FORMATTED" => array());
if (!$bMail) {
$arResult["AVATAR_SRC"] = CSocNetLogTools::FormatEvent_CreateAvatar($arFields, $arParams);
}
if ($arFields["PARAMS"] == "type=M") {
$title_tmp = $bMail ? GetMessage("SONET_GL_EVENT_TITLE_" . ($arFields["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP ? "GROUP" : "USER") . "_FORUM_MESSAGE_MAIL") : GetMessage("SONET_GL_EVENT_TITLE_FORUM_MESSAGE");
} else {
$title_tmp = $bMail ? GetMessage("SONET_GL_EVENT_TITLE_" . ($arFields["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP ? "GROUP" : "USER") . "_FORUM_TOPIC_MAIL") : GetMessage("SONET_GL_EVENT_TITLE_FORUM_TOPIC");
}
$topic_tmp = !$bMail && array_key_exists("URL", $arFields) && strlen($arFields["URL"]) > 0 ? '<a href="' . $arFields["URL"] . '">' . $arFields["TITLE"] . '</a>' : $arFields["TITLE"];
$title = str_replace(array("#TITLE#", "#ENTITY#", "#CREATED_BY#"), array($topic_tmp, $arResult["ENTITY"]["FORMATTED"], $bMail ? $arResult["CREATED_BY"]["FORMATTED"] : ""), $title_tmp);
static $parser = false;
if (CModule::IncludeModule("forum")) {
if (!$parser) {
$parser = new forumTextParser(LANGUAGE_ID);
}
$parser->pathToUser = $arParams["PATH_TO_USER"];
$parser->LAZYLOAD = isset($arParams["LAZYLOAD"]) && $arParams["LAZYLOAD"] == "Y" ? "Y" : "N";
$parser->bMobile = $arParams["MOBILE"] == "Y";
$arFields["FILES"] = CForumFiles::getByMessageID($arFields["SOURCE_ID"]);
}
$arResult["EVENT_FORMATTED"] = array("TITLE" => $title, "TITLE_24" => GetMessage("SONET_GL_EVENT_TITLE_FORUM_TOPIC_24"), "TITLE_24_2" => $arFields["TITLE"], "MESSAGE" => $bMail ? $arFields["TEXT_MESSAGE"] : $arFields["~MESSAGE"], "FILES" => !!$arFields["FILES"] ? array_keys($arFields["FILES"]) : array());
if (!$bMail) {
static $parserLog = false;
if ($arParams["MOBILE"] != "Y") {
if (!$parserLog) {
$parserLog = new logTextParser(false, $arParams["PATH_TO_SMILE"]);
}
$arResult["EVENT_FORMATTED"]["SHORT_MESSAGE"] = $parserLog->html_cut($parserLog->convert(str_replace("#CUT#", "", $arResult["EVENT_FORMATTED"]["MESSAGE"]), array(), array("HTML" => "Y", "ALIGN" => "Y", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "LOG_IMG" => "N", "QUOTE" => "Y", "LOG_QUOTE" => "N", "CODE" => "Y", "LOG_CODE" => "N", "FONT" => "Y", "LOG_FONT" => "N", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "N", "MULTIPLE_BR" => "N", "VIDEO" => "Y", "LOG_VIDEO" => "N")), 1000);
}
$parser = is_object($parser) ? $parser : (is_object($parserLog) ? $parserLog : new logTextParser(false, $arParams["PATH_TO_SMILE"]));
if (get_class($parser) == "forumTextParser") {
$parser->arUserfields = $arFields["UF"];
$arResult["EVENT_FORMATTED"]["MESSAGE"] = $parser->convert($arResult["EVENT_FORMATTED"]["MESSAGE"], array("HTML" => "N", "ALIGN" => "Y", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "Y", "MULTIPLE_BR" => "N", "VIDEO" => "Y", "LOG_VIDEO" => "N", "SHORT_ANCHOR" => "Y", "USERFIELDS" => $arFields["UF"]), "html", $arResult["EVENT_FORMATTED"]["FILES"]);
$arResult["EVENT_FORMATTED"]["PARSED_FILES"] = $parser->arFilesParsed;
} else {
$arResult["EVENT_FORMATTED"]["MESSAGE"] = $parser->convert($arResult["EVENT_FORMATTED"]["MESSAGE"], array(), array("HTML" => "N", "ALIGN" => "Y", "ANCHOR" => "Y", "BIU" => "Y", "IMG" => "Y", "QUOTE" => "Y", "CODE" => "Y", "FONT" => "Y", "LIST" => "Y", "SMILES" => "Y", "NL2BR" => "Y", "MULTIPLE_BR" => "N", "VIDEO" => "Y", "LOG_VIDEO" => "N", "SHORT_ANCHOR" => "Y", "USERFIELDS" => $arFields["UF"]));
}
$arResult["EVENT_FORMATTED"]["MESSAGE"] = str_replace("#CUT#", '<br><a href="' . $arFields["URL"] . '">' . GetMessage("SONET_GL_EVENT_BLOG_MORE") . '</a>', htmlspecialcharsbx($arResult["EVENT_FORMATTED"]["MESSAGE"]));
if ($arParams["MOBILE"] != "Y" && $arParams["NEW_TEMPLATE"] != "Y") {
$arResult["EVENT_FORMATTED"]["IS_MESSAGE_SHORT"] = CSocNetLogTools::FormatEvent_IsMessageShort($arResult["EVENT_FORMATTED"]["MESSAGE"], $arResult["EVENT_FORMATTED"]["SHORT_MESSAGE"]);
}
if ($arFields["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_GROUP) {
$arResult["EVENT_FORMATTED"]["DESTINATION"] = array(array("STYLE" => "sonetgroups", "TITLE" => $arResult["ENTITY"]["FORMATTED"]["NAME"], "URL" => $arResult["ENTITY"]["FORMATTED"]["URL"], "IS_EXTRANET" => is_array($GLOBALS["arExtranetGroupID"]) && in_array($arFields["ENTITY_ID"], $GLOBALS["arExtranetGroupID"])));
}
} else {
$url = CSocNetLogTools::FormatEvent_GetURL($arFields);
if (strlen($url) > 0) {
$arResult["EVENT_FORMATTED"]["URL"] = $url;
}
}
$arResult["HAS_COMMENTS"] = intval($arFields["SOURCE_ID"]) > 0 ? "Y" : "N";
if ($bMail && strlen($arFields["MAIL_LANGUAGE_ID"]) > 0) {
IncludeModuleLangFile(__FILE__, LANGUAGE_ID);
}
return $arResult;
}