From 4f0ce3c3d55f46cff4f3a4080cb124a06f9c9b7c Mon Sep 17 00:00:00 2001 From: Roland Becker Date: Mon, 6 Sep 2010 12:57:41 +0200 Subject: [PATCH] Fix #12006: Mantis Graphs - Configuration - jpgraph library path not saved --- core/config_api.php | 27 +++++++++++++++++++++------ core/plugin_api.php | 6 +++--- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/core/config_api.php b/core/config_api.php index 1fc3f45..b1eae73 100644 --- a/core/config_api.php +++ b/core/config_api.php @@ -52,13 +52,17 @@ $g_cache_config_project = null; # if not found, config_id + default user + current project # if not found, config_id + default user + all_project. # 3.use GLOBAL[config_id] -function config_get( $p_option, $p_default = null, $p_user = null, $p_project = null ) { +function config_get( $p_option, $p_default = null, $p_user = null, $p_project = null, $p_config_can_set_in_database = false ) { global $g_cache_config, $g_cache_config_access, $g_cache_db_table_exists, $g_cache_filled; global $g_cache_config_user, $g_cache_config_project, $g_project_override; # @@ debug @@ echo "lu o=$p_option "; # bypass table lookup for certain options - $t_bypass_lookup = !config_can_set_in_database( $p_option ); + if ( $p_config_can_set_in_database ) { + $t_bypass_lookup = false; + } else { + $t_bypass_lookup = !config_can_set_in_database( $p_option ); + } # @@ debug @@ if ($t_bypass_lookup) { echo "bp=$p_option match=$t_match_pattern
"; } @@ -307,7 +311,7 @@ function config_is_set( $p_option, $p_user = null, $p_project = null ) { # ------------------ # Sets the value of the given config option to the given value # If the config option does not exist, an ERROR is triggered -function config_set( $p_option, $p_value, $p_user = NO_USER, $p_project = ALL_PROJECTS, $p_access = DEFAULT_ACCESS_LEVEL ) { +function config_set( $p_option, $p_value, $p_user = NO_USER, $p_project = ALL_PROJECTS, $p_access = DEFAULT_ACCESS_LEVEL, $p_config_can_set_in_database = false ) { if( $p_access == DEFAULT_ACCESS_LEVEL ) { $p_access = config_get_global( 'admin_site_threshold' ); } @@ -325,7 +329,13 @@ function config_set( $p_option, $p_value, $p_user = NO_USER, $p_project = ALL_PR $c_value = $p_value; } - if( config_can_set_in_database( $p_option ) ) { + if ( $p_config_can_set_in_database ) { + $t_bypass_lookup = false; + } else { + $t_bypass_lookup = !config_can_set_in_database( $p_option ); + } + + if( !$t_bypass_lookup ) { $c_option = $p_option; $c_user = db_prepare_int( $p_user ); $c_project = db_prepare_int( $p_project ); @@ -436,11 +446,16 @@ function config_can_delete( $p_option ) { # ------------------ # delete the config entry -function config_delete( $p_option, $p_user = ALL_USERS, $p_project = ALL_PROJECTS ) { +function config_delete( $p_option, $p_user = ALL_USERS, $p_project = ALL_PROJECTS, $p_config_can_set_in_database = false ) { global $g_cache_config, $g_cache_config_access; # bypass table lookup for certain options - $t_bypass_lookup = !config_can_set_in_database( $p_option ); + if ( $p_config_can_set_in_database ) { + $t_bypass_lookup = false; + } else { + $t_bypass_lookup = !config_can_set_in_database( $p_option ); + } + # @@ debug @@ if ($t_bypass_lookup) { echo "bp=$p_option match=$t_match_pattern
"; } # @@ debug @@ if ( ! db_is_connected() ) { echo "no db"; } diff --git a/core/plugin_api.php b/core/plugin_api.php index 5e75da4..94a1d05 100644 --- a/core/plugin_api.php +++ b/core/plugin_api.php @@ -165,7 +165,7 @@ function plugin_config_get( $p_option, $p_default = null, $p_global = false ) { if( $p_global ) { return config_get_global( $t_full_option, $p_default ); } else { - return config_get( $t_full_option, $p_default ); + return config_get( $t_full_option, $p_default, null, null, true ); } } @@ -185,7 +185,7 @@ function plugin_config_set( $p_option, $p_value, $p_user = NO_USER, $p_project = $t_basename = plugin_get_current(); $t_full_option = 'plugin_' . $t_basename . '_' . $p_option; - config_set( $t_full_option, $p_value, $p_user, $p_project, $p_access ); + config_set( $t_full_option, $p_value, $p_user, $p_project, $p_access, true ); } /** @@ -198,7 +198,7 @@ function plugin_config_delete( $p_option, $p_user = ALL_USERS, $p_project = ALL_ $t_basename = plugin_get_current(); $t_full_option = 'plugin_' . $t_basename . '_' . $p_option; - config_delete( $t_full_option, $p_user, $p_project ); + config_delete( $t_full_option, $p_user, $p_project, true ); } /** -- 1.7.2.2