[ACP] Added showing user device type in online info (#772)

This commit is contained in:
Roman Kelesidis 2023-06-05 15:28:59 +07:00 committed by GitHub
commit a8eec778df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 119 additions and 26 deletions

View file

@ -2058,3 +2058,25 @@ function user_birthday_icon($user_birthday, $user_id): string
return ($bb_cfg['birthday_enabled'] && $current_date == $user_birthday) ? '<img src="' . $images['icon_birthday'] . '" alt="" title="' . $lang['HAPPY_BIRTHDAY'] . '" border="0" />' : '';
}
/**
* Get user device type (PC, Tablet, Phone) by USER_AGENT
*
* @param string $user_agent
* @return string
*/
function get_user_device($user_agent = USER_AGENT): string
{
global $lang;
$detect = new \Detection\MobileDetect();
$detect->setUserAgent($user_agent);
if ($detect->isMobile()) {
return $lang['DEVICE_MOBILE'];
} else if ($detect->isTablet()) {
return $lang['DEVICE_TABLET'];
} else {
return $lang['DEVICE_PC'];
}
}