CBlogPost :: CounterInc: Bitrix method

      
<?php 
//  CBlogPost :: CounterInc()
//  /dist/bitrix/modules/blog/general/blog_post.php:644

    
public static function CounterInc($ID)
    {
        global 
$DB;
        
$ID IntVal($ID);
        if(!
is_array($_SESSION["BLOG_COUNTER"]))
            
$_SESSION["BLOG_COUNTER"] = Array();
        if(
in_array($ID$_SESSION["BLOG_COUNTER"]))
            return;
        
$_SESSION["BLOG_COUNTER"][] = $ID;
        
$strSql =
            
"UPDATE b_blog_post SET ".
            
"    VIEWS =  ".$DB->IsNull("VIEWS"0)." + 1 ".
            
"WHERE ID=".$ID;
        
$DB->Query($strSql);
    }