• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/general.php
  • Класс: CWebDavBase
  • Вызов: CWebDavBase::GetWindowsVersion
public function GetWindowsVersion()
{
	static $MODULE = 'webdav';
	static $PARAM = 'windows_version';
	static $savedValues = null;

	$result = '';
	$userIP = self::GetIP();
	if (empty($userIP))
		return $result;

	if ($savedValues === null)
	{
		$savedValues = @unserialize(COption::GetOptionString($MODULE,$PARAM,''), ['allowed_classes' => false]);
		if (!is_array($savedValues))
			$savedValues = array();
	}

	$ua = $_SERVER['HTTP_USER_AGENT'];
	if (preg_match('#Windows NT (d{1})#', $ua, $matches) > 0)
	{
		$result = (int) $matches[1];
		if ($result > 0)
		{
			if (
				! isset($savedValues[$userIP])
				|| ($result !== (int) $savedValues[$userIP])
			)
			{
				$savedValues[$userIP] = $result;
				COption::SetOptionString($MODULE,$PARAM,serialize($savedValues));
			}
		}
	}
	else // seems to be webdav request, try to get os from history
	{
		if (isset($savedValues[$userIP]))
			$result = (int) $savedValues[$userIP];
	}

	return $result;
}