• Модуль: statistic
  • Путь к файлу: ~/bitrix/modules/statistic/classes/general/keepstatistic.php
  • Класс: CKeepStatistics
  • Вызов: CKeepStatistics::CheckSkip
static function CheckSkip()
{
	global $USER;
	$GO = true;
	$skipMode = COption::GetOptionString("statistic", "SKIP_STATISTIC_WHAT");
	switch($skipMode)
	{
		case "none":
			break;
		case "both":
		case "groups":
			$arUserGroups = $USER->GetUserGroupArray();
			$arSkipGroups = explode(",", COption::GetOptionString("statistic", "SKIP_STATISTIC_GROUPS"));
			foreach($arSkipGroups as $key=>$value)
			{
				if(in_array(intval($value), $arUserGroups))
				{
					$GO = false;
					break;
				}
			}
			if($skipMode=="groups")
				break;
			//else
			//	continue checking
		case "ranges":
			if($skipMode=="both" && $GO)
				break;//in case group check failed
			$GO = true;
			if(preg_match("/^.*?(d+).(d+).(d+).(d+)[s-]*/", $_SERVER["REMOTE_ADDR"], $arIPAdress))
			{
				$arSkipIPRanges = explode("n", COption::GetOptionString("statistic", "SKIP_STATISTIC_IP_RANGES"));
				foreach($arSkipIPRanges as $key=>$value)
				{
					if(preg_match("/^.*?(d+).(d+).(d+).(d+)[s-]*(d+).(d+).(d+).(d+)/", $value, $arIPRange))
					{
						if(
							intval($arIPAdress[1]) >= intval($arIPRange[1]) && intval($arIPAdress[1]) <= intval($arIPRange[5]) &&
							intval($arIPAdress[2]) >= intval($arIPRange[2]) && intval($arIPAdress[2]) <= intval($arIPRange[6]) &&
							intval($arIPAdress[3]) >= intval($arIPRange[3]) && intval($arIPAdress[3]) <= intval($arIPRange[7]) &&
							intval($arIPAdress[4]) >= intval($arIPRange[4]) && intval($arIPAdress[4]) <= intval($arIPRange[8])
						)
						{
							$GO = false;
							break;
						}
					}
				}
			}
			break;
	}
	return $GO;
}