1
0
mirror of https://github.com/phpmyadmin/phpmyadmin.git synced 2026-10-23 18:29:15 +03:00

Fix Uncaught ReferenceError: CodeMirror is not defined

Signed-off-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>
This commit is contained in:
Liviu-Mihail Concioiu
2026-09-03 22:22:35 +02:00
parent cae0175274
commit 3b46e5b869
6 changed files with 12 additions and 6 deletions

View File

@@ -35,7 +35,8 @@ class Text_Plain_JsonEditor extends CodeMirrorEditorTransformationPlugin
public function getScripts()
{
$scripts = [];
if ($GLOBALS['cfg']['CodemirrorEnable']) {
// See #20159, why we need to check for HTTP_USER_AGENT here
if ($GLOBALS['cfg']['CodemirrorEnable'] && isset($_SERVER['HTTP_USER_AGENT'])) {
$scripts[] = 'vendor/codemirror/lib/codemirror.js';
$scripts[] = 'vendor/codemirror/mode/javascript/javascript.js';
$scripts[] = 'transformations/json_editor.js';

View File

@@ -35,7 +35,8 @@ class Text_Plain_SqlEditor extends CodeMirrorEditorTransformationPlugin
public function getScripts()
{
$scripts = [];
if ($GLOBALS['cfg']['CodemirrorEnable']) {
// See #20159, why we need to check for HTTP_USER_AGENT here
if ($GLOBALS['cfg']['CodemirrorEnable'] && isset($_SERVER['HTTP_USER_AGENT'])) {
$scripts[] = 'vendor/codemirror/lib/codemirror.js';
$scripts[] = 'vendor/codemirror/mode/sql/sql.js';
$scripts[] = 'transformations/sql_editor.js';

View File

@@ -35,7 +35,8 @@ class Text_Plain_XmlEditor extends CodeMirrorEditorTransformationPlugin
public function getScripts()
{
$scripts = [];
if ($GLOBALS['cfg']['CodemirrorEnable']) {
// See #20159, why we need to check for HTTP_USER_AGENT here
if ($GLOBALS['cfg']['CodemirrorEnable'] && isset($_SERVER['HTTP_USER_AGENT'])) {
$scripts[] = 'vendor/codemirror/lib/codemirror.js';
$scripts[] = 'vendor/codemirror/mode/xml/xml.js';
$scripts[] = 'transformations/xml_editor.js';

View File

@@ -21,7 +21,8 @@ class Text_Plain_Json extends TransformationsPlugin
{
public function __construct()
{
if (empty($GLOBALS['cfg']['CodemirrorEnable'])) {
// See #20159, why we need to check for HTTP_USER_AGENT here
if (empty($GLOBALS['cfg']['CodemirrorEnable']) || ! isset($_SERVER['HTTP_USER_AGENT'])) {
return;
}

View File

@@ -17,7 +17,8 @@ class Text_Plain_Sql extends SQLTransformationsPlugin
{
public function __construct()
{
if (empty($GLOBALS['cfg']['CodemirrorEnable'])) {
// See #20159, why we need to check for HTTP_USER_AGENT here
if (empty($GLOBALS['cfg']['CodemirrorEnable']) || ! isset($_SERVER['HTTP_USER_AGENT'])) {
return;
}

View File

@@ -21,7 +21,8 @@ class Text_Plain_Xml extends TransformationsPlugin
{
public function __construct()
{
if (empty($GLOBALS['cfg']['CodemirrorEnable'])) {
// See #20159, why we need to check for HTTP_USER_AGENT here
if (empty($GLOBALS['cfg']['CodemirrorEnable']) || ! isset($_SERVER['HTTP_USER_AGENT'])) {
return;
}