Skip to content

Commit

Permalink
Updates user agent detection in client library.
Browse files Browse the repository at this point in the history
  • Loading branch information
JB Lebrun committed Oct 9, 2018
1 parent 636d1c1 commit 6f9f0aa
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 13 deletions.
12 changes: 9 additions & 3 deletions engine/lib/tool/client.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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.37
* @version 1.0.38
* @date Creation: Jun 2007
* @date Modification: Oct 2018
* @copyright 2007 - 2018 CaMykS Team
Expand Down Expand Up @@ -549,6 +549,11 @@ function client_getUAInfos($ua=false) {
include_once ('clientDevices/Wiko.php.inc');
$infos = array_merge($infos, get_WikoClientDevice($model));
}
elseif (preg_match('/ (W_[A-Z][0-9]{3}) Build/i', $ua, $matches)) {
$model = trim(strtolower($matches[1]));
include_once ('clientDevices/Wiko.php.inc');
$infos = array_merge($infos, get_WikoClientDevice($model));
}
elseif (preg_match('/ (W_K600|[S|V][0-9]{2}[A-Za-z0-9\(\)]*)?( Build|\))/i', $ua, $matches)) {
$model = trim(strtolower($matches[1]));
include_once ('clientDevices/Wiko.php.inc');
Expand Down Expand Up @@ -1060,9 +1065,10 @@ function client_getUAInfos($ua=false) {
}

/* check HiSense mobiles */
elseif (preg_match('/Hisense ([A-Z][0-9]{2,3} [A-Za-z]*) Build/', $ua, $matches)) {
elseif (preg_match('/ Hisense ([A-Z][0-9]{2,3})( [A-Za-z]*)? Build/', $ua, $matches)) {
include_once ('clientDevices/HiSense.php.inc');
$infos = array_merge($infos, get_HiSenseClientDevice($matches[1]));
$model = $matches[1].(isset($matches[2]) ? $matches[2] : '');
$infos = array_merge($infos, get_HiSenseClientDevice($model));
}

/* check Yotaphone mobiles */
Expand Down
4 changes: 2 additions & 2 deletions engine/lib/tool/clientBots/Bots.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @details Engine / Bot Library
* @file engine/lib/tool/clientBots/Bots.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.16
* @version 1.0.17
* @date Creation: May 2018
* @date Modification: Oct 2018
* @copyright 2018 CaMykS Team
Expand Down Expand Up @@ -2383,7 +2383,7 @@ function _client_getKnownBots() {
'platform_type' => 'bot',
'platform_format' => 'desktop',
'bot_title' => 'Experibot',
'bot_url' => '',
'bot_url' => 'https://amirkr.wixsite.com/experibot',
'engine_title' => '',
'engine_url' => '',
);
Expand Down
12 changes: 11 additions & 1 deletion engine/lib/tool/clientBots/Tools.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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.7
* @version 1.0.8
* @date Creation: May 2018
* @date Modification: Oct 2018
* @copyright 2018 CaMykS Team
Expand Down Expand Up @@ -281,6 +281,16 @@ function _client_getKnownTools() {
'engine_url' => '',
);

/* WeChatShareExtension, before CFNetwork */
$knownTools['wechatshareextension'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
'tool_title' => 'WeChat Share Extension',
'tool_url' => 'https://www.wechat.com',
'engine_title' => 'Tencent Holdings',
'engine_url' => 'https://www.tencent.com/en-us/',
);

/* CFNetwork */
$knownTools['cfnetwork'] = array(
'platform_type' => 'tool',
Expand Down
7 changes: 4 additions & 3 deletions engine/lib/tool/clientDevices/HiSense.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/HiSense.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0
* @version 1.0.1
* @date Creation: Jul 2018
* @date Modification: Jul 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.
Expand All @@ -20,6 +20,7 @@
*/
function get_HiSenseClientDevice($deviceCode='') {
$deviceList = array(
'L675' => array('platform_model' => 'L675', 'platform_year' => 2016),
'L678' => array('platform_model' => 'Staraddict 5', 'platform_year' => 2016),
'F17 Pro' => array('platform_model' => 'Infinity F17 Pro', 'platform_year' => 2018),
);
Expand All @@ -30,7 +31,7 @@ function get_HiSenseClientDevice($deviceCode='') {

/* Initialise result. */
$result = array(
'platform_company' => 'HiSense',
'platform_company' => 'Hisense',
'platform_model' => $deviceCode,
'platform_type' => 'handheld',
'platform_format' => 'handheld',
Expand Down
7 changes: 5 additions & 2 deletions engine/lib/tool/clientDevices/Huawei.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Huawei.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.14
* @version 1.0.15
* @date Creation: Apr 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.
Expand Down Expand Up @@ -56,11 +56,13 @@ function get_HuaweiClientDevice($deviceCode='') {
'RNE-L21' => array('platform_model' => 'Mate 10 Lite', 'platform_year' => 2017),
'BLA-A09' => array('platform_model' => 'Mate 10 Pro', 'platform_year' => 2017),
'BLA-AL00' => array('platform_model' => 'Mate 10 Pro', 'platform_year' => 2017),
'BLA-L09S' => array('platform_model' => 'Mate 10 Pro', 'platform_year' => 2017),
'BLA-L29' => array('platform_model' => 'Mate 10 Pro', 'platform_year' => 2017),
'BLA-L29S' => array('platform_model' => 'Mate 10 Pro', 'platform_year' => 2017),
'CRR-L09' => array('platform_model' => 'Mate S', 'platform_year' => 2015),
'BND-L34' => array('platform_model' => 'Mate SE', 'platform_year' => 2016),
'NEM-L51' => array('platform_model' => 'Honor 5C', 'platform_year' => 2016),
'KIW-L21' => array('platform_model' => 'Honor 5X', 'platform_year' => 2015),
'JMM-L22' => array('platform_model' => 'Honor 6C Pro', 'platform_year' => 2017),
'BLN-L21' => array('platform_model' => 'Honor 6X', 'platform_year' => 2017),
'PLK-L01' => array('platform_model' => 'Honor 7', 'platform_year' => 2015),
Expand All @@ -72,6 +74,7 @@ function get_HuaweiClientDevice($deviceCode='') {
'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),
'AUM-L29' => array('platform_model' => 'Honor 7A Pro', 'platform_year' => 2018),
'Y635-L01' => array('platform_model' => 'Y635', 'platform_year' => 2015),
'Y520-U22' => array('platform_model' => 'Ascend', 'platform_year' => 2014),
'Y600-U151' => array('platform_model' => 'Ascend', 'platform_year' => 2014),
Expand Down
6 changes: 4 additions & 2 deletions engine/lib/tool/clientDevices/Wiko.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Wiko.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.1
* @version 1.0.2
* @date Creation: Jul 2018
* @date Modification: Jul 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.
Expand Down Expand Up @@ -111,6 +111,8 @@ function get_WikoClientDevice($deviceCode='') {
'wax' => array('platform_model' => 'Wax', 'platform_year' => 2014),
'wim' => array('platform_model' => 'Wim', 'platform_year' => 2017),
'wim lite' => array('platform_model' => 'Wim Lite', 'platform_year' => 2017),

'w_c800' => array('platform_model' => 'View 2', 'platform_year' => 2018),
);

/* Check for returning list */
Expand Down

0 comments on commit 6f9f0aa

Please sign in to comment.