Added some browsers
authorSascha Greuel <sascha@softcreatr.de>
Thu, 19 Sep 2013 21:17:57 +0000 (23:17 +0200)
committerSascha Greuel <sascha@softcreatr.de>
Thu, 19 Sep 2013 21:17:57 +0000 (23:17 +0200)
Also combined the expressions for opera and added chromium as chrome
browser

wcfsetup/install/files/lib/data/user/online/UserOnline.class.php

index 595176c1f2f0998dcaac0cc0db7c65df799d07c4..7518fd1f2090eb325277227f4d9d5885b42d555f 100644 (file)
@@ -85,14 +85,69 @@ class UserOnline extends UserProfile {
         * @return      string
         */
        public function getBrowser() {
-               // opera 12
-               if (preg_match('~opera.*version/([\d\.]+)~i', $this->userAgent, $match)) {
-                       return 'Opera '.$match[1];
+               // lunascape
+               if (preg_match('~lunascape[ /]([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Lunascape '.$match[1];
                }
                
-               // opera 15+
-               if (preg_match('~opr/([\d\.]+)~i', $this->userAgent, $match)) {
-                       return 'Opera '.$match[1];
+               // sleipnir
+               if (preg_match('~sleipnir/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Sleipnir '.$match[1];
+               }
+               
+               // uc browser
+               if (preg_match('~(?:ucbrowser|uc browser|ucweb)[ /]?([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'UC Browser '.$match[1];
+               }
+               
+               // baidu browser
+               if (preg_match('~(?:baidubrowser|flyflow)[ /]?([\d\.x]+)~i', $this->userAgent, $match)) {
+                       return 'Baidubrowser '.$match[1];
+               }
+               
+               // blackberry
+               if (preg_match('~blackberry.*version/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Blackberry '.$match[1];
+               }
+               
+               // opera mobile
+               if (preg_match('~opera/([\d\.]+).*(mobi|mini)~i', $this->userAgent, $match)) {
+                       return 'Opera Mobile '.$match[1];
+               }
+               
+               // opera
+               if (preg_match('~opera.*version/([\d\.]+)|opr/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Opera '.(isset($match[2]) ? $match[2] : $match[1]);
+               }
+               
+               // thunderbird
+               if (preg_match('~thunderbird/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Thunderbird '.$match[1];
+               }
+               
+               // icedragon
+               if (preg_match('~icedragon/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'IceDragon '.$match[1];
+               }
+               
+               // palemoon
+               if (preg_match('~palemoon/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'PaleMoon '.$match[1];
+               }
+               
+               // flock
+               if (preg_match('~flock/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Flock '.$match[1];
+               }
+               
+               // iceweasel
+               if (preg_match('~iceweasel/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Iceweasel '.$match[1];
+               }
+               
+               // firefox mobile
+               if (preg_match('~mobile.*firefox/([\d\.]+)|fennec/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Firefox Mobile '.(isset($match[2]) ? $match[2] : $match[1]);
                }
                
                // firefox
@@ -100,16 +155,66 @@ class UserOnline extends UserProfile {
                        return 'Firefox '.$match[1];
                }
                
+               // maxthon
+               if (preg_match('~maxthon[ /]([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Maxthon '.$match[1];
+               }
+               
+               // iemobile
+               if (preg_match('~iemobile[ /]([\d\.]+)|MSIE ([\d\.]+).*XBLWP7~i', $this->userAgent, $match)) {
+                       return 'Internet Explorer Mobile '.(isset($match[2]) ? $match[2] : $match[1]);
+               }
+               
                // ie
                if (preg_match('~msie ([\d\.]+)~i', $this->userAgent, $match)) {
                        return 'Internet Explorer '.$match[1];
                }
                
+               // iron
+               if (preg_match('~iron/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Iron '.$match[1];
+               }
+               
+               // coowon
+               if (preg_match('~coowon/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Coowon '.$match[1];
+               }
+               
+               // coolnovo
+               if (preg_match('~(?:coolnovo|chromeplus)/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'CoolNovo '.$match[1];
+               }
+               
+               // yandex
+               if (preg_match('~yabrowser/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Yandex '.$match[1];
+               }
+               
+               // midori
+               if (preg_match('~midori/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Midori '.$match[1];
+               }
+               
+               // chrome mobile
+               if (preg_match('~(?:crios|crmo)/([\d\.]+)|chrome/([\d\.]+).*mobile~i', $this->userAgent, $match)) {
+                       return 'Chrome Mobile '.(isset($match[2]) ? $match[2] : $match[1]);
+               }
+               
                // chrome
-               if (preg_match('~chrome/([\d\.]+)~i', $this->userAgent, $match)) {
+               if (preg_match('~(?:chromium|chrome)/([\d\.]+)~i', $this->userAgent, $match)) {
                        return 'Chrome '.$match[1];
                }
                
+               // kindle
+               if (preg_match('~kindle/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Kindle '.$match[1];
+               }
+               
+               // silk
+               if (preg_match('~silk/([\d\.]+)~i', $this->userAgent, $match)) {
+                       return 'Silk '.$match[1];
+               }
+               
                // safari
                if (preg_match('~([\d\.]+) safari~i', $this->userAgent, $match)) {
                        return 'Safari '.$match[1];