? adm_config_edit.php
Index: adm_config_report.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/adm_config_report.php,v
retrieving revision 1.9
diff -u -r1.9 adm_config_report.php
--- adm_config_report.php	1 Apr 2007 06:30:24 -0000	1.9
+++ adm_config_report.php	8 Aug 2007 22:30:48 -0000
@@ -126,6 +126,7 @@
 				<?php
 					if ( config_can_delete( $v_config_id ) ) {
 						print_button( 'adm_config_delete.php?user_id=' . $v_user_id . '&amp;project_id=' . $v_project_id . '&amp;config_option=' . $v_config_id, lang_get( 'delete_link' ) );
+						print_button( 'adm_config_edit.php?user_id=' . $v_user_id . '&amp;project_id=' . $v_project_id . '&amp;config_option=' . $v_config_id, lang_get( 'edit_link' ) );
 					} else {
 						echo '&nbsp;';
 					}
Index: core/config_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/config_api.php,v
retrieving revision 1.39
diff -u -r1.39 config_api.php
--- core/config_api.php	25 Jul 2007 23:39:44 -0000	1.39
+++ core/config_api.php	8 Aug 2007 22:45:04 -0000
@@ -148,6 +148,95 @@
 			return $p_default;
 		}
 	}
+	
+	# ------------------
+	# Retrieves the type of a config value
+	function config_get_type( $p_option, $p_user = null, $p_project = null )
+	{
+		global $g_cache_config, $g_cache_config_access, $g_cache_db_table_exists, $g_cache_filled;
+
+		# bypass table lookup for certain options
+		$t_bypass_lookup = !config_can_set_in_database( $p_option );
+
+		if ( ! $t_bypass_lookup ) {
+			$t_config_table = config_get_global( 'mantis_config_table' );
+			if ( ! $g_cache_db_table_exists ) {
+				$g_cache_db_table_exists = ( TRUE === db_is_connected() ) &&
+					db_table_exists( $t_config_table );
+			}
+
+			if ( $g_cache_db_table_exists ) {
+
+				# prepare the user's list
+				$t_users = array();
+				if ( null === $p_user ) {
+					$t_users[] = auth_is_user_authenticated() ? auth_get_current_user_id() : ALL_USERS;
+				} else {
+					$t_users[] = $p_user;
+				}
+				if ( ! in_array( ALL_USERS, $t_users ) ) {
+					$t_users[] = ALL_USERS;
+				}
+
+				# prepare the projects list
+				$t_projects = array();
+				if ( ( null === $p_project )  ) {
+					$t_projects[] = auth_is_user_authenticated() ? helper_get_current_project() : ALL_PROJECTS;
+				} else {
+					$t_projects[] = $p_project;
+				}
+				if ( ! in_array( ALL_PROJECTS, $t_projects ) ) {
+					$t_projects[] = ALL_PROJECTS;
+				}
+				
+				if ( ! $g_cache_filled ) {
+					
+					$query = "SELECT config_id, user_id, project_id, type, value, access_reqd FROM $t_config_table";
+					$result = db_query( $query );
+					while ( false <> ( $row = db_fetch_array( $result ) ) ) {
+						$t_config = $row['config_id'];
+						$t_user = $row['user_id'];
+						$t_project = $row['project_id'];
+						$g_cache_config[$t_config][$t_user][$t_project] = $row['type'] . ';' . $row['value'];
+						$g_cache_config_access[$t_config][$t_user][$t_project] = $row['access_reqd'];
+					}
+					$g_cache_filled = true;
+				}
+
+				if( isset( $g_cache_config[$p_option] ) ) {
+				    $t_found = false;
+				    reset( $t_users );
+				    while ( ( list( , $t_user ) = each( $t_users ) ) && ! $t_found ) {
+					   reset( $t_projects );
+					   while ( ( list( , $t_project ) = each( $t_projects ) ) && ! $t_found ) {
+					       if ( isset( $g_cache_config[$p_option][$t_user][$t_project] ) ) {
+    							$t_value = $g_cache_config[$p_option][$t_user][$t_project];
+    							$t_found = true;
+    						}
+    					}
+    				}
+				
+    				if ( $t_found ) {
+    					list( $t_type, $t_raw_value ) = explode( ';', $t_value, 2 );
+
+    					switch ( $t_type ) {
+    						case CONFIG_TYPE_INT:
+    							$t_value = (int) $t_raw_value;
+    							break;
+    						case CONFIG_TYPE_COMPLEX:
+    							$t_value = unserialize( $t_raw_value );
+    							break;
+    						case CONFIG_TYPE_STRING:
+    						default:
+    							$t_value = config_eval( $t_raw_value );
+    					}
+    					return $t_type;
+    				}
+    			}
+			}
+		}
+		return CONFIG_TYPE_STRING;
+	}
 
 	# ------------------
 	# Retrieves the access level needed to change a config value
