From dce7638ae05aee1a7b9e8e0ba8dbdf5d2ffa1a9c Mon Sep 17 00:00:00 2001
From: Roland Becker <roland@atrol.de>
Date: Thu, 8 Dec 2011 14:36:39 +0100
Subject: [PATCH] Fix #12006: Mantis Graphs - Configuration - jpgraph library path not saved

---
 config_defaults_inc.php |   20 ++++++++++++++------
 core/config_api.php     |    4 ++--
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/config_defaults_inc.php b/config_defaults_inc.php
index 163e1f5..d0550f8 100644
--- a/config_defaults_inc.php
+++ b/config_defaults_inc.php
@@ -3874,13 +3874,21 @@
 
 	/**
 	 * The following list of variables should never be in the database.
-	 * These patterns will be concatenated and used as a regular expression
-	 * to bypass the database lookup and look here for appropriate global settings.
+	 * It is usd to bypass the database lookup and look here for appropriate global settings.
 	 * @global array $g_global_settings
 	 */
+
 	$g_global_settings = array(
-		'_table$', 'cookie', '^db_', 'hostname', 'allow_signup', 'database_name', 'show_queries_', 'admin_checks', 'version_suffix', 'global_settings',
-		'_path$', 'use_iis', 'language', 'use_javascript', 'minimal_jscss', 'display_errors', 'show_detailed_errors', 'stop_on_errors', 'login_method', '_file$',
-		'anonymous', 'content_expire', 'html_valid_tags', 'custom_headers', 'rss_key_seed', 'plugins_enabled', 'session_', 'form_security_',
-		'compress_html', '_page$', '_url$',
+		'path', 'icon_path', 'short_path', 'absolute_path', 'core_path', 'class_path', 'absolute_path_default_upload_folder',
+		'ldap_simulation_file_path', 'cookie_path', 'plugin_path', 'db_table_prefix', 'db_table_suffix', 'db_table',
+		'cookie_time_length', 'cookie_path', 'cookie_domain', 'cookie_version', 'cookie_prefix', 'string_cookie', 'project_cookie',
+		'view_all_cookie', 'manage_cookie', 'logout_cookie', 'bug_list_cookie', 'db_username', 'db_password', 'db_schema', 'db_type',
+		'hostname', 'allow_signup', 'database_name', 'show_queries_count', 'show_queries_threshold', 'show_queries_list',
+		'admin_checks', 'version_suffix', 'global_settings','use_iis', 'default_language', 'language_choices_arr',
+		'language_auto_map', 'fallback_language', 'use_javascript', 'minimal_jscss', 'display_errors', 'show_detailed_errors',
+		'stop_on_errors', 'login_method', 'fileinfo_magic_db_file', 'css_include_file', 'css_rtl_include_file', 'meta_include_file', 
+		'allow_anonymous_login', 'anonymous_account', 'content_expire', 'html_valid_tags', 'html_valid_tags_single_line',
+		'custom_headers', 'rss_key_seed', 'plugins_enabled', 'session_handler', 'session_key', 'session_save_path',
+		'session_validation', 'form_security_validation', 'compress_html', 'bottom_include_page', 'top_include_page',
+		'default_home_page', 'logout_redirect_page', 'manual_url', 'logo_url', 'create_short_url', 'wiki_engine_url',
 	);
diff --git a/core/config_api.php b/core/config_api.php
index 9f363b4..239eab1 100644
--- a/core/config_api.php
+++ b/core/config_api.php
@@ -419,9 +419,9 @@ function config_can_set_in_database( $p_option ) {
 
 	# bypass table lookup for certain options
 	if( $g_cache_can_set_in_database == '' ) {
-		$g_cache_can_set_in_database = '/' . implode( '|', config_get_global( 'global_settings' ) ) . '/';
+		$g_cache_can_set_in_database = config_get_global( 'global_settings' );
 	}
-	$t_bypass_lookup = ( 0 < preg_match( $g_cache_can_set_in_database, $p_option ) );
+	$t_bypass_lookup = in_array( $p_option, $g_cache_can_set_in_database, true );
 
 	$g_cache_bypass_lookup[$p_option] = $t_bypass_lookup;
 
-- 
1.7.4.msysgit.0

