Permalink
Browse files

Updates User Agent detection in client library.

  • Loading branch information...
JB Lebrun
JB Lebrun committed Aug 28, 2018
1 parent 1f4615b commit 11e6462c2c908ffe1540d555eb9abbaf321ac72e
@@ -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.29
* @version 1.0.30
* @date Creation: Jun 2007
* @date Modification: Jul 2018
* @date Modification: Aug 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.
@@ -173,6 +173,10 @@ function client_getUAInfos($ua=false) {
'browser_title' => 'BB Browser',
'browser_version' => '--',
));
if (preg_match('/ (BB[A-Z][0-9\-]*) Build/', $ua, $matches)) {
include_once ('clientDevices/BlackBerry.php.inc');
$infos = array_merge($infos, get_BlackBerryClientDevice($matches[1]));
}
/* check Nokia - before iPhone */
elseif (preg_match('/RX-51 N900/', $ua, $matches))
@@ -275,56 +279,28 @@ function client_getUAInfos($ua=false) {
}
/* check Google */
elseif (preg_match('/(Nexus( [^ \/;]+)?|Pixel) Build/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company' => 'Google',
'platform_model' => $matches[1],
'platform_type' => 'handheld',
'platform_format' => 'handheld',
));
elseif (preg_match('/ (Nexus|Pixel)( [^ \/;]+)? Build/', $ua, $matches)) {
include_once('clientDevices/Google.php.inc');
$model = $matches[1].(isset($matches[2])?$matches[2]:'');
$infos = array_merge($infos, get_GoogleClientDevice($model));
}
/* check HTC */
elseif (preg_match('/HTC;([A-Za-z0-9 ]*)/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company' => 'HTC',
'platform_model' => $matches[1],
'platform_type' => 'handheld',
'platform_format' => 'handheld',));
elseif (preg_match('/HTC[ |_]([^\/\-]*)( Build|\-)/', $ua, $matches)) {
$rep = array(
'M8Sx' => array('platform_model' => 'One', ),
'IncredibleS' => array('platform_model' => 'Incredible S'),
'D820u' => array('platform_model' => 'Desire 820 Dual SIM'),
'8088;' => array('platform_model' => 'One Max', 'platform_year' => 2013),
);
elseif (preg_match('/HTC;([A-Za-z0-9 ]*)/', $ua, $matches)) {
include_once('clientDevices/HTC.php.inc');
$infos = array_merge($infos, get_HTCClientDevice($matches[1]));
} elseif (preg_match('/HTC[ |_]([^\/\-]*)( Build|\-)/', $ua, $matches)) {
include_once('clientDevices/HTC.php.inc');
$model = preg_replace('/_/', ' ', $matches[1]);
$infos = array_merge($infos, array(
'platform_company' => 'HTC',
'platform_model' => $model,
'platform_type' => 'handheld',
'platform_format' => 'handheld'
),
isset($rep[$matches[1]])?$rep[$matches[1]]:array()
);
$infos = array_merge($infos, get_HTCClientDevice($model));
} elseif (preg_match('/HTC([A-Za-z0-9]+)/', $ua, $matches)) {
$rep = array(
'T329t' => array('platform_model' => 'Proto', 'browser_title' => 'Android browser',),
);
include_once('clientDevices/HTC.php.inc');
$model = preg_replace('/_/', ' ', $matches[1]);
$infos = array_merge($infos, array(
'platform_company' => 'HTC',
'platform_model' => $model,
'platform_type' => 'handheld',
'platform_format' => 'handheld'
),
isset($rep[$matches[1]])?$rep[$matches[1]]:array()
);
} elseif (preg_match('/2PYB2/', $ua, $matches))
$infos = array_merge($infos, array(
'platform_company' => 'HTC',
'platform_model' => 'Bolt',
'platform_type' => 'handheld',
'platform_format' => 'handheld',));
$infos = array_merge($infos, get_HTCClientDevice($model));
} elseif (preg_match('/2PYB2/', $ua, $matches)) {
include_once('clientDevices/HTC.php.inc');
$infos = array_merge($infos, get_HTCClientDevice($matches[1]));
}
/* check LG */
elseif (preg_match('/^LG(?:E|)(?: |_|\-|\/)([^ _\-\/]+)/', $ua, $matches))
@@ -397,8 +373,7 @@ function client_getUAInfos($ua=false) {
));
/* check OnePlus - to be inserted before Sony */
elseif (preg_match('/( ONE| ONEPLUS)? (A|E)([0-9]{4}) Build/i', $ua, $matches)) {
include_once ('clientDevices/OnePlus.php.inc');
elseif (($matches = _client_isOnePlusDevice($ua)) !== false) {
$infos = array_merge($infos, get_OnePlusClientDevice($matches[2].$matches[3]));
}
@@ -974,7 +949,7 @@ function client_getUAInfos($ua=false) {
}
/* check Condor mobiles */
elseif (preg_match('/(PGN|PHQ|SP|PAM|PFS|TCV|TGW)?\-([0-9]{3}?G) Build/', $ua, $matches)) {
elseif (preg_match('/(PGN|PHQ|SP|PAM|PFS|TCV|TGW)?\-([0-9]{3}G?) Build/', $ua, $matches)) {
include_once('clientDevices/Condor.php.inc');
$infos = array_merge($infos, get_CondorClientDevice($matches[1].$matches[2]));
}
@@ -1200,11 +1175,17 @@ function client_getUAInfos($ua=false) {
$infos = array_merge($infos, get_EssentialClientDevice($matches[1]));
}
/* check Vernee mobiles */
elseif (preg_match('/(Apollo|Thor)?( [A-Za-z0-9]*) Build/', $ua, $matches)) {
include_once ('clientDevices/Vernee.php.inc');
$model = trim($matches[1].(isset($matches[2])?$matches[2]:''));
$infos = array_merge($infos, get_VerneeClientDevice($model));
/* check Essential mobiles */
elseif (preg_match('/ (PH-1) Build/', $ua, $matches)) {
include_once ('clientDevices/Essential.php.inc');
$infos = array_merge($infos, get_EssentialClientDevice($matches[1]));
}
/* check Kyocera mobiles */
elseif (preg_match('/ (KC-[A-Za-z0-9]*) Build/', $ua, $matches)) {
include_once ('clientDevices/Kyocera.php.inc');
$model = trim($matches[1]);
$infos = array_merge($infos, get_KyoceraClientDevice($model));
}
/*** check operating system ***/
@@ -1383,7 +1364,7 @@ function client_getUAInfos($ua=false) {
}
/* check unsmartly written browser, non case sensitive */
elseif (preg_match('/(Maxthon|Opera|webissimo|NintendoBrowser|Acoo ?Browser|Deepnet Explorer|Avant Browser|BrowseX|OffByOne|KKman|LBBROWSER|Maemo Browser|BIDUBrowser|UBrowser|Airmail|EmbeddedWB|DX-Browser|Links|Sputnik|Instagram|Microsoft Outlook)(?:\/| )?([a-z0-9\._]*)?/i', $ua, $matches)) {
elseif (preg_match('/(Maxthon|Opera|webissimo|NintendoBrowser|Acoo ?Browser|Deepnet Explorer|Avant Browser|BrowseX|OffByOne|KKman|LBBROWSER|Maemo Browser|BIDUBrowser|UBrowser|Airmail|EmbeddedWB|DX-Browser|Links|Sputnik|Instagram|Microsoft Outlook|Chromeless)(?:\/| )?([a-z0-9\._]*)?/i', $ua, $matches)) {
$rep = array('BIDUBrowser'=>'Baidu Brower', 'AcooBrowser' => 'Acoo Browser', 'EmbeddedWB'=>'Delphi Embedded Web Browser');
$infos = array_merge($infos, array(
'browser_title' => isset($rep[$matches[1]])?$rep[$matches[1]]:$matches[1],
@@ -2200,4 +2181,18 @@ function _client_getUAPropertiesMaxVersions() {
),
);
}
/**
* Check if given UA is a OnePlus device
* @return boolean result
* @private
*/
function _client_isOnePlusDevice($ua='') {
if (preg_match('/( ONE| ONEPLUS)? (A|E)([0-9]{4}) Build/i', $ua, $matches)) {
include_once('clientDevices/OnePlus.php.inc');
if (is_OnePlusKnownDevice($matches[2].$matches[3]))
return $matches;
}
return false;
}
?>
@@ -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.11
* @version 1.0.12
* @date Creation: May 2018
* @date Modification: Jul 2018
* @date Modification: Aug 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.
@@ -632,8 +632,8 @@ function _client_getKnownBots() {
$knownBots['mail.ru'] = array(
'platform_type' => 'bot',
'platform_format' => 'desktop',
'bot_title' => '',
'bot_url' => '',
'bot_title' => 'Mail.RU_Bot',
'bot_url' => 'http://go.mail.ru/help/robots',
'engine_title' => 'Mail.ru',
'engine_url' => 'http://www.mail.ru',
);
@@ -1548,6 +1548,16 @@ function _client_getKnownBots() {
'engine_url' => '',
);
/* YisouSpider Mobile */
$knownBots['mobile/14e5239e yisouspider'] = array(
'platform_type' => 'bot',
'platform_format' => 'handheld',
'bot_title' => 'YisouSpider',
'bot_url' => '',
'engine_title' => '',
'engine_url' => '',
);
/* DomainAppender */
$knownBots['domainappender'] = array(
'platform_type' => 'bot',
@@ -3409,9 +3419,9 @@ function _client_getKnownBots() {
'platform_type' => 'bot',
'platform_format' => 'desktop',
'bot_title' => 'DomainStatsBot',
'bot_url' => 'http://domainstats.io/our-bot',
'engine_title' => 'DomainStats.io',
'engine_url' => 'http://domainstats.io/',
'bot_url' => 'https://domainstats.com/pages/our-bot',
'engine_title' => 'DomainStats',
'engine_url' => 'https://domainstats.com/',
);
/* GroupHigh */
@@ -3914,6 +3924,16 @@ function _client_getKnownBots() {
'engine_url' => 'https://www.mappy.com',
);
/* Nimbostratus-Bot */
$knownBots['nimbostratus-bot'] = array(
'platform_type' => 'bot',
'platform_format' => 'desktop',
'bot_title' => 'Nimbostratus-Bot',
'bot_url' => '',
'engine_title' => 'Cloud System Networks',
'engine_url' => 'http://cloudsystemnetworks.com',
);
/* techleadzbot */
$knownBots['techleadzbot'] = array(
'platform_type' => 'bot',
@@ -3924,6 +3944,16 @@ function _client_getKnownBots() {
'engine_url' => 'https://wiredwith.com',
);
/* Yooo! */
$knownBots['yooo!'] = array(
'platform_type' => 'bot',
'platform_format' => 'desktop',
'bot_title' => 'Yooo! Search Engine Bot',
'bot_url' => 'http://yooo.nl/about.php',
'engine_title' => 'Yooo!',
'engine_url' => 'http://yooo.nl/',
);
/* unknown bots */
/* SEOBulls - unknown bot */
@@ -4176,6 +4206,16 @@ function _client_getKnownBots() {
'engine_url' => '',
);
/* dcrawl - unknown bot */
$knownBots['dcrawl'] = array(
'platform_type' => 'bot',
'platform_format' => 'desktop',
'bot_title' => 'dcrawl (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.3
* @version 1.0.4
* @date Creation: May 2018
* @date Modification: Jul 2018
* @date Modification: Aug 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.
@@ -35,10 +35,10 @@ function _client_getKnownTools() {
$knownTools['validator.nu/lv'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
'tool_title' => 'W3C Validator',
'tool_url' => 'http://validator.w3.org',
'tool_title' => 'validator.nu',
'tool_url' => 'http://validator.nu',
'engine_title' => 'World Wide Web Consortium',
'engine_url' => 'http://www.w3.org',
'engine_url' => 'http://validator.w3.org/services',
);
/* google translation */
@@ -91,6 +91,16 @@ function _client_getKnownTools() {
'engine_url' => 'http://www.google.com',
);
/* Google Google-Youtube-Links */
$knownTools['google-youtube-links'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
'tool_title' => 'Google-Youtube-Links',
'tool_url' => '',
'engine_title' => 'Google',
'engine_url' => 'http://www.google.com',
);
/* yahoo translation : babel fish */
$knownTools['babelfish.yahoo.com'] = array(
'platform_type' => 'tool',
@@ -981,7 +991,57 @@ function _client_getKnownTools() {
'engine_url' => 'https://www.vanheusden.com',
);
/* PocketParser */
$knownTools['pocketparser'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
'tool_title' => 'PocketParser',
'tool_url' => 'https://getpocket.com/pocketparser_ua',
'engine_title' => 'Pocket',
'engine_url' => 'https://getpocket.com',
);
/* DemandbasePublisherAnalyzer */
$knownTools['demandbasepublisheranalyzer'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
'tool_title' => 'DemandbasePublisherAnalyzer',
'tool_url' => '',
'engine_title' => 'DemandeBase',
'engine_url' => 'https://www.demandbase.com',
);
/* MagpieRSS */
$knownTools['magpierss'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
'tool_title' => '',
'tool_url' => '',
'engine_title' => 'MagpieRSS',
'engine_url' => 'http://magpierss.sf.net',
);
/* Re-re Studio */
$knownTools['re-re studio'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
'tool_title' => '',
'tool_url' => '',
'engine_title' => 'Re-re Studio',
'engine_url' => 'http://re-re.ru/',
);
/* InetURL */
$knownTools['ineturl'] = array(
'platform_type' => 'tool',
'platform_format' => 'desktop',
'tool_title' => 'InetURL',
'tool_url' => '',
'engine_title' => 'IVM',
'engine_url' => 'https://www.nch.com.au/ivm/plugins.html',
);
/* return list */
return $knownTools;
}
?>
?>
@@ -4,9 +4,9 @@
* @details Engine / Tool Library
* @file engine/lib/tool/clientDevices/Alcatel.php.inc
* @author CaMykS Team <camyks.contact@gmail.com>
* @version 1.0.
* @version 1.0.1
* @date Creation: Apr 2018
* @date Modification: May 2018
* @date Modification: Aug 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.
@@ -101,6 +101,7 @@ function get_AlcatelClientDevice($deviceCode='') {
'7047D' => array('platform_model' => 'OneTouch Pop C9', 'platform_year' => 2014),
'7048X' => array('platform_model' => 'OneTouch Go Play', 'platform_year' => 2015),
'7050Y' => array('platform_model' => 'OneTouch Pop S9', 'platform_year' => 2014),
'7070X' => array('platform_model' => 'Pop 4', 'platform_year' => 2016),
'8000D' => array('platform_model' => 'OneTouch Scribe', 'platform_year' => 2013),
'8008D' => array('platform_model' => 'OneTouch Scribe HD', 'platform_year' => 2013),
'8020D' => array('platform_model' => 'OneTouch Hero', 'platform_year' => 2013),
Oops, something went wrong.

0 comments on commit 11e6462

Please sign in to comment.