Permalink
Browse files

Updates user agent detection in client library.

  • Loading branch information...
JB Lebrun
JB Lebrun committed Sep 6, 2018
1 parent b282aaf commit 98f61982fd10992d85eb520fa94e173abe58505e
@@ -4,9 +4,9 @@
* @details Engine / Tool Library
* @file engine/lib/tool/client.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.31
* @version 1.0.32
* @date Creation: Jun 2007
* @date Modification: Aug 2018
* @date Modification: Sep 2018
* @copyright 2007 - 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.
@@ -1188,6 +1188,27 @@ function client_getUAInfos($ua=false) {
$infos = array_merge($infos, get_KyoceraClientDevice($model));
}
/* check Digiciel mobiles */
elseif (preg_match('/ (DL[0-9]{3}) Build/', $ua, $matches)) {
include_once ('clientDevices/Digiciel.php.inc');
$model = trim($matches[1]);
$infos = array_merge($infos, get_DigicielClientDevice($model));
}
/* check Meizu mobiles */
elseif (preg_match('/ (MZ-[A-Za-z0-9 ]*) Build/', $ua, $matches)) {
include_once ('clientDevices/Meizu.php.inc');
$model = trim($matches[1]);
$infos = array_merge($infos, get_MeizuClientDevice($model));
}
/* check Symphony mobiles */
elseif (preg_match('/ ([iEHG][0-9]{2,3}) Build/i', $ua, $matches)) {
include_once ('clientDevices/Symphony.php.inc');
$model = trim($matches[1]);
$infos = array_merge($infos, get_SymphonyClientDevice($model));
}
/*** check operating system ***/
if (!isset($infos['system_title'])) {
@@ -1394,8 +1415,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)\/([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');
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)\/([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');
$infos = array_merge($infos, array(
'browser_title' => isset($rep[$matches[1]])?$rep[$matches[1]]:$matches[1],
'browser_version' => isset($matches[2])?$matches[2]:'',
@@ -2172,11 +2193,11 @@ function _client_getUAPropertiesMaxVersions() {
),
'browser' => array(
'Firefox' => '64', // current is 61
'Chrome' => '71', // current is 68
'Chromium' => '71', // current is 68
'Chrome' => '71', // current is 69
'Chromium' => '71', // current is 69
'Internet Explorer' => '11.0.50', // latest
'Edge' => '45', // current is 40
'Opera' => '57', // current is 54
'Opera' => '58', // current is 55
'Safari' => '14', // current is 11
),
);
@@ -4,9 +4,9 @@
* @details Engine / Bot Library
* @file engine/lib/tool/clientBots/Bots.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.13
* @version 1.0.14
* @date Creation: May 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.
@@ -3954,6 +3954,26 @@ function _client_getKnownBots() {
'engine_url' => 'http://yooo.nl/',
);
/* Elefent */
$knownBots['elefent'] = array(
'platform_type' => 'bot',
'platform_format' => 'desktop',
'bot_title' => 'Elefent crawler',
'bot_url' => 'https://crawler.elefent.net',
'engine_title' => 'Elefent',
'engine_url' => 'https://www.elefent.net',
);
/* Seekport Crawler */
$knownBots['seekport crawler'] = array(
'platform_type' => 'bot',
'platform_format' => 'desktop',
'bot_title' => 'Seekport Crawler',
'bot_url' => '',
'engine_title' => 'Seekport',
'engine_url' => 'http://www.seekport.com',
);
/* unknown bots */
/* SEOBulls - unknown bot */
@@ -4,9 +4,9 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientBots/Tools.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.4
* @version 1.0.5
* @date Creation: May 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.
@@ -1041,6 +1041,26 @@ function _client_getKnownTools() {
'engine_url' => 'https://www.nch.com.au/ivm/plugins.html',
);
/* htmlyse */
$knownTools['htmlyse'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
'tool_title' => '',
'tool_url' => '',
'engine_title' => 'htmlyse',
'engine_url' => 'https://www.htmlyse.com/',
);
/* Mr.4x3 Powered */
$knownTools['mr.4x3 powered'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
'tool_title' => 'Mr.4x3 Powered',
'tool_url' => '',
'engine_title' => 'CrushUs.com',
'engine_url' => 'https://crushus.com',
);
/* return list */
return $knownTools;
}
@@ -0,0 +1,45 @@
<?php
/**
* @brief Digiciel client devices specific methods
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Digiciel.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 Digiciel client device information from a known list.
* @param mixed $deviceCode
* @return array
*/
function get_DigicielClientDevice($deviceCode='') {
$deviceList = array(
'DL750' => array('platform_year' => 2014),
);
/* Check for returning list */
if ($deviceCode === false)
return $deviceList;
/* Initialise result. */
$result = array(
'platform_company' => 'Digiciel',
'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 Meizu client devices specific methods
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Meizu.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 Meizu client device information from a known list.
* @param mixed $deviceCode
* @return array
*/
function get_MeizuClientDevice($deviceCode='') {
$deviceList = array(
'MZ-PRO 6' => array('platform_model' => 'Pro 6', 'platform_year' => 2016),
);
/* Check for returning list */
if ($deviceCode === false)
return $deviceList;
/* Initialise result. */
$result = array(
'platform_company' => 'Meizu',
'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,9 +4,9 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Sony.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.7
* @version 1.0.8
* @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.
@@ -48,6 +48,7 @@ function get_SonyClientDevice($deviceCode='') {
'G3121' => array('platform_model' => 'Xperia XA1', 'platform_year' => 2017),
'G8141' => array('platform_model' => 'Xperia XZ Premium', 'platform_year' => 2017),
'H3311' => array('platform_model' => 'Xperia L2', 'platform_year' => 2018),
'H4113' => array('platform_model' => 'Xperia XA2', 'platform_year' => 2018),
'SOV31' => array('platform_model' => 'Xperia Z4', 'platform_year' => 2015),
'SOV32' => array('platform_model' => 'Xperia Z5', 'platform_year' => 2015),
@@ -0,0 +1,45 @@
<?php
/**
* @brief Symphony client devices specific methods
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Symphony.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 Symphony client device information from a known list.
* @param mixed $deviceCode
* @return array
*/
function get_SymphonyClientDevice($deviceCode='') {
$deviceList = array(
'i10' => array('platform_year' => 2017),
);
/* Check for returning list */
if ($deviceCode === false)
return $deviceList;
/* Initialise result. */
$result = array(
'platform_company' => 'Symphony',
'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,9 +4,9 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Xiaomi.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.4
* @version 1.0.5
* @date Creation: May 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.
@@ -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 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),
'redmi 4x' => array('platform_model' => 'Redmi 4X', 'platform_year' => 2017),

0 comments on commit 98f6198

Please sign in to comment.