• Модуль: forum
  • Путь к файлу: ~/bitrix/modules/forum/classes/general/forum_new.php
  • Класс: _CForumDBResult
  • Вызов: _CForumDBResult::Fetch
function Fetch()
{
	global $DB;
	if($res = parent::Fetch())
	{
		if (COption::GetOptionString("forum", "FILTER", "Y") == "Y")
		{
			if (trim($res["HTML"]) <> '')
			{
				$arr = unserialize($res["HTML"], ["allowed_classes" => false]);
				if (is_array($arr) && count($arr) > 0):
					$res["LAST_POSTER_NAME"] = $arr["LAST_POSTER_NAME"];
				endif;
			}
			if (trim($res["TOPIC_HTML"]) <> '')
			{
				$arr = unserialize($res["TOPIC_HTML"], ["allowed_classes" => false]);
				if (is_array($arr) && is_set($arr, "TITLE"))
					$res["TITLE"] = $arr["TITLE"];
			}
			if (trim($res["ABS_TOPIC_HTML"]) <> '')
			{
				$arr = unserialize($res["ABS_TOPIC_HTML"], ["allowed_classes" => false]);
				if (is_array($arr))
				{
					if (is_set($arr, "TITLE"))
						$res["ABS_TITLE"] = $arr["TITLE"];
					if (is_set($arr, "ABS_LAST_POSTER_NAME"))
						$res["ABS_LAST_POSTER_NAME"] = $arr["ABS_LAST_POSTER_NAME"];
				}
			}
		}

		if (!empty($this->sNameTemplate))
		{
			$arTmp = array();
			foreach (array("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;
}