diff --git a/adm_config_report.php b/adm_config_report.php index 3843c8de1c..e2a1f3b347 100644 --- a/adm_config_report.php +++ b/adm_config_report.php @@ -91,7 +91,9 @@ function print_config_value_as_string( $p_type, $p_value ) { return; case CONFIG_TYPE_STRING: $t_value = config_eval( $p_value ); - echo string_nl2br( string_html_specialchars( $t_value ) ); + echo '

'; + echo string_nl2br( string_html_specialchars( "'$t_value'" ) ); + echo '

'; return; case CONFIG_TYPE_COMPLEX: $t_value = @unserialize( $p_value ); @@ -104,10 +106,9 @@ function print_config_value_as_string( $p_type, $p_value ) { break; } - echo '
';
+	echo '
';
 
 	if ( $t_corrupted ) {
-		echo lang_get( 'configuration_corrupted' );
 	} else {
 		if ( function_exists( 'var_export' ) ) {
 			var_export( $t_value );
@@ -119,39 +120,231 @@ function print_config_value_as_string( $p_type, $p_value ) {
 	echo '
'; } -$t_config_table = db_get_table( 'config' ); -$query = "SELECT config_id, user_id, project_id, type, value, access_reqd FROM $t_config_table ORDER BY user_id, project_id, config_id"; +function print_option_list_from_array( $p_array, $p_filter_value ) { + foreach( $p_array as $t_key => $t_value ) { + echo "\n"; + } +} + +# Get filter values +$t_filter_save = gpc_get_bool( 'save' ); +$t_filter_default = gpc_get_bool( 'default_filter_button', false ); +$t_filter_reset = gpc_get_bool( 'reset_filter_button', false ); +if( $t_filter_default ) { + $t_filter_user_value = ALL_USERS; + $t_filter_project_value = ALL_PROJECTS; + $t_filter_config_value = META_FILTER_NONE; +} else if( $t_filter_reset ) { + $t_filter_user_value = META_FILTER_NONE; + $t_filter_project_value = META_FILTER_NONE; + $t_filter_config_value = META_FILTER_NONE; +} else { + $t_filter_user_value = gpc_get_int( 'filter_user_id', ALL_USERS ); + $t_filter_project_value = gpc_get_int( 'filter_project_id', ALL_PROJECTS ); + $t_filter_config_value = gpc_get_string( 'filter_config_id', META_FILTER_NONE ); +} + +# Manage filter's persistency through cookie +$t_cookie_name = config_get( 'manage_config_cookie' ); +if( $t_filter_save ) { + # Save user's filter to the cookie + $t_cookie_string = implode( + ':', + array( + $t_filter_user_value, + $t_filter_project_value, + $t_filter_config_value, + ) + ); + gpc_set_cookie( $t_cookie_name, $t_cookie_string, true ); +} else { + # Retrieve the filter from the cookie if it exists + $t_cookie_string = gpc_get_cookie( $t_cookie_name, null ); + if( null !== $t_cookie_string ) { + $t_cookie_contents = explode( ':', $t_cookie_string ); + + $t_filter_user_value = $t_cookie_contents[0]; + $t_filter_project_value = $t_cookie_contents[1]; + $t_filter_config_value = $t_cookie_contents[2]; + + if( $t_filter_project_value != META_FILTER_NONE && project_exists( $t_filter_project_value ) ) { + $t_filter_project_value = ALL_PROJECTS; + } + } +} + +# Apply filters +$t_config_table = db_get_table( 'config' ); +$t_project_table = db_get_table( 'project' ); + +# Get users in db having specific configs +$query = "SELECT DISTINCT user_id + FROM $t_config_table + WHERE user_id <> " . db_param() ; +$t_result = db_query_bound( $query, array( ALL_USERS ) ); +if( $t_filter_user_value != META_FILTER_NONE && $t_filter_user_value != ALL_USERS ) { + # Make sure the filter value exists in the list + $t_users_list[$t_filter_user_value] = user_get_name( $t_filter_user_value ); +} else { + $t_users_list = array(); +} +while ( $row = db_fetch_array( $t_result ) ) { + $t_user_id = $row['user_id']; + $t_users_list[$t_user_id] = user_get_name( $t_user_id ); +} +asort( $t_users_list ); +# Prepend '[any]' and 'All Users' to the list +$t_users_list = array( + META_FILTER_NONE => '[' . lang_get( 'any' ) . ']', + ALL_USERS => lang_get( 'all_users' ), + ) + + $t_users_list; + +# Get projects in db with specific configs +$query = "SELECT DISTINCT project_id, pt.name as project_name + FROM $t_config_table as ct + JOIN $t_project_table as pt ON pt.id = ct.project_id + WHERE project_id!=0 + ORDER BY project_name"; +$t_result = db_query_bound( $query ); +$t_projects_list[META_FILTER_NONE] = '[' . lang_get( 'any' ) . ']'; +$t_projects_list[ALL_PROJECTS] = lang_get( 'all_projects' ); +while ( $row = db_fetch_array( $t_result ) ) { + extract( $row, EXTR_PREFIX_ALL, 'v' ); + $t_projects_list[$v_project_id] = $v_project_name; +} + +# Get config list used in db +$query = "SELECT DISTINCT config_id + FROM $t_config_table + ORDER BY config_id"; +$t_result = db_query_bound( $query ); +$t_configs_list[META_FILTER_NONE] = '[' . lang_get( 'any' ) . ']'; +if( $t_filter_config_value != META_FILTER_NONE ) { + # Make sure the filter value exists in the list + $t_configs_list[$t_filter_config_value] = $t_filter_config_value; +} +while ( $row = db_fetch_array( $t_result ) ) { + extract( $row, EXTR_PREFIX_ALL, 'v' ); + $t_configs_list[$v_config_id] = $v_config_id; +} + +# Build filter's where clause +$t_where = ''; +if( $t_filter_user_value != META_FILTER_NONE ) { + $t_where .= " AND user_id = $t_filter_user_value "; +} +if( $t_filter_project_value != META_FILTER_NONE ) { + $t_where .= " AND project_id = $t_filter_project_value "; +} +if( $t_filter_config_value != META_FILTER_NONE ) { + $t_where .= " AND config_id = '$t_filter_config_value' "; +} +if( $t_where != '' ) { + $t_where = " WHERE 1=1 " . $t_where; +} + +$query = "SELECT config_id, user_id, project_id, type, value, access_reqd + FROM $t_config_table + $t_where + ORDER BY user_id, project_id, config_id "; $result = db_query_bound( $query ); ?> -
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ :
+
+ :
+
+ :
+
+ + + + + +
+ + + +
+
+
+ +
+

- + +
- - + + - - - + + + - + - > - width="100%"> + - + - - - + + + -
+
+
-
+
+ -
+
+ +
@@ -180,6 +377,8 @@ function print_config_value_as_string( $p_type, $p_value ) {
+ +
@@ -190,11 +389,15 @@ function print_config_value_as_string( $p_type, $p_value ) {
+ +
+ +
@@ -207,11 +410,17 @@ function print_config_value_as_string( $p_type, $p_value ) {
+ +
- + + +
+ +
diff --git a/config_defaults_inc.php b/config_defaults_inc.php index 1f733c6352..f233dd4389 100644 --- a/config_defaults_inc.php +++ b/config_defaults_inc.php @@ -3068,28 +3068,36 @@ *****************************/ /** - * --- cookie path --------------- - * set this to something more restrictive if needed - * http://www.php.net/manual/en/function.setcookie.php + * Specifies the path under which a cookie is visible + * All scripts in this directory and its sub-directories will be able + * to access MantisBT cookies. + * It is recommended to set this to the actual MantisBT path. + * @link http://php.net/function.setcookie * @global string $g_cookie_path */ $g_cookie_path = '/'; /** - * + * The domain that the MantisBT cookies are available to * @global string $g_cookie_domain */ $g_cookie_domain = ''; /** - * cookie version for view_all_page + * Version of the view_all_page cookie + * It is not expected for the user to need to change this setting + * @see $g_view_all_cookie * @global string $g_cookie_version */ $g_cookie_version = 'v8'; /** - * --- cookie prefix --------------- - * set this to a unique identifier. No spaces or periods. + * Prefix for all MantisBT cookies + * This should be an identifier which does not include spaces or periods, + * and should be unique per MantisBT installation, especially if + * $g_cookie_path is not restricting the cookies' scope to the actual + * MantisBT directory. + * @see $g_cookie_path * @global string $g_cookie_prefix */ $g_cookie_prefix = 'MANTIS'; @@ -3113,10 +3121,16 @@ $g_view_all_cookie = '%cookie_prefix%_VIEW_ALL_COOKIE'; /** - * - * @global string $g_manage_cookie + * Stores the filter criteria for the Manage User page + * @global string $g_manage_users_cookie + */ +$g_manage_users_cookie = '%cookie_prefix%_MANAGE_USERS_COOKIE'; + +/** + * Stores the filter criteria for the Manage Config Report page + * @global string $g_manage_config_cookie */ -$g_manage_cookie = '%cookie_prefix%_MANAGE_COOKIE'; +$g_manage_config_cookie = '%cookie_prefix%_MANAGE_CONFIG_COOKIE'; /** * @@ -4144,8 +4158,9 @@ 'anonymous_account', 'compress_html', 'content_expire', 'allow_permanent_cookie', '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', 'crypto_master_salt', - 'custom_headers', 'database_name', 'db_username', 'db_password', 'db_schema', 'db_type', + 'manage_config_cookie', 'manage_user_cookie', 'logout_cookie', + 'bug_list_cookie', 'crypto_master_salt', 'custom_headers', + 'database_name', 'db_username', 'db_password', 'db_schema', 'db_type', 'db_table_prefix','db_table_suffix', 'display_errors', 'form_security_validation', 'hostname','html_valid_tags', 'html_valid_tags_single_line', 'default_language', 'language_auto_map', 'fallback_language', 'login_method', 'plugins_enabled', 'session_handler', diff --git a/core/helper_api.php b/core/helper_api.php index 7358865aec..676595ca27 100644 --- a/core/helper_api.php +++ b/core/helper_api.php @@ -413,7 +413,8 @@ function helper_set_current_project( $p_project_id ) { */ function helper_clear_pref_cookies() { gpc_clear_cookie( config_get( 'project_cookie' ) ); - gpc_clear_cookie( config_get( 'manage_cookie' ) ); + gpc_clear_cookie( config_get( 'manage_users_cookie' ) ); + gpc_clear_cookie( config_get( 'manage_config_cookie' ) ); } /** diff --git a/core/obsolete.php b/core/obsolete.php index 296f4dbb95..64469c58a6 100644 --- a/core/obsolete.php +++ b/core/obsolete.php @@ -143,6 +143,9 @@ config_obsolete( 'show_attachment_indicator' ); config_obsolete( 'default_avatar', '' ); +# changes in 1.2.13 +config_obsolete( 'manage_cookie', 'manage_users_cookie' ); + # changes in 1.3.0dev config_obsolete( 'bugnote_allow_user_edit_delete', '' ); config_obsolete( 'password_confirm_hash_magic_string', 'crypto_master_salt' ); diff --git a/css/default.css b/css/default.css index 1ba4844946..a85592b9ad 100644 --- a/css/default.css +++ b/css/default.css @@ -454,7 +454,16 @@ div#account-profile-update-div { width: 65%; } div#adm-config-div { - width: 95%; + max-width: 95%; + display: table; +} +p#adm-config-value { + max-width: 400px; + word-wrap: break-word; +} +pre#adm-config-value { + max-width: 400px; + overflow: auto } div#project-delete-div { text-align: center; diff --git a/docbook/Admin_Guide/en-US/Configuration.xml b/docbook/Admin_Guide/en-US/Configuration.xml index 10db86f191..a3828bfdcb 100644 --- a/docbook/Admin_Guide/en-US/Configuration.xml +++ b/docbook/Admin_Guide/en-US/Configuration.xml @@ -2595,38 +2595,38 @@
Cookies - The configuration variables $g_string_cookie, - $g_project_cookie, $g_view_all_cookie, $g_manage_cookie are - calculated based on $g_cookie_prefix. When you change the cookie - prefix in config_inc.php, you need to follow it with a copy of the - four lines that calculate the names for these cookies. - $g_cookie_path - This is specifies to the path under which a cookie is - visible. All scripts in this directory and its sub-directories will - be able to access MantisBT cookies. Default value is '/'. It is - recommended to set this to the actual MantisBT path. + Specifies the path under which a cookie is visible. + + All scripts in this directory and its sub-directories + will be able to access MantisBT cookies. + + Default value is '/'. + It is recommended to set this to the actual MantisBT path. $g_cookie_domain - Unused + The domain that the MantisBT cookies are available to. $g_cookie_version - Cookie version is used as a prefix for cookies that should - be expire when the code is changed in a certain way. The developers - would increase this version when necessary, which in effect will - cause the creation of new cookies that are compatible with the new - code. It is not expected for the user to need to change this + Version of the view_all_page cookie. + This is used as a prefix for cookies that should + be expired when the code is changed in a certain way. + The developers would increase this version when necessary, + which in effect will cause the creation of new cookies + that are compatible with the new code. + + It is not expected for the user to need to change this setting. @@ -2634,12 +2634,48 @@ $g_cookie_prefix - This should be set to a unique identifier which does not - include spaces or periods. Again, this should be unique per - MantisBT installation, especially if $g_cookie_path is not - restricting the cookies scope to the actual MantisBT - directory. + Prefix for all MantisBT cookies + This should be an identifier which does not include + spaces or periods, and should be unique per MantisBT + installation, especially if $g_cookie_path is not + restricting the cookies' scope to the actual + MantisBT directory. + It applies to the cookies listed below. Their actual + names are calculated by prepending the prefix, and + it is not expected for the user to need to change these. + + + + + $g_string_cookie + + + $g_project_cookie + + + $g_view_all_cookie + + + $g_manage_users_cookie + Stores the filter criteria for the + Manage Users page + + + + $g_manage_config_cookie + Stores the filter criteria for the + Manage Config Report page + + + + $g_logout_cookie + + + $g_bug_list_cookie + + + diff --git a/lang/strings_english.txt b/lang/strings_english.txt index 4d7c448072..a442f3ec1a 100644 --- a/lang/strings_english.txt +++ b/lang/strings_english.txt @@ -660,6 +660,7 @@ If you requested this verification, visit the following URL to change your passw # manage_page.php 'hide_disabled' => 'Hide Disabled', 'filter_button' => 'Apply Filter', + 'default_filter' => 'Default Filter', 'create_filter_link' => 'Create Permalink', 'create_short_link' => 'Create Short Link', 'filter_permalink' => 'Following is a permanent link to the currently configured filter:', @@ -1350,7 +1351,7 @@ If you requested this verification, visit the following URL to change your passw 'delete_attachment_button' => 'Delete', 'delete_attachment_sure_msg' => 'Are you sure you wish to delete this attachment?', 'upload_issue_attachments' => 'Upload issue attachments', - 'filters' => 'filters', + 'filters' => 'Filters', 'save_filters' => 'Save filters', 'save_filters_as_shared' => 'Save filters as shared', 'use_saved_filters' => 'Use saved filters', diff --git a/manage_user_page.php b/manage_user_page.php index 8d8cec105a..9c6366e1ea 100644 --- a/manage_user_page.php +++ b/manage_user_page.php @@ -67,7 +67,7 @@ $f_page_number = gpc_get_int( 'page_number', 1 ); $t_user_table = db_get_table( 'user' ); -$t_cookie_name = config_get( 'manage_cookie' ); +$t_cookie_name = config_get( 'manage_users_cookie' ); $t_lock_image = '' . lang_get( 'protected' ) . ''; $c_filter = '';