Permalink
Browse files

Updates user agent detection in client library.

  • Loading branch information...
JB Lebrun
JB Lebrun committed Nov 5, 2018
1 parent 7b68ddc commit b5fc230a2bcb86e72234f0eca11fe5fd80f15f39
@@ -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.41
* @version 1.0.42
* @date Creation: Jun 2007
* @date Modification: Oct 2018
* @copyright 2007 - 2018 CaMykS Team
@@ -527,15 +527,10 @@ function client_getUAInfos($ua=false) {
'browser_title' => 'Kindle browser',
'browser_version' => $matches[1],
));
elseif (preg_match('/KFFOWI/', $ua, $matches))
/* build info */
$infos = array_merge($infos, array(
'platform_company' => 'Amazon',
'platform_model' => 'Kindle Fire (5th Gen)',
'platform_type' => 'tablet',
'platform_format' => 'tablet',
'platform_year' => 2015,
));
elseif (preg_match('/ (KF[A-Z]{4}) Build/', $ua, $matches)) {
include_once ('clientDevices/Amazon.php.inc');
$infos = array_merge($infos, get_AmazonClientDevice($matches[1]));
}
/* check Wiko */
elseif (preg_match('/ (barry|birdy|bloom|cink|darkfull|darkmoon|darkside|fever|fizz|freddy|getaway|goa|harry|highway|iggy|jerry|jimmy|kenny|kite|lenny|ozzy|pulp|rainbow|ridge|robby|selfy|slide|stairway|star|sublim|sunny|sunset|tommy|u feel|u pulse|view|violet|wax|wim)([A-Za-z0-9 _]*)?( Build|\))/i', $ua, $matches)) {
@@ -844,7 +839,7 @@ function client_getUAInfos($ua=false) {
}
/* check Xiaomi mobiles */
elseif (preg_match('/(Redmi|MI) ?([A-Za-z0-9 ]{1,}) Build/i', $ua, $matches)) {
elseif (preg_match('/(Redmi|MI) ?([A-Za-z0-9 ]{1,})( Build|\))/i', $ua, $matches)) {
include_once ('clientDevices/Xiaomi.php.inc');
$infos = array_merge($infos, get_XiaomiClientDevice($matches[1].' '.$matches[2]));
} elseif (preg_match('/HM NOTE 1LTE/', $ua, $matches))
@@ -4,7 +4,7 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientBots/Tools.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.8
* @version 1.0.9
* @date Creation: May 2018
* @date Modification: Oct 2018
* @copyright 2018 CaMykS Team
@@ -1091,6 +1091,16 @@ function _client_getKnownTools() {
'engine_url' => 'https://slack.com/',
);
/* Siteliner */
$knownTools['siteliner'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
'tool_title' => 'Siteliner bot',
'tool_url' => 'http://www.siteliner.com/bot',
'engine_title' => 'Siteliner',
'engine_url' => 'http://www.siteliner.com',
);
/* return list */
return $knownTools;
}
@@ -0,0 +1,46 @@
<?php
/**
* @brief Amazon client devices specific methods
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Amazon.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 Amazon client device information from a known list.
* @param mixed $deviceCode
* @return array
*/
function get_AmazonClientDevice($deviceCode='') {
$deviceList = array(
'KFTHWI' => array('platform_model' => 'Kindle Fire HDX 7', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2013,),
'KFFOWI' => array('platform_model' => 'Kindle Fire (5th Gen)', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2015,),
);
/* Check for returning list */
if ($deviceCode === false)
return $deviceList;
/* Initialise result. */
$result = array(
'platform_company' => 'Amazon',
'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]);
}
?>
@@ -4,7 +4,7 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Google.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.2
* @version 1.0.3
* @date Creation: Aug 2018
* @date Modification: Oct 2018
* @copyright 2018 CaMykS Team
@@ -22,7 +22,9 @@ function get_GoogleClientDevice($deviceCode='') {
$deviceList = array(
'Nexus' => array('platform_year' => 2010),
'Nexus 4' => array('platform_year' => 2012),
'Nexus 5' => array('platform_year' => 2013),
'Nexus 5X' => array('platform_year' => 2015),
'Nexus 6P' => 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/Huawei.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
@@ -72,6 +72,7 @@ function get_HuaweiClientDevice($deviceCode='') {
'FRD-L19' => array('platform_model' => 'Honor 8', 'platform_year' => 2016),
'PRA-TL10' => array('platform_model' => 'Honor 8 Lite', 'platform_year' => 2016),
'DUK-L09' => array('platform_model' => 'Honor 8 Pro', 'platform_year' => 2017),
'JSN-L21' => array('platform_model' => 'Honor 8X', 'platform_year' => 2018),
'STF-L09' => array('platform_model' => 'Honor 9', 'platform_year' => 2017),
'LLD-L31' => array('platform_model' => 'Honor 9 Lite', 'platform_year' => 2017),
'COL-L29' => array('platform_model' => 'Honor 10', 'platform_year' => 2018),
@@ -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.18
* @version 1.0.19
* @date Creation: Apr 2018
* @date Modification: Oct 2018
* @copyright 2018 CaMykS Team
@@ -42,6 +42,8 @@ function get_SamsungClientDevice($deviceCode='') {
'SM-T535' => array('platform_model' => 'Galaxy Tab 4 (4G)', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2014),
'SM-T550' => array('platform_model' => 'Galaxy Tab A', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2015),
'SM-P550' => array('platform_model' => 'Galaxy Tab A', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2015),
'SM-T280' => array('platform_model' => 'Galaxy Tab A 7.0', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2016),
'SM-T285' => array('platform_model' => 'Galaxy Tab A 7.0', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2016),
'SM-T560' => array('platform_model' => 'Galaxy Tab E', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2015),
'SM-T561' => array('platform_model' => 'Galaxy Tab E', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2015),
'SM-T580' => array('platform_model' => 'Galaxy Tab S8', 'platform_type' => 'tablet', 'platform_format' => 'tablet', 'platform_year' => 2016),
@@ -71,6 +73,7 @@ function get_SamsungClientDevice($deviceCode='') {
'GT-I9192' => array('platform_model' => 'Galaxy S4 Mini Duos', 'platform_year' => 2013),
'SM-G900A' => array('platform_model' => 'Galaxy S5', 'platform_year' => 2014),
'SM-G900F' => array('platform_model' => 'Galaxy S5', 'platform_year' => 2014),
'SM-G900P' => array('platform_model' => 'Galaxy S5', 'platform_year' => 2014),
'SM-G903F' => array('platform_model' => 'Galaxy S5', 'platform_year' => 2014),
'SM-G901F' => array('platform_model' => 'Galaxy S5+', 'platform_year' => 2014),
'SM-G800F' => array('platform_model' => 'Galaxy S5 Mini', 'platform_year' => 2014),
@@ -79,6 +82,7 @@ function get_SamsungClientDevice($deviceCode='') {
'SM-G920P' => array('platform_model' => 'Galaxy S6', 'platform_year' => 2015),
'SM-G925T' => array('platform_model' => 'Galaxy S6 Edge', 'platform_year' => 2015),
'SM-G925F' => array('platform_model' => 'Galaxy S6 Edge', 'platform_year' => 2015),
'SM-G925P' => array('platform_model' => 'Galaxy S6 Edge', 'platform_year' => 2015),
'SM-G925W8' => array('platform_model' => 'Galaxy S6 Edge', 'platform_year' => 2015),
'SM-G928C' => array('platform_model' => 'Galaxy S6 Edge+', 'platform_year' => 2015),
'SM-G928F' => array('platform_model' => 'Galaxy S6 Edge+', 'platform_year' => 2015),
@@ -99,6 +103,7 @@ function get_SamsungClientDevice($deviceCode='') {
'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-G9600' => 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/Xiaomi.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.8
* @version 1.0.9
* @date Creation: May 2018
* @date Modification: Oct 2018
* @copyright 2018 CaMykS Team
@@ -26,6 +26,7 @@ function get_XiaomiClientDevice($deviceCode='') {
/* phones */
'mi 2' => array('platform_model' => 'Mi 2', 'platform_year' => 2012),
'mi 5' => array('platform_model' => 'Mi 5', 'platform_year' => 2016),
'mi 5s' => array('platform_model' => 'Mi 5S', 'platform_year' => 2016),
'mi 5x' => array('platform_model' => 'Mi 5X', 'platform_year' => 2017),
'mi a1' => array('platform_model' => 'Mi A1', 'platform_year' => 2017),
'mi note pro' => array('platform_model' => 'Mi Note Pro', 'platform_year' => 2015),

0 comments on commit b5fc230

Please sign in to comment.