From 588763e6abf20ff0134126764ce05f54f35961d8 Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Sun, 24 Jun 2007 14:45:02 +0200 Subject: [PATCH] add Safari for Windows, better Safari detection, more consistency for Symbian --- include/classes/useragent.php-class | 8 +++++++- testbed/ua_list_raw.txt | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/classes/useragent.php-class b/include/classes/useragent.php-class index 2aa2ddc..9a28094 100755 --- a/include/classes/useragent.php-class +++ b/include/classes/useragent.php-class @@ -273,7 +273,12 @@ class userAgent { } elseif (preg_match('|Safari/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { $this->brand = 'Safari'; - $this->version = $regs[1]; + if (preg_match('|Version/([0-9a-zA-Z\.+]+)|', $this->uastring, $vregs)) { + $this->version = $vregs[1]; + } + else { + $this->version = '('.$regs[1].')'; + } $this->bot = false; } elseif (preg_match('|AppleWebKit/([0-9a-zA-Z\.+]+)|', $this->uastring, $regs)) { @@ -1019,6 +1024,7 @@ class userAgent { elseif (strpos($this->uadata['os'], 'apple') !== false) { $this->uadata['os'] = 'MacOS'; } elseif (strpos($this->uadata['os'], 'Macintosh') !== false) { $this->uadata['os'] = 'MacOS'; } elseif (strpos($this->uadata['os'], 'linux') !== false) { $this->uadata['os'] = 'Linux'; } + elseif (preg_match('/Symbian ?OS/i',$this->uadata['os'])) { $this->uadata['os'] = 'SymbianOS'; } if (strpos($this->uadata['os'], 'Win') !== false) { $this->uadata['platform'] = 'Windows'; } elseif (strpos($this->uadata['os'], 'Mac') !== false) { $this->uadata['platform'] = 'Macintosh'; } diff --git a/testbed/ua_list_raw.txt b/testbed/ua_list_raw.txt index 30da1a0..9952e6d 100755 --- a/testbed/ua_list_raw.txt +++ b/testbed/ua_list_raw.txt @@ -90,6 +90,7 @@ Mozilla/5.0 (compatible; Konqueror/3.1; CYGWIN_NT-5.1) Mozilla/5.0 (compatible; Konqueror/3.2; OpenBSD) (KHTML, like Gecko) Mozilla/5.0 (compatible; Konqueror/3.4; Linux) KHTML/3.4.0 (like Gecko) Mozilla/5.0 (compatible; Konqueror/3.3; Linux; X11; i686; es, en_US) KHTML/3.3.2 (like Gecko) +Mozilla/5.0 (Windows; U; Windows NT 5.1; de) AppleWebKit/522.13.1 (KHTML, like Gecko) Version/3.0.2 Safari/522.13.1 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/51 (like Gecko) Safari/51 Mozilla/4.0 (compatible; MSIE 5.12; Mac_PowerPC) OmniWeb/4.1.1-v424.6 Mozilla/4.5 (compatible; OmniWeb/4.1.1-v423; Mac_PowerPC) -- 2.35.3