Merge branch 'next' of github.com:humhub/humhub into next

# Conflicts:
#	protected/humhub/config/common.php
This commit is contained in:
gevorgmansuryan 2025-01-06 22:21:38 +04:00
commit 5cde648369
4 changed files with 23 additions and 9 deletions

View File

@ -8,6 +8,10 @@ HumHub Changelog
- Enh #7338: Remove `horImageScrollOnMobile` config option
- Enh #7361: Refactor application state mechanism
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

@ -44,7 +44,7 @@ $config = [
'name' => 'HumHub',
'language' => 'en-US',
'timeZone' => 'Europe/Berlin',
'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';