- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/eventmessage.php
- Класс: CAllEventMessage
- Вызов: CAllEventMessage::CheckFields
public function CheckFields($arFields, $ID=false)
{
/** @global CMain $APPLICATION */
global $APPLICATION;
$this->LAST_ERROR = "";
$arMsg = array();
if(is_set($arFields, "EMAIL_FROM") && mb_strlen($arFields["EMAIL_FROM"]) < 3)
{
$this->LAST_ERROR .= GetMessage("BAD_EMAIL_FROM")."
";
$arMsg[] = array("id"=>"EMAIL_FROM", "text"=> GetMessage("BAD_EMAIL_FROM"));
}
if(is_set($arFields, "EMAIL_TO") && mb_strlen($arFields["EMAIL_TO"]) < 3)
{
$this->LAST_ERROR .= GetMessage("BAD_EMAIL_TO")."
";
$arMsg[] = array("id"=>"EMAIL_TO", "text"=> GetMessage("BAD_EMAIL_TO"));
}
if($ID===false && !is_set($arFields, "EVENT_NAME"))
{
$this->LAST_ERROR .= GetMessage("MAIN_BAD_EVENT_NAME_NA")."
";
$arMsg[] = array("id"=>"EVENT_NAME", "text"=> GetMessage("MAIN_BAD_EVENT_NAME_NA"));
}
if(is_set($arFields, "EVENT_NAME"))
{
$r = CEventType::GetListEx(array(), array("EVENT_NAME"=>$arFields["EVENT_NAME"]), array("type"=>"none"));
if(!$r->Fetch())
{
$this->LAST_ERROR .= GetMessage("BAD_EVENT_TYPE")."
";
$arMsg[] = array("id"=>"EVENT_NAME", "text"=> GetMessage("BAD_EVENT_TYPE"));
}
}
if(
($ID===false && !is_set($arFields, "LID")) ||
(is_set($arFields, "LID")
&& (
(is_array($arFields["LID"]) && empty($arFields["LID"]))
||
(!is_array($arFields["LID"]) && $arFields["LID"] == '')
)
)
)
{
$this->LAST_ERROR .= GetMessage("MAIN_BAD_SITE_NA")."
";
$arMsg[] = array("id"=>"LID", "text"=> GetMessage("MAIN_BAD_SITE_NA"));
}
elseif(is_set($arFields, "LID"))
{
if(!is_array($arFields["LID"]))
$arFields["LID"] = array($arFields["LID"]);
foreach($arFields["LID"] as $v)
{
$r = CSite::GetByID($v);
if(!$r->Fetch())
{
$this->LAST_ERROR .= "'".$v."' - ".GetMessage("MAIN_EVENT_BAD_SITE")."
";
$arMsg[] = array("id"=>"LID", "text"=> GetMessage("MAIN_EVENT_BAD_SITE"));
}
}
}
if(!empty($arMsg))
{
$e = new CAdminException($arMsg);
$APPLICATION->ThrowException($e);
}
if($this->LAST_ERROR <> '')
return false;
return true;
}