Permalink
Browse files

Updates user agent detection in client library.

  • Loading branch information...
JB Lebrun
JB Lebrun committed Oct 26, 2018
1 parent ec422cc commit 0c20e20a703d91962e68962e9401930224f7f816
@@ -4,7 +4,7 @@
* @details Engine / Tool Library
* @file engine/lib/tool/client.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.40
* @version 1.0.41
* @date Creation: Jun 2007
* @date Modification: Oct 2018
* @copyright 2007 - 2018 CaMykS Team
@@ -390,9 +390,9 @@ function client_getUAInfos($ua=false) {
));
/* check Sony mobiles and tablets */
elseif (preg_match('/ ([C-H])([0-9]{4}) Build/', $ua, $matches)) {
elseif (preg_match('/ ([C-H][0-9]{4})( Build|\))/', $ua, $matches)) {
include_once ('clientDevices/Sony.php.inc');
$infos = array_merge($infos, get_SonyClientDevice($matches[1].$matches[2]));
$infos = array_merge($infos, get_SonyClientDevice($matches[1]));
}
elseif (preg_match('/SO(V3[0-9]|-[0-9]{2}[A-Z])/', $ua, $matches)) {
include_once ('clientDevices/Sony.php.inc');
@@ -601,18 +601,8 @@ function client_getUAInfos($ua=false) {
/* check Tecno mobiles */
elseif (preg_match('/Tecno ?([^;| ]*) Build/i', $ua, $matches)) {
$rep = array(
'K7' => array('platform_model' => 'Spark (K7)'),
);
$model = trim($matches[1]);
$infos = array_merge($infos, array(
'platform_company' => 'Tecno',
'platform_model' => isset($matches[1])?$matches[1]:'',
'platform_type' => 'handheld',
'platform_format' => 'handheld'
),
isset($rep[$model])?$rep[$model]:array()
);
include_once ('clientDevices/Tecno.php.inc');
$infos = array_merge($infos, get_TecnoClientDevice($matches[1]));
}
/* check Yezz Andy models */
@@ -786,7 +776,7 @@ function client_getUAInfos($ua=false) {
}
/* check Acer mobiles */
elseif (preg_match('/ (Z130|T03|T04) Build/', $ua, $matches)) {
elseif (preg_match('/ (Z130|T0[0-9]) Build/', $ua, $matches)) {
include_once ('clientDevices/Acer.php.inc');
$infos = array_merge($infos, get_AcerClientDevice($matches[1]));
}
@@ -1468,8 +1458,8 @@ function client_getUAInfos($ua=false) {
}
/* check Chrome/Safari/Firefox/Explorer compatible browsers, to be tested before usual browsers */
elseif (preg_match('/(YaBrowser|OPR|IceDragon|Dragon|CriOS|Adventurer|Sleipnir|BoBrowser|Dolfin|ChromePlus|Phoenix|Shiretoko|NS8|MiuiBrowser|SamsungBrowser\/CrossApp|SamsungBrowser|Vivaldi|Qt|Iceweasel|Puffin|Firebird|FBAV|FBSV|app-ipad-CoteMaison|QQBrowser|PaleMoon|Arora|Edge|Cheshire|MicroMessenger|Getter|Dooble|amaya|Roccat|QupZilla|MMS|Iron|ACHEETAHI|OPiOS|Beonex|LibertyBrowser|LinkedIn|SeaMonkey|Cyberfox|Focus|Fennec|K-Meleon|CoolNovo|QuickLook|GSA|Electron|NG|FxiOS|FocusiOS|Lotus-Notes|Chimera|Epiphany|Iridium|HeadlessChrome|QwantiOS|Blazer|TenFourFox|Silk|SailfishBrowser|coc_coc_browser|MZBrowser|2345Explorer|Kinza|WebPositive)\/([a-z0-9\._]*)?/i', $ua, $matches)) {
$rep = array('OPR'=>'Opera', 'CriOS'=>'Chrome', 'Dragon'=>'IceDragon', 'NS8'=>'Netscape', 'Firebird'=>'Thunderbird', 'FBAV'=>'Facebook App', 'FBSV'=>'Facebook App', 'app-ipad-CoteMaison'=>'C&ocirc;t&eacute; Maison App', 'amaya'=>'Amaya', 'MMS'=>'Opera Neon', 'ACHEETAHI'=>'CM Browser', 'OPiOS'=>'Opera mini', 'Focus'=>'Firefox Focus', 'GSA'=>'Google Search App', 'NG'=>'Browser NG', 'FxiOS'=>'Firefox', 'FocusiOS'=>'Firefox Focus', 'Lotus-Notes'=>'Lotus Notes', 'QwantiOS'=>'Qwant', 'Blazer'=> 'Palm Blazer', 'MicroMessenger' => 'WeChat', 'SailfishBrowser' => 'Sailfish Browser', 'coc_coc_browser'=>'C&ocirc;c c&ocirc;c', 'MZBrowser' => 'Meizu Browser');
elseif (preg_match('/(YaBrowser|OPR|IceDragon|Dragon|CriOS|Adventurer|Sleipnir|BoBrowser|Dolfin|ChromePlus|Phoenix|Shiretoko|NS8|MiuiBrowser|SamsungBrowser\/CrossApp|SamsungBrowser|Vivaldi|Qt|Iceweasel|Puffin|Firebird|FBAV|FBSV|app-ipad-CoteMaison|QQBrowser|PaleMoon|Arora|Edge|Cheshire|MicroMessenger|Getter|Dooble|amaya|Roccat|QupZilla|MMS|Iron|ACHEETAHI|OPiOS|Beonex|LibertyBrowser|LinkedIn|SeaMonkey|Cyberfox|Focus|Fennec|K-Meleon|CoolNovo|QuickLook|GSA|Electron|NG|FxiOS|FocusiOS|Lotus-Notes|Chimera|Epiphany|Iridium|HeadlessChrome|QwantiOS|Blazer|TenFourFox|Silk|SailfishBrowser|coc_coc_browser|MZBrowser|2345Explorer|Kinza|WebPositive|Avast)\/([a-z0-9\._]*)?/i', $ua, $matches)) {
$rep = array('OPR'=>'Opera', 'CriOS'=>'Chrome', 'Dragon'=>'IceDragon', 'NS8'=>'Netscape', 'Firebird'=>'Thunderbird', 'FBAV'=>'Facebook App', 'FBSV'=>'Facebook App', 'app-ipad-CoteMaison'=>'C&ocirc;t&eacute; Maison App', 'amaya'=>'Amaya', 'MMS'=>'Opera Neon', 'ACHEETAHI'=>'CM Browser', 'OPiOS'=>'Opera mini', 'Focus'=>'Firefox Focus', 'GSA'=>'Google Search App', 'NG'=>'Browser NG', 'FxiOS'=>'Firefox', 'FocusiOS'=>'Firefox Focus', 'Lotus-Notes'=>'Lotus Notes', 'QwantiOS'=>'Qwant', 'Blazer'=> 'Palm Blazer', 'MicroMessenger' => 'WeChat', 'SailfishBrowser' => 'Sailfish Browser', 'coc_coc_browser'=>'C&ocirc;c c&ocirc;c', 'MZBrowser' => 'Meizu Browser', 'Avast' => 'Avast Browser');
$infos = array_merge($infos, array(
'browser_title' => isset($rep[$matches[1]])?$rep[$matches[1]]:$matches[1],
'browser_version' => isset($matches[2])?$matches[2]:'',
@@ -2250,8 +2240,8 @@ function _client_getUAPropertiesMaxVersions() {
),
'browser' => array(
'Firefox' => '65', // current is 62
'Chrome' => '72', // current is 69
'Chromium' => '72', // current is 69
'Chrome' => '73', // current is 70
'Chromium' => '73', // current is 70
'Internet Explorer' => '11.0.50', // latest
'Edge' => '45', // current is 40
'Opera' => '59', // current is 56
@@ -4,9 +4,9 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Acer.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.1
* @version 1.0.2
* @date Creation: Apr 2018
* @date Modification: Apr 2018
* @date Modification: Oct 2018
* @copyright 2018 CaMykS Team
* @note This program is distributed as is - WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -20,9 +20,10 @@
*/
function get_AcerClientDevice($deviceCode='') {
$deviceList = array(
'Z130' => array('platform_model' => 'Liquid Z3', 'plateform_year' => 2013),
'T03' => array('platform_model' => 'Liquid Z630', 'plateform_year' => 2015),
'T04' => array('platform_model' => 'Liquid Z630S', 'plateform_year' => 2016),
'Z130' => array('platform_model' => 'Liquid Z3', 'platform_year' => 2013),
'T03' => array('platform_model' => 'Liquid Z630', 'platform_year' => 2015),
'T04' => array('platform_model' => 'Liquid Z630S', 'platform_year' => 2016),
'T08' => array('platform_model' => 'Liquid Zest Plus', 'platform_year' => 2016),
);
/* Check for returning list */
@@ -4,9 +4,9 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Archos.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.4
* @version 1.0.5
* @date Creation: Apr 2018
* @date Modification: Jun 2018
* @date Modification: Oct 2018
* @copyright 2018 CaMykS Team
* @note This program is distributed as is - WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -91,10 +91,10 @@ function get_ArchosClientDevice($deviceCode='') {
'59 Xenon' => array('platform_model' => '59 Xenon', 'platform_year' => 2015),
'62 Xenon' => array('platform_model' => '62 Xenon', 'platform_year' => 2015),
'64 Xenon' => array('platform_model' => '64 Xenon', 'platform_year' => 2014),
'Diamond Plus' => array('platform_model' => 'Diamond Plus', 'platform_year' => 2015),
'Diamond S' => array('platform_model' => 'Diamond S', 'platform_year' => 2015),
'Access 40 3G' => array('platform_model' => 'Access 40 3G', 'platform_year' => 2017),
'Access 45 3G' => array('platform_model' => 'Access 45 3G', 'platform_year' => 2017),
'Access 50 Color 3G' => array('platform_model' => 'Access 50 Color 3G', 'platform_year' => 2017),
@@ -4,9 +4,9 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Google.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.1
* @version 1.0.2
* @date Creation: Aug 2018
* @date Modification: Sep 2018
* @date Modification: Oct 2018
* @copyright 2018 CaMykS Team
* @note This program is distributed as is - WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@@ -21,6 +21,7 @@
function get_GoogleClientDevice($deviceCode='') {
$deviceList = array(
'Nexus' => array('platform_year' => 2010),
'Nexus 4' => array('platform_year' => 2012),
'Nexus 5X' => array('platform_year' => 2015),
'Pixel 2' => array('platform_year' => 2017),
'Pixel 3' => array('platform_year' => 2018),
@@ -4,7 +4,7 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/LG.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.6
* @version 1.0.7
* @date Creation: Apr 2018
* @date Modification: Oct 2018
* @copyright 2018 CaMykS Team
@@ -41,15 +41,18 @@ function get_LGClientDevice($deviceCode='') {
'E960' => array('platform_model' => 'Nexus 4', 'platform_year' => 2012),
'H812' => array('platform_model' => 'G4', 'platform_year' => 2015),
'H815' => array('platform_model' => 'G4', 'platform_year' => 2015),
'H870' => array('platform_model' => 'G6', 'platform_year' => 2018),
'H870D' => array('platform_model' => 'G6', 'platform_year' => 2018),
'H955' => array('platform_model' => 'G Flex 2', 'platform_year' => 2015),
'L160L' => array('platform_model' => 'Optimus LTE2', 'platform_year' => 2018),
'LS996' => array('platform_model' => 'G Flex 2', 'platform_year' => 2015),
'K371' => array('platform_model' => 'Phoenix 2', 'platform_year' => 2016),
'K580' => array('platform_model' => 'X Cam', 'platform_year' => 2016),
'M700' => array('platform_model' => 'Q6 Alpha', 'platform_year' => 2017),
'M160' => array('platform_model' => 'K4', 'platform_year' => 2017),
'P715' => array('platform_model' => 'Optimus L7 II', 'platform_year' => 2013),
'P875' => array('platform_model' => 'Optimus F5', 'platform_year' => 2013),
'P920' => array('platform_model' => 'Optimus 3D', 'platform_year' => 2011),
'VS986' => array('platform_model' => 'G4', 'platform_year' => 2015),
);
@@ -4,7 +4,7 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Samsung.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.17
* @version 1.0.18
* @date Creation: Apr 2018
* @date Modification: Oct 2018
* @copyright 2018 CaMykS Team
@@ -98,6 +98,7 @@ function get_SamsungClientDevice($deviceCode='') {
'SM-G960F' => array('platform_model' => 'Galaxy S9', 'platform_year' => 2018),
'SM-G960U1' => array('platform_model' => 'Galaxy S9', 'platform_year' => 2018),
'SM-G960U' => array('platform_model' => 'Galaxy S9', 'platform_year' => 2018),
'SM-G960W' => array('platform_model' => 'Galaxy S9', 'platform_year' => 2018),
'SM-G965F' => array('platform_model' => 'Galaxy S9+', 'platform_year' => 2018),
'SM-G313HZ' => array('platform_model' => 'Galaxy V', 'platform_year' => 2014),
'SM-A300F' => array('platform_model' => 'Galaxy A3', 'platform_year' => 2014),
@@ -4,7 +4,7 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Sony.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.12
* @version 1.0.13
* @date Creation: Apr 2018
* @date Modification: Oct 2018
* @copyright 2018 CaMykS Team
@@ -52,6 +52,7 @@ function get_SonyClientDevice($deviceCode='') {
'F5321' => array('platform_model' => 'Xperia X Compact', 'platform_year' => 2016),
'F8331' => array('platform_model' => 'Xperia XZ', 'platform_year' => 2016),
'G3121' => array('platform_model' => 'Xperia XA1', 'platform_year' => 2017),
'G3221' => array('platform_model' => 'Xperia XA1 Ultra', 'platform_year' => 2017),
'G3312' => array('platform_model' => 'Xperia L1', 'platform_year' => 2017),
'G8141' => array('platform_model' => 'Xperia XZ Premium', 'platform_year' => 2017),
'G8342' => array('platform_model' => 'Xperia XZ1', 'platform_year' => 2017),
@@ -0,0 +1,46 @@
<?php
/**
* @brief Tecno client devices specific methods
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Tecno.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0
* @date Creation: Oct 2018
* @date Modification: Oct 2018
* @copyright 2018 CaMykS Team
* @note This program is distributed as is - WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* @warning This library is not loaded with CaMykS initialisation.
*/
/**
* Return Tecno client device information from a known list.
* @param mixed $deviceCode
* @return array
*/
function get_TecnoClientDevice($deviceCode='') {
$deviceList = array(
'K7' => array('platform_model' => 'Spark', 'platform_year' => 2017),
'K9' => array('platform_model' => 'Spark Plus', 'platform_year' => 2017),
);
/* Check for returning list */
if ($deviceCode === false)
return $deviceList;
/* Initialise result. */
$result = array(
'platform_company' => 'Tecno',
'platform_model' => $deviceCode,
'platform_type' => 'handheld',
'platform_format' => 'handheld',
);
/* Check if device is a known device. */
if (!array_key_exists($deviceCode, $deviceList))
return $result;
/* Return result. */
return array_merge($result, $deviceList[$deviceCode]);
}
?>

0 comments on commit 0c20e20

Please sign in to comment.