Permalink
Browse files

Updates user agent detection in client library.

  • Loading branch information...
JB Lebrun
JB Lebrun committed Oct 4, 2018
1 parent 40c50f1 commit 2d971271c18513a870ae54e476d4d896a8e409f9
@@ -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.36
* @version 1.0.37
* @date Creation: Jun 2007
* @date Modification: Sep 2018
* @date Modification: Oct 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.
@@ -251,6 +251,13 @@ function client_getUAInfos($ua=false) {
));
}
/* check for device model */
if (preg_match('/(iPhone|iPod|iPad)([0-9_\,]{3,})/i', $ua, $matches)) {
include_once('clientDevices/Apple.php.inc');
$model = $matches[1].str_replace(array('_', ','), '.', $matches[2]);
$infos = array_merge($infos, get_AppleClientDevice($model));
}
} elseif (preg_match('/(iPhone|iPod|iPad)\/([0-9\.]*) hw\/(iPhone|iPod|iPad)([0-9_]{3,})/i', $ua, $matches)) {
/* check version */
$version = str_replace('_', '.', $matches[2]);
@@ -266,7 +273,8 @@ function client_getUAInfos($ua=false) {
'system_version' => $version,
));
include_once('clientDevices/Apple.php.inc');
$infos = array_merge($infos, get_AppleClientDevice($matches[3].$matches[4]));
$model = $matches[3].str_replace(array('_', ','), '.', $matches[4]);
$infos = array_merge($infos, get_AppleClientDevice($model));
} elseif (preg_match('/(iPod|iPhone|iPad)/', $ua, $matches)) {
$infos = array_merge($infos, array(
@@ -535,37 +543,6 @@ function client_getUAInfos($ua=false) {
'platform_year' => 2015,
));
/* check Macintosh */
elseif (preg_match('/(?:Intel |PPC |)Mac OS X( Mach-O| [0-9\._]*|)/i', $ua, $matches)) {
/* check version */
$version = ($matches[1]!=' Mach-O')?substr(str_replace('_','.',$matches[1]), 1):'';
if (version_compare($version, $maxVersions['system']['Mac OS X']) > 0)
return $fake;
/* build info */
$infos = array_merge($infos, array(
'platform_company' => 'Apple',
'platform_model' => 'Macintosh',
'platform_type' => 'computer',
'platform_format' => 'desktop',
'system_title' => version_compare ($version, '10.12') >= 0 ? 'macOS' : 'Mac OS X',
'system_version' => $version
));
}
/* check Classic Macintosh */
elseif (preg_match('/Mac_PowerPC|Macintosh/i', $ua, $matches)) {
/* build info */
$infos = array_merge($infos, array(
'platform_company' => 'Apple',
'platform_model' => 'Macintosh',
'platform_type' => 'computer',
'platform_format' => 'desktop',
'system_title' => 'Mac OS Classic',
'system_version' => '',
));
}
/* 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)) {
$model = trim(strtolower($matches[1].(isset($matches[2])?$matches[2]:'')));
@@ -1250,6 +1227,51 @@ function client_getUAInfos($ua=false) {
);
}
/* check Haiku (before macintosh) */
elseif (preg_match('/Haiku( |\/)(R[0-9])/i', $ua, $matches)) {
/* build info */
$infos = array_merge($infos, array(
'platform_company' => 'PC',
'platform_model' => '',
'platform_type' => 'computer',
'platform_format' => 'desktop',
'system_title' => 'Haiku',
'system_version' => $matches[2],
));
}
/* check Macintosh */
elseif (preg_match('/(?:Intel |PPC |)Mac OS X( Mach-O| [0-9\._]*|)/i', $ua, $matches)) {
/* check version */
$version = ($matches[1]!=' Mach-O')?substr(str_replace('_','.',$matches[1]), 1):'';
if (version_compare($version, $maxVersions['system']['Mac OS X']) > 0)
return $fake;
/* build info */
$infos = array_merge($infos, array(
'platform_company' => 'Apple',
'platform_model' => 'Macintosh',
'platform_type' => 'computer',
'platform_format' => 'desktop',
'system_title' => version_compare ($version, '10.12') >= 0 ? 'macOS' : 'Mac OS X',
'system_version' => $version
));
}
/* check Classic Macintosh */
elseif (preg_match('/Mac_PowerPC|Macintosh/i', $ua, $matches)) {
/* build info */
$infos = array_merge($infos, array(
'platform_company' => 'Apple',
'platform_model' => 'Macintosh',
'platform_type' => 'computer',
'platform_format' => 'desktop',
'system_title' => 'Mac OS Classic',
'system_version' => '',
));
}
/* check determined linux os */
elseif (preg_match('/(Debian|Ubuntu|DragonFly|SUSE|Slackware|CentOS|Fedora|Kubuntu|Edubuntu|Xubuntu|Gentoo|Red Hat|Mint|Mandriva|CrOS|Arch ?Linux|Caldera Systems OpenLinux|Sailfish)/', $ua, $matches)) {
$rep = array(
@@ -1427,7 +1449,7 @@ 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|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|Kinza)\/([a-z0-9\._]*)?/i', $ua, $matches)) {
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|Kinza|WebPositive)\/([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],
@@ -2199,8 +2221,8 @@ function _client_mergeUAInfos($req, $infos) {
function _client_getUAPropertiesMaxVersions() {
return array(
'system' => array(
'Mac OS X' => '10.15.0', // current is 10.13.x
'iOS' => '14', // current is 12.x (beta)
'Mac OS X' => '10.16.0', // current is 10.14.x
'iOS' => '14', // current is 12.x
'Android' => '11', // current is 9.x.x
),
'browser' => array(
@@ -2209,8 +2231,8 @@ function _client_getUAPropertiesMaxVersions() {
'Chromium' => '72', // current is 69
'Internet Explorer' => '11.0.50', // latest
'Edge' => '45', // current is 40
'Opera' => '58', // current is 55
'Safari' => '15', // current is 12 (beta)
'Opera' => '59', // current is 56
'Safari' => '15', // current is 12
),
);
}
@@ -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.15
* @version 1.0.16
* @date Creation: May 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.
@@ -31,7 +31,7 @@ function _client_getKnownBots() {
'engine_url' => 'http://www.ideogram-design.fr/',
);
/* import.io crawler bot (to be inserted before GoogleBot, use GoogleBot in user agent) */
/* import.io crawler bot (to be inserted before GoogleBot, use GoogleBot in user agent) */
$knownBots['googlebot/2.1; +http://import.io'] = array(
'platform_type' => 'bot',
'platform_format' => 'desktop',
@@ -3984,6 +3984,16 @@ function _client_getKnownBots() {
'engine_url' => 'http://www.qirina.com/',
);
/* spuhex.com bot */
$knownBots['spuhex.com'] = array(
'platform_type' => 'bot',
'platform_format' => 'desktop',
'bot_title' => '',
'bot_url' => '',
'engine_title' => 'spuhex',
'engine_url' => 'http://spuhex.com/',
);
/* unknown bots */
/* SEOBulls - unknown bot */
@@ -4256,6 +4266,26 @@ function _client_getKnownBots() {
'engine_url' => '',
);
/* WordupinfoSearch - unknown bot */
$knownBots['wordupinfosearch'] = array(
'platform_type' => 'bot',
'platform_format' => 'desktop',
'bot_title' => 'WordupinfoSearch (Unknown bot)',
'bot_url' => '',
'engine_title' => '',
'engine_url' => '',
);
/* Who.is Bot - unknown bot */
$knownBots['who.is bot'] = array(
'platform_type' => 'bot',
'platform_format' => 'desktop',
'bot_title' => 'Who.is Bot (Unknown bot)',
'bot_url' => '',
'engine_title' => '',
'engine_url' => '',
);
/* return bot list */
return $knownBots;
}
@@ -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.6
* @version 1.0.7
* @date Creation: May 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.
@@ -1021,7 +1021,7 @@ function _client_getKnownTools() {
'engine_url' => 'http://magpierss.sf.net',
);
/* Re-re Studio */
/* Re-re Studio */
$knownTools['re-re studio'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
@@ -1031,7 +1031,7 @@ function _client_getKnownTools() {
'engine_url' => 'http://re-re.ru/',
);
/* InetURL */
/* InetURL */
$knownTools['ineturl'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
@@ -1041,7 +1041,7 @@ function _client_getKnownTools() {
'engine_url' => 'https://www.nch.com.au/ivm/plugins.html',
);
/* htmlyse */
/* htmlyse */
$knownTools['htmlyse'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
@@ -1051,7 +1051,7 @@ function _client_getKnownTools() {
'engine_url' => 'https://www.htmlyse.com/',
);
/* Mr.4x3 Powered */
/* Mr.4x3 Powered */
$knownTools['mr.4x3 powered'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
@@ -1061,7 +1061,7 @@ function _client_getKnownTools() {
'engine_url' => 'https://crushus.com',
);
/* Goose */
/* Goose */
$knownTools['goose'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
@@ -1071,6 +1071,16 @@ function _client_getKnownTools() {
'engine_url' => 'https://pypi.org/project/goose3/',
);
/* Slackbot-LinkExpanding */
$knownTools['slackbot-linkexpanding'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
'tool_title' => 'Slackbot-LinkExpanding',
'tool_url' => 'https://api.slack.com/robots',
'engine_title' => 'Slack',
'engine_url' => 'https://slack.com/',
);
/* return list */
return $knownTools;
}
Oops, something went wrong.

0 comments on commit 2d97127

Please sign in to comment.