mirror of
https://github.com/humhub/humhub.git
synced 2025-06-02 12:15:00 +02:00
Revert "Fix DeviceDetectorHelper when no user agent (#7365)"
This reverts commit d0b0803a
This commit is contained in:
parent
4ec293a61f
commit
b2fbfca9c4
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,16 +1,6 @@
|
||||
HumHub Changelog
|
||||
================
|
||||
|
||||
1.17.0-beta.5 (Unreleased)
|
||||
---------------------------------
|
||||
- Fix #7365: `DeviceDetectorHelper::isMobile()` and `DeviceDetectorHelper::isTablet()` when no user agent
|
||||
1.18 (TBA)
|
||||
------------------------------
|
||||
- Enh #7328: `Mailer`, `User` and `Cache` configs removed from `dynamic.php`
|
||||
- Enh #7332: Optimized `DynamicConfig` to store and read database information only
|
||||
- Enh #7338: Remove `horImageScrollOnMobile` config option
|
||||
- Enh #7367: Changed Auto Debug Mode Detection
|
||||
|
||||
|
||||
1.17.0-beta.4 (December 24, 2024)
|
||||
---------------------------------
|
||||
|
@ -42,7 +42,7 @@ $logTargetConfig = [
|
||||
|
||||
$config = [
|
||||
'name' => 'HumHub',
|
||||
'version' => '1.17.0-beta.5',
|
||||
'version' => '1.17.0-beta.4',
|
||||
'minRecommendedPhpVersion' => '8.1',
|
||||
'minSupportedPhpVersion' => '8.1',
|
||||
'basePath' => dirname(__DIR__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR,
|
||||
|
@ -20,8 +20,11 @@ class DeviceDetectorHelper
|
||||
{
|
||||
public static function isMobile(): bool
|
||||
{
|
||||
$detect = new MobileDetect();
|
||||
$detect->setUserAgent(Yii::$app->request->getUserAgent());
|
||||
|
||||
try {
|
||||
return (bool)static::getMobileDetect()?->isMobile();
|
||||
return $detect->isMobile();
|
||||
} catch (MobileDetectException $e) {
|
||||
Yii::error('DeviceDetectorHelper::isMobile() error: ' . $e->getMessage());
|
||||
return false;
|
||||
@ -30,26 +33,17 @@ class DeviceDetectorHelper
|
||||
|
||||
public static function isTablet(): bool
|
||||
{
|
||||
$detect = new MobileDetect();
|
||||
$detect->setUserAgent(Yii::$app->request->getUserAgent());
|
||||
|
||||
try {
|
||||
return (bool)static::getMobileDetect()?->isTablet();
|
||||
return $detect->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
|
||||
|
Loading…
x
Reference in New Issue
Block a user