Permalink
Browse files

Updates user agent detection in client library.

  • Loading branch information...
JB Lebrun
JB Lebrun committed Sep 19, 2018
1 parent 606f6f2 commit a43e8d1f3e4604f0a7ac509d0540507013a279c5
@@ -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.34
* @version 1.0.35
* @date Creation: Jun 2007
* @date Modification: Sep 2018
* @copyright 2007 - 2018 CaMykS Team
@@ -316,6 +316,11 @@ function client_getUAInfos($ua=false) {
$infos = array_merge($infos, get_LGClientDevice($matches[1]));
}
elseif (preg_match('/ (VS[0-9]{3}) Build/', $ua, $matches)) {
include_once('clientDevices/LG.php.inc');
$infos = array_merge($infos, get_LGClientDevice($matches[1]));
}
/* check Motorola */
elseif (preg_match('/mot(?:-|orola |o|\-moto)([^ \/;]+)/i', $ua, $matches)) {
include_once('clientDevices/Motorola.php.inc');
@@ -433,6 +438,10 @@ function client_getUAInfos($ua=false) {
include_once ('clientDevices/Lenovo.php.inc');
$infos = array_merge($infos, get_LenovoClientDevice(trim($matches[2])));
}
elseif (preg_match('/ (Z2 Plus) Build/i', $ua, $matches)) {
include_once ('clientDevices/Lenovo.php.inc');
$infos = array_merge($infos, get_LenovoClientDevice(trim($matches[1])));
}
/* check Lenovo PCs */
elseif (preg_match('/MALC|MALCJS|MALN|MALNJS|LCJB|LEN2/', $ua, $matches))
@@ -744,27 +753,12 @@ function client_getUAInfos($ua=false) {
}
/* check Orange */
elseif (preg_match('/Nura 2/', $ua, $matches)) {
$rep = array(
'510'=> array('platform_model' => 'Smart 5'),
);
$model = trim($matches[0]);
$infos = array_merge($infos, array(
'platform_company' => 'Orange',
'platform_model' => $model,
'platform_type' => 'handheld',
'platform_format' => 'handheld'
),
isset($rep[$model])?$rep[$model]:array()
);
elseif (preg_match('/ (Nura 2) Build/', $ua, $matches)) {
include_once ('clientDevices/Orange.php.inc');
$infos = array_merge($infos, get_OrangeClientDevice($matches[1]));
} elseif (preg_match('/Orange ([^.]*) Build/', $ua, $matches)) {
$model = trim($matches[1]);
$infos = array_merge($infos, array(
'platform_company' => 'Orange',
'platform_model' => $model,
'platform_type' => 'handheld',
'platform_format' => 'handheld',
));
include_once ('clientDevices/Orange.php.inc');
$infos = array_merge($infos, get_OrangeClientDevice($matches[1]));
}
/* check Logicom */
@@ -1433,8 +1427,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|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|Lotus-Notes|Chimera|Epiphany|Iridium|HeadlessChrome|QwantiOS|Blazer|TenFourFox|Silk|SailfishBrowser|coc_coc_browser|MZBrowser|2345Explorer)\/([a-z0-9\._]*)?/i', $ua, $matches)) {
$rep = array('OPR'=>'Opera', 'CriOS'=>'Chrome', 'Dragon'=>'IceDragon', 'NS8'=>'Netscape', 'Firebird'=>'Thunderbird', 'FBAV'=>'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', '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|Lotus-Notes|Chimera|Epiphany|Iridium|HeadlessChrome|QwantiOS|Blazer|TenFourFox|Silk|SailfishBrowser|coc_coc_browser|MZBrowser|2345Explorer)\/([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', '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');
$infos = array_merge($infos, array(
'browser_title' => isset($rep[$matches[1]])?$rep[$matches[1]]:$matches[1],
'browser_version' => isset($matches[2])?$matches[2]:'',
@@ -4,9 +4,9 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/HTC.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0
* @version 1.0.1
* @date Creation: Aug 2018
* @date Modification: Aug 2018
* @date Modification: Sep 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.
@@ -27,6 +27,7 @@ function get_HTCClientDevice($deviceCode='') {
'One M8' => array('platform_model' => 'One (M8)', 'platform_year' => 2014),
'D820u' => array('platform_model' => 'Desire 820 Dual SIM', 'platform_year' => 2014),
'2PYB2' => array('platform_model' => 'Bolt', 'platform_year' => 2016),
'Desire 626' => array('platform_model' => 'Desire 626', 'platform_year' => 2015),
);
/* Check for returning list */
@@ -4,7 +4,7 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Huawei.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.13
* @version 1.0.14
* @date Creation: Apr 2018
* @date Modification: Sep 2018
* @copyright 2018 CaMykS Team
@@ -21,11 +21,12 @@
function get_HuaweiClientDevice($deviceCode='') {
$deviceList = array(
/* Huawei tablets */
'M2-A01W' => array('platform_model' => 'MediaPad M2', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2015),
'GEM-703LT' => array('platform_model' => 'MediaPad X2', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2015),
'BEETHOVEN-W09' => array('platform_model' => 'MediaPad M3', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2016),
'AGS-W09' => array('platform_model' => 'MediaPad T3', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2017),
'CMR-W09' => array('platform_model' => 'MediaPad M5', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2017),
'M2-A01W' => array('platform_model' => 'MediaPad M2', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2015),
'GEM-703LT' => array('platform_model' => 'MediaPad X2', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2015),
'BEETHOVEN-W09' => array('platform_model' => 'MediaPad M3', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2016),
'BEETHOVEN-DL09' => array('platform_model' => 'MediaPad M3', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2016),
'AGS-W09' => array('platform_model' => 'MediaPad T3', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2017),
'CMR-W09' => array('platform_model' => 'MediaPad M5', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2017),
/* Huawei phones */
@@ -83,6 +84,7 @@ function get_HuaweiClientDevice($deviceCode='') {
'CUN-L03' => array('platform_model' => 'Y5 II', 'platform_year' => 2016),
'SCL-L01' => array('platform_model' => 'Y6', 'platform_year' => 2015),
'SCL-U31' => array('platform_model' => 'Y6', 'platform_year' => 2015),
'MYA-L41' => array('platform_model' => 'Y6', 'platform_year' => 2017),
'LYO-L01' => array('platform_model' => 'Y6 II Compact', 'platform_year' => 2016),
'TRT-LX2' => array('platform_model' => 'Y7', 'platform_year' => 2017),
'TRT-LX3' => array('platform_model' => 'Y7', 'platform_year' => 2017),
@@ -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.3
* @version 1.0.4
* @date Creation: Apr 2018
* @date Modification: Sep 2018
* @copyright 2018 CaMykS Team
@@ -48,6 +48,8 @@ function get_LGClientDevice($deviceCode='') {
'P875' => array('platform_model' => 'Optimus F5', 'platform_year' => 2013),
'LS996' => array('platform_model' => 'G Flex 2', 'platform_year' => 2015),
'H955' => array('platform_model' => 'G Flex 2', 'platform_year' => 2015),
'VS986' => array('platform_model' => 'G4', 'platform_year' => 2015),
);
/* Check for returning list */
@@ -4,9 +4,9 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Lenovo.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.6
* @version 1.0.7
* @date Creation: Apr 2018
* @date Modification: Jul 2018
* @date Modification: Sep 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.
@@ -57,6 +57,8 @@ function get_LenovoClientDevice($deviceCode='') {
'K53a48' => array('platform_model' => 'K6 Note', 'platform_year' => 2016),
'K53b36' => array('platform_model' => 'K6 Plus', 'platform_year' => 2016),
'K10E70' => array('platform_model' => 'K10', 'platform_year' => 2017),
'Z2 Plus' => array('platform_year' => 2017),
);
/* Check for returning list */
@@ -4,9 +4,9 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/OnePlus.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.3
* @version 1.0.4
* @date Creation: Apr 2018
* @date Modification: Aug 2018
* @date Modification: Sep 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.
@@ -23,6 +23,7 @@ function get_OnePlusClientDevices() {
'A3003' => array('platform_model' => '3T', 'platform_year' => 2016),
'A3010' => array('platform_model' => '3T', 'platform_year' => 2016),
'A5000' => array('platform_model' => '5', 'platform_year' => 2017),
'A6003' => array('platform_model' => '6', 'platform_year' => 2018),
'E1003' => array('platform_model' => 'X', 'platform_year' => 2015),
);
}
@@ -0,0 +1,46 @@
<?php
/**
* @brief Orange client devices specific methods
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Orange.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0
* @date Creation: Sep 2018
* @date Modification: Sep 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 Orange client device information from a known list.
* @param mixed $deviceCode
* @return array
*/
function get_OrangeClientDevice($deviceCode='') {
$deviceList = array(
'Nura' => array('platform_year' => 2015),
'Nura 2' => array('platform_year' => 2016),
);
/* Check for returning list */
if ($deviceCode === false)
return $deviceList;
/* Initialise result. */
$result = array(
'platform_company' => 'Orange',
'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 a43e8d1

Please sign in to comment.