Merge branch 'develop' into next

This commit is contained in:
Lucas Bartholemy 2025-01-06 16:06:58 +01:00
commit 8f83a6f91d
4 changed files with 23 additions and 9 deletions

View File

@ -7,6 +7,10 @@ HumHub Changelog
- Enh #7332: Optimized `DynamicConfig` to store and read database information only
- Enh #7338: Remove `horImageScrollOnMobile` config option
1.17.0-beta.5 (Unreleased)
---------------------------------
- Fix #7365: `DeviceDetectorHelper::isMobile()` and `DeviceDetectorHelper::isTablet()` when no user agent
1.17.0-beta.4 (December 24, 2024)
---------------------------------
- Enh #7307: Improve request scheme detection

View File

@ -42,7 +42,7 @@ $logTargetConfig = [
$config = [
'name' => 'HumHub',
'version' => '1.17.0-beta.4',
'version' => '1.17.0-beta.5',
'minRecommendedPhpVersion' => '8.1',
'minSupportedPhpVersion' => '8.1',
'basePath' => dirname(__DIR__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR,

View File

@ -20,11 +20,8 @@ class DeviceDetectorHelper
{
public static function isMobile(): bool
{
$detect = new MobileDetect();
$detect->setUserAgent(Yii::$app->request->getUserAgent());
try {
return $detect->isMobile();
return (bool)static::getMobileDetect()?->isMobile();
} catch (MobileDetectException $e) {
Yii::error('DeviceDetectorHelper::isMobile() error: ' . $e->getMessage());
return false;
@ -33,17 +30,26 @@ class DeviceDetectorHelper
public static function isTablet(): bool
{
$detect = new MobileDetect();
$detect->setUserAgent(Yii::$app->request->getUserAgent());
try {
return $detect->isTablet();
return (bool)static::getMobileDetect()?->isTablet();
} catch (MobileDetectException $e) {
Yii::error('DeviceDetectorHelper::isTablet() error: ' . $e->getMessage());
return false;
}
}
private static function getMobileDetect(): ?MobileDetect
{
$userAgent = Yii::$app->request->getUserAgent();
if (!$userAgent) {
return null;
}
$detect = new MobileDetect();
$detect->setUserAgent($userAgent);
return $detect;
}
public static function isAppRequest(): bool
{
return

View File

@ -41,6 +41,10 @@ use yii\log\Logger;
$labelClass = 'label-warning';
$levelName = Yii::t('AdminModule.information', 'Warning');
break;
case Logger::LEVEL_TRACE:
$labelClass = 'label-default';
$levelName = Yii::t('AdminModule.information', 'Trace');
break;
case Logger::LEVEL_ERROR:
default:
$labelClass = 'label-danger';