From 68c0eb85059cfe102650910e5690ff902881690d Mon Sep 17 00:00:00 2001 From: camer0n Date: Sat, 26 Apr 2025 07:39:54 -0700 Subject: [PATCH] Issue #5481 Added pref for displaying debug navigation button in admin area. --- e107_admin/prefs.php | 8 ++++++++ e107_admin/update_routines.php | 12 ++++++++++-- e107_core/shortcodes/batch/admin_shortcodes.php | 17 +++++++++++------ e107_core/xml/default_install.xml | 1 + e107_languages/English/admin/lan_prefs.php | 1 + 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/e107_admin/prefs.php b/e107_admin/prefs.php index 010197c19..e2b115b0d 100644 --- a/e107_admin/prefs.php +++ b/e107_admin/prefs.php @@ -759,6 +759,14 @@ $text .= " + + + + ".$e_userclass->uc_dropdown('admin_navbar_debug', $pref['admin_navbar_debug'], 'nobody,main,admin,classes,no-excludes', "tabindex='".$frm->getNext()."'")." + + + + diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index fb15289d7..dfd402fc2 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -464,18 +464,26 @@ function update_core_prefs($type='') $should = get_default_prefs(); $just_check = !($type == 'do'); // TRUE if we're just seeing if an update is needed - + + $missing = []; + foreach ($should as $k => $v) { if ($k && !array_key_exists($k,$pref)) { - if ($just_check) return update_needed('Missing pref: '.$k); + $missing[] = $k; // $pref[$k] = $v; e107::getConfig()->set($k,$v); $admin_log->logMessage($k.' => '.$v, E_MESSAGE_NODISPLAY, E_MESSAGE_INFO); $do_save = TRUE; } } + + if ($just_check && !empty($missing)) + { + return update_needed('
Missing prefs: '); + } + if ($do_save) { //save_prefs(); diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index 959fc9d34..0dab30706 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -931,14 +931,19 @@ class admin_shortcodes extends e_shortcode */ public function sc_admin_debug() { - if(!deftrue('e_DEVELOPER') && !deftrue('e_DEBUG') && !deftrue('e_DEBUGGER')) // e_DEBUGGER can be defined in e107_config.php to enable - { - return null; - } + $display = (int) e107::pref('core', 'admin_navbar_debug', e_UC_NOBODY); - if(!getperms('0')) + if(!check_class($display)) { - return null; + if(!deftrue('e_DEVELOPER') && !deftrue('e_DEBUG') && !deftrue('e_DEBUGGER')) // e_DEBUGGER can be defined in e107_config.php to enable + { + return null; + } + + if(!getperms('0')) + { + return null; + } } try diff --git a/e107_core/xml/default_install.xml b/e107_core/xml/default_install.xml index e3072e825..8e439250a 100644 --- a/e107_core/xml/default_install.xml +++ b/e107_core/xml/default_install.xml @@ -6,6 +6,7 @@ 0 0 0 + 255 1 0 css/modern-light.css diff --git a/e107_languages/English/admin/lan_prefs.php b/e107_languages/English/admin/lan_prefs.php index e50eebb26..b1cbf55cb 100644 --- a/e107_languages/English/admin/lan_prefs.php +++ b/e107_languages/English/admin/lan_prefs.php @@ -265,4 +265,5 @@ return [ 'PRFLAN_284' => "Collapse navigation side-bar by default", 'PRFLAN_285' => "Display field help tips", 'PRFLAN_286' => "Content Filters", + 'PRFLAN_287' => "Display debug button in admin area navigation bar", ];