- Модуль: forum
- Путь к файлу: ~/bitrix/modules/forum/classes/general/topic.php
- Класс: _CTopicDBResult
- Вызов: _CTopicDBResult::Fetch
function Fetch()
{
global $DB;
if($res = parent::Fetch())
{
if (array_key_exists("ICON", $res) && !empty($res["ICON"]))
{
$res["IMAGE"] = self::getIcon($res["ICON"]);
}
if ($this->noFilter !== true)
{
if (COption::GetOptionString("forum", "FILTER", "Y") == "Y")
{
if (!empty($res["HTML"]))
{
$arr = unserialize($res["HTML"], ["allowed_classes" => false]);
if (is_array($arr) && is_set($arr, "TITLE"))
{
foreach ($arr as $key => $val)
{
if ($val <> '')
$res[$key] = $val;
}
}
}
if (!empty($res["F_HTML"]))
{
$arr = unserialize($res["F_HTML"], ["allowed_classes" => false]);
if (is_array($arr))
{
foreach ($arr as $key => $val)
{
$res["F_".$key] = $val;
}
}
if (!empty($res["TITLE"]))
$res["F_TITLE"] = $res["TITLE"];
}
}
/* For CForumUser::UserAddInfo only */
if (is_set($res, "FIRST_POST") || is_set($res, "LAST_POST"))
{
$arSqlSearch = array();
if (is_set($res, "FIRST_POST"))
$arSqlSearch["FIRST_POST"] = "FM.ID=".intval($res["FIRST_POST"]);
if (is_set($res, "LAST_POST"))
$arSqlSearch["LAST_POST"] = "FM.ID=".intval($res["LAST_POST"]);
if (!empty($arSqlSearch)):
$strSql = "SELECT FM.ID, ".$DB->DateToCharFunction("FM.POST_DATE", "FULL")." AS POST_DATE ".
"FROM b_forum_message FM WHERE ".implode(" OR ", $arSqlSearch);
$db_res = $DB->Query($strSql, false, "FILE: ".__FILE__."
LINE: ".__LINE__);
if($db_res && $val = $db_res->Fetch()):
do
{
if (is_set($res, "FIRST_POST") && $res["FIRST_POST"] == $val["ID"])
$res["FIRST_POST_DATE"] = $val["POST_DATE"];
if (is_set($res, "LAST_POST") && $res["LAST_POST"] == $val["ID"])
$res["LAST_POST_DATE"] = $val["POST_DATE"];
}while ($val = $db_res->Fetch());
endif;
endif;
}
if (!empty($this->sNameTemplate))
{
$arTmp = array();
foreach (array(
"USER_START_ID" => "USER_START_NAME",
"LAST_POSTER_ID" => "LAST_POSTER_NAME",
"ABS_LAST_POSTER_ID" => "ABS_LAST_POSTER_NAME") as $id => $name)
{
$tmp = "";
if (!empty($res[$id]))
{
if (in_array($res[$id], $arTmp))
{
$tmp = $arTmp[$res[$id]];
}
else
{
$arTmp[$res[$id]] = $tmp = (!empty($res[$name."_FRMT"]) ? $res[$name."_FRMT"] :
CForumUser::GetFormattedNameByUserID($res[$id], $this->sNameTemplate));
}
}
$res[$name] = (!empty($tmp) ? $tmp : $res[$name]);
}
}
}
}
return $res;
}