| [ Index ] |
PHP Cross Reference of MantisBT |
[Summary view] [Print] [Text view]
1 <?php 2 # MantisBT - A PHP based bugtracking system 3 4 # MantisBT is free software: you can redistribute it and/or modify 5 # it under the terms of the GNU General Public License as published by 6 # the Free Software Foundation, either version 2 of the License, or 7 # (at your option) any later version. 8 # 9 # MantisBT is distributed in the hope that it will be useful, 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # GNU General Public License for more details. 13 # 14 # You should have received a copy of the GNU General Public License 15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * @package MantisBT 19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 20 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net 21 * @link http://www.mantisbt.org 22 * 23 * @uses core.php 24 * @uses access_api.php 25 * @uses authentication_api.php 26 * @uses columns_api.php 27 * @uses config_api.php 28 * @uses constant_inc.php 29 * @uses current_user_api.php 30 * @uses form_api.php 31 * @uses gpc_api.php 32 * @uses html_api.php 33 * @uses lang_api.php 34 * @uses print_api.php 35 * @uses project_api.php 36 */ 37 38 /** 39 * MantisBT Core API's 40 */ 41 require_once ( 'core.php' ); 42 require_api( 'access_api.php' ); 43 require_api( 'authentication_api.php' ); 44 require_api( 'columns_api.php' ); 45 require_api( 'config_api.php' ); 46 require_api( 'constant_inc.php' ); 47 require_api( 'current_user_api.php' ); 48 require_api( 'form_api.php' ); 49 require_api( 'gpc_api.php' ); 50 require_api( 'html_api.php' ); 51 require_api( 'lang_api.php' ); 52 require_api( 'print_api.php' ); 53 require_api( 'project_api.php' ); 54 55 form_security_validate( 'manage_config_columns_set' ); 56 57 # @@@ access_ensure_project_level( config_get( 'manage_project_threshold' ) ); 58 59 $f_project_id = gpc_get_int( 'project_id' ); 60 $f_view_issues_columns = gpc_get_string( 'view_issues_columns' ); 61 $f_print_issues_columns = gpc_get_string( 'print_issues_columns' ); 62 $f_csv_columns = gpc_get_string( 'csv_columns' ); 63 $f_excel_columns = gpc_get_string( 'excel_columns' ); 64 $f_update_columns_for_current_project = gpc_get_bool( 'update_columns_for_current_project' ); 65 $f_update_columns_as_my_default = gpc_get_bool( 'update_columns_as_my_default' ); 66 $f_update_columns_as_global_default = gpc_get_bool( 'update_columns_as_global_default' ); 67 $f_form_page = gpc_get_string( 'form_page' ); 68 69 # only admins can set global defaults.for ALL_PROJECT 70 if ( $f_update_columns_as_global_default && $f_project_id == ALL_PROJECTS && !current_user_is_administrator() ) { 71 access_denied(); 72 } 73 74 # only MANAGERS can set global defaults.for a project 75 if ( $f_update_columns_as_global_default && $f_project_id != ALL_PROJECTS ) { 76 access_ensure_project_level( MANAGER, $f_project_id ); 77 } 78 79 # user should only be able to set columns for a project that is accessible. 80 if ( $f_update_columns_for_current_project && $f_project_id != ALL_PROJECTS ) { 81 access_ensure_project_level( VIEWER, $f_project_id ); 82 } 83 84 if ( $f_update_columns_as_my_default || $f_update_columns_as_global_default ) { 85 $t_project_id = ALL_PROJECTS; 86 } else { 87 $t_project_id = $f_project_id; 88 project_ensure_exists( $t_project_id ); 89 } 90 91 # Calculate the user id to set the configuration for. 92 if ( $f_update_columns_as_my_default || $f_update_columns_for_current_project ) { 93 $t_user_id = auth_get_current_user_id(); 94 } else { 95 $t_user_id = NO_USER; 96 } 97 98 $t_all_columns = columns_get_all(); 99 100 $t_view_issues_columns = columns_string_to_array( $f_view_issues_columns ); 101 columns_ensure_valid( 'view_issues', $t_view_issues_columns, $t_all_columns ); 102 103 $t_print_issues_columns = columns_string_to_array( $f_print_issues_columns ); 104 columns_ensure_valid( 'print_issues', $t_print_issues_columns, $t_all_columns ); 105 106 $t_csv_columns = columns_string_to_array( $f_csv_columns ); 107 columns_ensure_valid( 'csv', $t_csv_columns, $t_all_columns ); 108 109 $t_excel_columns = columns_string_to_array( $f_excel_columns ); 110 columns_ensure_valid( 'excel', $t_excel_columns, $t_all_columns ); 111 112 if ( serialize( config_get( 'view_issues_page_columns', '', $t_user_id, $t_project_id ) ) !== serialize( $t_view_issues_columns ) ) { 113 config_set( 'view_issues_page_columns', $t_view_issues_columns, $t_user_id, $t_project_id ); 114 } 115 if ( serialize( config_get( 'print_issues_page_columns', '', $t_user_id, $t_project_id ) ) !== serialize( $t_print_issues_columns ) ) { 116 config_set( 'print_issues_page_columns', $t_print_issues_columns, $t_user_id, $t_project_id ); 117 } 118 if ( serialize( config_get( 'csv_columns', '', $t_user_id, $t_project_id ) ) !== serialize( $t_csv_columns ) ) { 119 config_set( 'csv_columns', $t_csv_columns, $t_user_id, $t_project_id ); 120 } 121 if ( serialize( config_get( 'excel_columns', '', $t_user_id, $t_project_id ) ) !== serialize( $t_excel_columns ) ) { 122 config_set( 'excel_columns', $t_excel_columns, $t_user_id, $t_project_id ); 123 } 124 125 form_security_purge( 'manage_config_columns_set' ); 126 ?> 127 <br /> 128 <div> 129 <?php 130 $t_redirect_url = $f_form_page === 'account' ? 'account_manage_columns_page.php' : 'manage_config_columns_page.php'; 131 html_page_top( null, $t_redirect_url ); 132 echo '<br />'; 133 echo lang_get( 'operation_successful' ) . '<br />'; 134 print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); 135 ?> 136 </div> 137 138 <?php 139 html_page_bottom();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |