Permalink
Browse files

Update user agent detection in client library.

  • Loading branch information...
JB Lebrun
JB Lebrun committed Sep 13, 2018
1 parent c90e6ea commit 7d7f059fff17025e561b3a3438f33d814099ef85
@@ -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.33
* @version 1.0.34
* @date Creation: Jun 2007
* @date Modification: Sep 2018
* @copyright 2007 - 2018 CaMykS Team
@@ -876,6 +876,13 @@ function client_getUAInfos($ua=false) {
);
}
/* check Doogee mobiles, to be inserted before Xiaomi */
elseif (preg_match('/ (MIX Lite) Build/', $ua, $matches)) {
include_once ('clientDevices/Doogee.php.inc');
$model = $matches[1];
$infos = array_merge($infos, get_DoogeeClientDevice($model));
}
/* check Xiaomi mobiles */
elseif (preg_match('/(Redmi|MI) ?([A-Za-z0-9 ]{1,}) Build/i', $ua, $matches)) {
include_once ('clientDevices/Xiaomi.php.inc');
@@ -1138,6 +1145,10 @@ function client_getUAInfos($ua=false) {
include_once ('clientDevices/ZTE.php.inc');
$infos = array_merge($infos, get_ZTEClientDevice($matches[1]));
}
elseif (preg_match('/ (Z[0-9]{3}) Build/', $ua, $matches)) {
include_once ('clientDevices/ZTE.php.inc');
$infos = array_merge($infos, get_ZTEClientDevice($matches[1]));
}
/* check VKWorld mobiles */
elseif (preg_match('/ VK([0-9]{3}) Build/i', $ua, $matches)) {
@@ -1209,6 +1220,13 @@ function client_getUAInfos($ua=false) {
$infos = array_merge($infos, get_SymphonyClientDevice($model));
}
/* check Gionee mobiles */
elseif (preg_match('/ (P8W) Build/i', $ua, $matches)) {
include_once ('clientDevices/Gionee.php.inc');
$model = $matches[1];
$infos = array_merge($infos, get_GioneeClientDevice($model));
}
/*** check operating system ***/
if (!isset($infos['system_title'])) {
@@ -0,0 +1,45 @@
<?php
/**
* @brief Doogee client devices specific methods
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Doogee.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 Doogee client device information from a known list.
* @param mixed $deviceCode
* @return array
*/
function get_DoogeeClientDevice($deviceCode='') {
$deviceList = array(
'MIX Lite' => array('platform_model' => 'Mix Lite', 'platform_year' => 2017),
);
/* Check for returning list */
if ($deviceCode === false)
return $deviceList;
/* Initialise result. */
$result = array(
'platform_company' => 'Doogee',
'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,0 +1,45 @@
<?php
/**
* @brief Gionee client devices specific methods
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Gionee.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 Gionee client device information from a known list.
* @param mixed $deviceCode
* @return array
*/
function get_GioneeClientDevice($deviceCode='') {
$deviceList = array(
'P8W' => array('platform_year' => 2017),
);
/* Check for returning list */
if ($deviceCode === false)
return $deviceList;
/* Initialise result. */
$result = array(
'platform_company' => 'Gionee',
'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/Huawei.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.12
* @version 1.0.13
* @date Creation: Apr 2018
* @date Modification: Sep 2018
* @copyright 2018 CaMykS Team
@@ -69,6 +69,7 @@ function get_HuaweiClientDevice($deviceCode='') {
'DUK-L09' => array('platform_model' => 'Honor 8 Pro', 'platform_year' => 2017),
'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),
'BKL-L09S' => array('platform_model' => 'Honor View 10', 'platform_year' => 2018),
'Y635-L01' => array('platform_model' => 'Y635', 'platform_year' => 2015),
'Y520-U22' => array('platform_model' => 'Ascend', 'platform_year' => 2014),
@@ -4,11 +4,11 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/ZTE.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0
* @version 1.0.1
* @date Creation: May 2018
* @date Modification: May 2018
* @date Modification: Sep 2018
* @copyright 2018 CaMykS Team
* @note This program is distributed as is - WITHOUT ANY WARRANTY;
* @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.
*/
@@ -21,6 +21,8 @@
function get_ZTEClientDevice($deviceCode='') {
$deviceList = array(
'BLADE V7 LITE' => array('platform_model' => 'Blade V7 Lite', 'platform_year' => 2016),
'Z833' => array('platform_model' => 'Avid Trio', 'platform_year' => 2016),
);
/* Check for returning list */
@@ -42,4 +44,4 @@ function get_ZTEClientDevice($deviceCode='') {
/* Return result. */
return array_merge($result, $deviceList[$deviceCode]);
}
?>
?>

0 comments on commit 7d7f059

Please sign in to comment.