• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/site_template.php
  • Класс: CSiteTemplate
  • Вызов: CSiteTemplate::CheckFields
public function CheckFields($arFields, $ID=false)
{
	/** @global CMain $APPLICATION */
	global $APPLICATION;

	$this->LAST_ERROR = "";
	$arMsg = array();

	if($ID === false)
	{
		if($arFields["ID"] == '')
			$this->LAST_ERROR .= GetMessage("MAIN_ENTER_TEMPLATE_ID")." ";
		elseif(file_exists($_SERVER["DOCUMENT_ROOT"].BX_PERSONAL_ROOT."/templates/".$arFields["ID"]))
			$this->LAST_ERROR .= GetMessage("MAIN_TEMPLATE_ID_EX")." ";

		if(!isset($arFields["CONTENT"]))
			$this->LAST_ERROR .= GetMessage("MAIN_TEMPLATE_CONTENT_NA")." ";
	}

	if(isset($arFields["CONTENT"]) && $arFields["CONTENT"] == '')
	{
		$this->LAST_ERROR .= GetMessage("MAIN_TEMPLATE_CONTENT_NA")." ";
		$arMsg[] = array("id"=>"CONTENT", "text"=> GetMessage("MAIN_TEMPLATE_CONTENT_NA"));
	}
	elseif(isset($arFields["CONTENT"]) && strpos($arFields["CONTENT"], "#WORK_AREA#") === false)
	{
		$this->LAST_ERROR .= GetMessage("MAIN_TEMPLATE_WORKAREA_NA")." ";
		$arMsg[] = array("id"=>"CONTENT", "text"=> GetMessage("MAIN_TEMPLATE_WORKAREA_NA"));
	}

	if(!empty($arMsg))
	{
		$e = new CAdminException($arMsg);
		$APPLICATION->ThrowException($e);
	}

	if($this->LAST_ERROR <> '')
		return false;

	return true;
}