CBlogPost :: __AddSocNetPerms: Bitrix method

      
<?php 
//  CBlogPost :: __AddSocNetPerms()
//  /dist/bitrix/modules/blog/general/blog_post.php:1237

    
public static function __AddSocNetPerms($ID$entityType ""$entityID 0$entity)
    {
        global 
$DB;

        static 
$allowedTypes false;

        if (
$allowedTypes === false)
        {
            
$allowedTypes = Array("D""U""UP""SG""DR""G""AU");
            if (
IsModuleInstalled('crm'))
            {
                
$allowedTypes[] = "CRMCONTACT";
            }
        }

        if(
IntVal($ID) > && strlen($entityType) > && strlen($entity) > && in_array($entityType$allowedTypes))
        {
            
$arSCFields = Array("POST_ID" => $ID"ENTITY_TYPE" => $entityType"ENTITY_ID" => IntVal($entityID), "ENTITY" => $entity);
            
$arSCInsert $DB->PrepareInsert("b_blog_socnet_rights"$arSCFields);

            if (
strlen($arSCInsert[0]) > 0)
            {
                
$strSql =
                    
"INSERT INTO b_blog_socnet_rights(".$arSCInsert[0].") ".
                    
"VALUES(".$arSCInsert[1].")";
                
$DB->Query($strSqlFalse"File: ".__FILE__."<br>Line: ".__LINE__);
                return 
true;
            }
        }
        return 
false;
    }