From 61d65ba7c7abe6325f9c72407e38f2e4d470cc54 Mon Sep 17 00:00:00 2001 From: Simon Schaufelberger Date: Fri, 15 Feb 2013 20:01:13 +0100 Subject: [PATCH 1/2] Refs #3252 Update Thunderbird icon and name --- libs/UserAgentParser/UserAgentParser.php | 5 +++-- libs/UserAgentParser/UserAgentParser.test.php | 1 + plugins/UserSettings/images/browsers/TB.gif | Bin 0 -> 1061 bytes 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 plugins/UserSettings/images/browsers/TB.gif diff --git a/libs/UserAgentParser/UserAgentParser.php b/libs/UserAgentParser/UserAgentParser.php index d36608eb39c..07f59f709bb 100644 --- a/libs/UserAgentParser/UserAgentParser.php +++ b/libs/UserAgentParser/UserAgentParser.php @@ -5,7 +5,6 @@ * * @link http://dev.piwik.org/trac/browser/trunk/libs/UserAgentParser * @license http://www.opensource.org/licenses/bsd-license.php BSD License - * @version $Id$ * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -114,6 +113,8 @@ class UserAgentParser 'icecat' => 'FF', 'firefox' => 'FF', + 'thunderbird' => 'TB', + 'flock' => 'FL', 'fluid' => 'FD', 'galeon' => 'GA', @@ -430,7 +431,7 @@ static public function getBrowser($userAgent) $userAgent = preg_replace('~^BlackBerry\d+/~', 'BlackBerry/', $userAgent); if (preg_match_all("/($browsersPattern)[\/\sa-z(]*([0-9]+)([\.0-9a-z]+)?/i", $userAgent, $results) - || (strpos($userAgent, 'Shiira') === false && preg_match_all("/(firefox|safari)[\/\sa-z(]*([0-9]+)([\.0-9a-z]+)?/i", $userAgent, $results)) + || (strpos($userAgent, 'Shiira') === false && preg_match_all("/(firefox|thunderbird|safari)[\/\sa-z(]*([0-9]+)([\.0-9a-z]+)?/i", $userAgent, $results)) || preg_match_all("/(applewebkit)[\/\sa-z(]*([0-9]+)([\.0-9a-z]+)?/i", $userAgent, $results) || preg_match_all("/^(mozilla)\/([0-9]+)([\.0-9a-z-]+)?(?: \[[a-z]{2}\])? (?:\([^)]*\))$/i", $userAgent, $results) || preg_match_all("/^(mozilla)\/[0-9]+(?:[\.0-9a-z-]+)?\s\(.* rv:([0-9]+)([.0-9a-z]+)\) gecko(\/[0-9]{8}|$)(?:.*)/i", $userAgent, $results) diff --git a/libs/UserAgentParser/UserAgentParser.test.php b/libs/UserAgentParser/UserAgentParser.test.php index 9429961b189..f5468c1b6b3 100644 --- a/libs/UserAgentParser/UserAgentParser.test.php +++ b/libs/UserAgentParser/UserAgentParser.test.php @@ -27,6 +27,7 @@ 'firefox 3.6 alpha on vista' => 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2a2pre) Gecko/20090826 Namoroka/3.6a2pre', 'firefox 3.5 alpha on win7' => 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1b4pre) Gecko/20090420 Shiretoko/3.5b4pre (.NET CLR 3.5.30729)', 'firefox nightly build' => 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:2.0a1pre) Gecko/2008060602 Minefield/4.0a1pre', + 'thunderbird 14.0 with lightning 1.6' => 'Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 Lightning/1.6', ); echo "Test with another user agent: "; foreach($testUserAgent as $name => $userAgent) { diff --git a/plugins/UserSettings/images/browsers/TB.gif b/plugins/UserSettings/images/browsers/TB.gif new file mode 100644 index 0000000000000000000000000000000000000000..d4dc60b25bc8c54efcffde74cdef6d178eeb86d3 GIT binary patch literal 1061 zcmZ?wbhEHb6krfwcz&FLK{|;=CV^QtSy(PS zf4{G1fU^Izc~%;3z9j)cIWlpJRpTZ_hK8ubE>wtL92i;c9yQfEzDF)&k!4DMOk77o ze2G>1w5)`%tc1wiq%f8I4F!cAD30)T`TVRJX^tZl7WO9^c9p`VD&w8}{fn?$d4DpHtFl(74aFZc%kfj!nZ3 z!{!6V&HHUy_cT@Ho3pMnQ0CRU zue-6_ankX+_PJh@kNQnH=rip|e^+b7l%wT++k&T`44!e^Z}zEaz0KjX4$qj_Ics8j z@|;t_3ofV6J3V`9-|XpA7R>0+TX<&S%>JTPXUkS!S+!v0++~|9*IjE~zo~rFg{3Rj zH*L7uvhiyDmYeI>uUo%|KG2F|Ni~||K=Q2fcl$i?uVL5BedKzV|J;~zsmr-%d>uUgQu zI^GzKf)Ej-=)OM!M(Lu5liOz~{Ca$hN7^uC5=+#KObI!^BUOqE%iK*Iempe{DXi?OB~xd zbOCHw)#kL;JGQHZY ziwTZham>0qHC$HoO_nlJ(O57cOL0T^ax2%ME35|@L^kPhsZ8^}G)bVLgqfFzgTWdA DI9O{s literal 0 HcmV?d00001 From d9d25ba45f0c7192c4be56d86c737f7a8ad09d97 Mon Sep 17 00:00:00 2001 From: Simon Schaufelberger Date: Fri, 15 Feb 2013 23:53:39 +0100 Subject: [PATCH 2/2] fixes #3252 Update Thunderbird icon and name --- libs/UserAgentParser/UserAgentParser.php | 2 +- tests/PHPUnit/Plugins/UserSettingsTest.php | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libs/UserAgentParser/UserAgentParser.php b/libs/UserAgentParser/UserAgentParser.php index 07f59f709bb..7d9cee744d8 100644 --- a/libs/UserAgentParser/UserAgentParser.php +++ b/libs/UserAgentParser/UserAgentParser.php @@ -174,7 +174,7 @@ class UserAgentParser // browser family (by layout engine) static protected $browserType = array( 'ie' => array('IE'), - 'gecko' => array('NS', 'PX', 'FF', 'FB', 'CA', 'GA', 'KM', 'MO', 'SM', 'CO', 'FE', 'KP', 'KZ'), + 'gecko' => array('NS', 'PX', 'FF', 'FB', 'CA', 'GA', 'KM', 'MO', 'SM', 'CO', 'FE', 'KP', 'KZ', 'TB'), 'khtml' => array('KO'), 'webkit' => array('SF', 'CH', 'OW', 'AR', 'EP', 'FL', 'WO', 'AB', 'IR', 'CS', 'FD', 'HA', 'MI', 'GE', 'DF', 'BB', 'BP', 'TI', 'CF', 'RK', 'B2'), 'opera' => array('OP'), diff --git a/tests/PHPUnit/Plugins/UserSettingsTest.php b/tests/PHPUnit/Plugins/UserSettingsTest.php index 9f48ef5571c..a33b5039926 100644 --- a/tests/PHPUnit/Plugins/UserSettingsTest.php +++ b/tests/PHPUnit/Plugins/UserSettingsTest.php @@ -928,6 +928,18 @@ public function getUserAgents() array('Mozilla/5.0 (X11; U; CrOS i686 9.10.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.253.0 Safari/532.5', array( array('CH', 'Chrome', 'Chrome', '4.0', '4', '0', 'webkit'), array('LIN', 'Linux', 'Linux'))), + + + // Email Clients + + // Thunderbird + array('Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 Lightning/1.6', array( + array('TB', 'Thunderbird', 'Thunderbird', '14.0', '14', '0', 'gecko'), + array('WXP', 'Windows XP', 'Win XP'))), + + array('Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121011 Thunderbird/16.0.1', array( + array('TB', 'Thunderbird', 'Thunderbird', '16.0', '16', '0', 'gecko'), + array('LIN', 'Linux', 'Linux'))), ); }