- Модуль: webdav
- Путь к файлу: ~/bitrix/modules/webdav/classes/general.php
- Класс: CWebDavBase
- Вызов: CWebDavBase::GetClientOS
static function GetClientOS()
{
$clientOS = null;
$client = $_SERVER['HTTP_USER_AGENT'];
if (preg_match("/(msie) ([0-9]{1,2}.[0-9]{1,3})/i", $client, $match)) {
$browser['name'] = "MSIE";
$browser['version'] = $match[2];
}
if(preg_match("/linux/i", $client))
{
$clientOS = "Linux";
}
elseif(preg_match("/(windows nt)( ){0,1}([0-9]{1,2}.[0-9]{1,2}){0,1}/i", $client, $match))
{
if (isset($match[3]))
{
if ($match[3] == '5.0') $clientOS = "Windows 2000";
elseif ($match[3] == '5.1') $clientOS = "Windows XP";
elseif ($match[3] == '5.2') $clientOS = "Windows 2003";
elseif ($match[3] == '6.0' && mb_strpos($client, 'SLCC1') !== false) $clientOS = "Windows Vista";
elseif ($match[3] == '6.0' && mb_strpos($client, 'SLCC2') !== false) $clientOS = "Windows 2008";
elseif ($match[3] == '6.0') $clientOS = "Windows Vista"; // may be 2008
elseif ($match[3] == '6.1') $clientOS = "Windows 7";
elseif ($match[3] == '6.2') $clientOS = "Windows 8";
else $clientOS = "Windows";
} else {
$clientOS = "Windows";
}
}
elseif(!!preg_match("/mac/i", $client) || !!preg_match("/darwin/i", $client))
{
$clientOS = "Mac";
}
return $clientOS;
}