Permalink
Browse files

Updates User Agent detection.

  • Loading branch information...
JB Lebrun
JB Lebrun committed Mar 19, 2018
1 parent 74e9698 commit 4cbd34a3a7adad190bdd77b557153b28600fe362
Showing with 37 additions and 2 deletions.
  1. +37 −2 engine/lib/tool/client.php.inc
@@ -465,6 +465,7 @@ function client_getUAInfos($ua=false) {
'SM-J510G' => array('platform_model' => 'Galaxy J5 (2016)', ),
'SM-J510M' => array('platform_model' => 'Galaxy J5 (2016)', ),
'SM-J510Y' => array('platform_model' => 'Galaxy J5 (2016)', ),
'SM-J530F' => array('platform_model' => 'Galaxy J5 (2017)', ),
'SM-G610F' => array('platform_model' => 'Galaxy J7 (2016)', ),
'SM-J710F' => array('platform_model' => 'Galaxy J7 (2016)', ),
'SM-J710MN' => array('platform_model' => 'Galaxy J7 (2016)', ),
@@ -780,6 +781,18 @@ function client_getUAInfos($ua=false) {
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
elseif (preg_match('/(P01MA) Build/', $ua, $matches)) {
$rep = array(
'P01MA' => array('platform_model' => 'Zen Pad 8', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
);
$model = trim($matches[1]);
$infos = array_merge($infos, array(
'platform_company'=>'Asus',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
elseif (preg_match('/ASUS_([A-Z0-9]+) /', $ua, $matches)) {
$rep = array(
'Z00ED' => array('platform_model' => 'Zenfon 2'),
@@ -1203,13 +1216,13 @@ function client_getUAInfos($ua=false) {
}
/* check Xiaomi mobiles */
elseif (preg_match('/MI ?([A-Za-z0-9]{1,} )Build/', $ua, $matches)) {
elseif (preg_match('/MI ?([A-Za-z0-9]{1,} )Build/i', $ua, $matches)) {
$rep = array(
'PAD'=>array('platform_model' => 'MI PAD', 'platform_type'=>'tablet', 'platform_format'=>'tablet'),
);
$infos = array_merge($infos, array(
'platform_company'=>'Xiaomi',
'platform_model'=>'MI '.$matches[1],
'platform_model'=>'Mi '.$matches[1],
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$matches[1]])?$rep[$matches[1]]:array());
@@ -1450,6 +1463,19 @@ function client_getUAInfos($ua=false) {
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
/* check Caterpillar mobiles */
elseif (preg_match('/(S60) Build/', $ua, $matches)) {
$rep = array(
);
$model = trim($matches[1]);
$infos = array_merge($infos, array(
'platform_company'=>'Caterpillar CAT',
'platform_model'=>$model,
'platform_type'=>'handheld',
'platform_format'=>'handheld'),
isset($rep[$model])?$rep[$model]:array());
}
/*** check operating system ***/
@@ -5542,6 +5568,15 @@ function client_getKnownTools() {
'tool_url'=>'http://babelfish.yahoo.com',
'engine_title'=>'Yahoo',
'engine_url'=>'http://www.yahoo.com');
/* Yahoo Link Preview */
$knownTools['yahoo link preview'] = array(
'platform_type'=>'tool',
'platform_format'=>'desktop',
'tool_title'=>'Yahoo Link Preview',
'tool_url'=>'https://help.yahoo.com/kb/mail/yahoo-link-preview-SLN23615.html',
'engine_title'=>'Yahoo',
'engine_url'=>'http://www.yahoo.com');
/* facebook external hit */
$knownTools['facebookexternalhit'] = array(

0 comments on commit 4cbd34a

Please sign in to comment.