From 21eb8e585f88ea8306f9a093ff7a59bbffe1b9be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Oct 2024 20:48:37 +0200 Subject: [PATCH] Fix detection of text browser with w3m --- htdocs/core/lib/functions.lib.php | 6 +++++- htdocs/main.inc.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 360cbb05edf..0961223b02e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -603,8 +603,12 @@ function getBrowserInfo($user_agent) $version = end($reg); } elseif (preg_match('/l[iy]n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { // MS products at end - $name = 'lynxlinks'; + $name = 'textbrowser'; $version = empty($reg[3]) ? '' : $reg[3]; + } elseif (preg_match('/w3m\/([\d\.]+)/i', $user_agent, $reg)) { + // MS products at end + $name = 'textbrowser'; + $version = empty($reg[1]) ? '' : $reg[1]; } if ($tablet) { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 7a8f3cebb37..737053673f0 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -510,7 +510,7 @@ if (GETPOST('theme', 'aZ09')) { } // Set global MAIN_OPTIMIZEFORTEXTBROWSER (must be before login part) -if (GETPOSTINT('textbrowser') || (!empty($conf->browser->name) && $conf->browser->name == 'lynxlinks')) { // If we must enable text browser +if (GETPOSTINT('textbrowser') || (!empty($conf->browser->name) && $conf->browser->name == 'textbrowser')) { // If we must enable text browser $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 2; }