CBlogUser :: CheckFields: Bitrix method

      
<?php 
//  CBlogUser :: CheckFields()
//  /dist/bitrix/modules/blog/general/blog_user.php:42

    
public static function CheckFields($ACTION, &$arFields$ID 0)
    {
        global 
$DB;

        if ((
is_set($arFields"USER_ID") || $ACTION=="ADD") && IntVal($arFields["USER_ID"]) <= 0)
        {
            
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GU_EMPTY_USER_ID"), "EMPTY_USER_ID");
            return 
false;
        }
        elseif (
is_set($arFields"USER_ID"))
        {
            
$dbResult CUser::GetByID($arFields["USER_ID"]);
            if (!
$dbResult->Fetch())
            {
                
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GU_ERROR_NO_USER_ID"), "ERROR_NO_USER_ID");
                return 
false;
            }
        }

        if (
is_set($arFields"ALIAS") && strlen($arFields["ALIAS"]) > 0)
        {
            
$dbResult CBlogUser::GetList(array(), array("ALIAS" => $arFields["ALIAS"], "!ID" => IntVal($ID)), falsefalse, array("ID"));
            if (
$dbResult->Fetch())
            {
                
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GU_ERROR_DUPL_ALIAS"), "ERROR_DUPL_ALIAS");
                return 
false;
            }
        }

        if (
is_set($arFields"LAST_VISIT") && (!$DB->IsDate($arFields["LAST_VISIT"], falseLANG"FULL")))
        {
            
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GU_ERROR_LAST_VISIT"), "ERROR_LAST_VISIT");
            return 
false;
        }

        if (
is_set($arFields"DATE_REG") && (!$DB->IsDate($arFields["DATE_REG"], falseLANG"FULL")))
        {
            
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("BLG_GU_ERROR_DATE_REG"), "ERROR_DATE_REG");
            return 
false;
        }

        if ((
is_set($arFields"ALLOW_POST") || $ACTION=="ADD") && $arFields["ALLOW_POST"] != "Y" && $arFields["ALLOW_POST"] != "N")
            
$arFields["ALLOW_POST"] = "Y";

        if (
is_set($arFields"AVATAR") && strlen($arFields["AVATAR"]["name"]) <= && strlen($arFields["AVATAR"]["del"]) <= 0)
            unset(
$arFields["AVATAR"]);

        if (
is_set($arFields"AVATAR"))
        {
            
$max_size COption::GetOptionInt("blog""avatar_max_size"30000);
            
//$max_width = COption::GetOptionInt("blog", "avatar_max_width", 100);
            //$max_height = COption::GetOptionInt("blog", "avatar_max_height", 100);
            
$res CFile::CheckImageFile($arFields["AVATAR"], $max_size00);
            if (
strlen($res) > 0)
            {
                
$GLOBALS["APPLICATION"]->ThrowException($res"ERROR_AVATAR");
                return 
false;
            }
        }

        return 
True;
    }