| [ 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 print_api.php 33 */ 34 35 /** 36 * MantisBT Core API's 37 */ 38 require_once ( 'core.php' ); 39 require_api( 'access_api.php' ); 40 require_api( 'authentication_api.php' ); 41 require_api( 'columns_api.php' ); 42 require_api( 'config_api.php' ); 43 require_api( 'constant_inc.php' ); 44 require_api( 'current_user_api.php' ); 45 require_api( 'form_api.php' ); 46 require_api( 'gpc_api.php' ); 47 require_api( 'print_api.php' ); 48 49 form_security_validate( 'manage_columns_copy' ); 50 51 auth_reauthenticate(); 52 53 $f_project_id = gpc_get_int( 'project_id' ); 54 $f_other_project_id = gpc_get_int( 'other_project_id' ); 55 $f_copy_from = gpc_get_bool( 'copy_from' ); 56 $f_copy_to = gpc_get_bool( 'copy_to' ); 57 $f_manage_page = gpc_get_bool( 'manage_page' ); 58 59 if ( $f_copy_from ) { 60 $t_src_project_id = $f_other_project_id; 61 $t_dst_project_id = $f_project_id; 62 } else if ( $f_copy_to ) { 63 $t_src_project_id = $f_project_id; 64 $t_dst_project_id = $f_other_project_id; 65 } else { 66 trigger_error( ERROR_GENERIC, ERROR ); 67 } 68 69 # only admins can set global defaults.for ALL_PROJECT 70 if ( $f_manage_page && $t_dst_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_manage_page && $t_dst_project_id != ALL_PROJECTS ) { 76 access_ensure_project_level( MANAGER, $t_dst_project_id ); 77 } 78 79 # user should only be able to set columns for a project that is accessible. 80 if ( $t_dst_project_id != ALL_PROJECTS ) { 81 access_ensure_project_level( VIEWER, $t_dst_project_id ); 82 } 83 84 # Calculate the user id to set the configuration for. 85 if ( $f_manage_page ) { 86 $t_user_id = NO_USER; 87 } else { 88 $t_user_id = auth_get_current_user_id(); 89 } 90 91 $t_all_columns = columns_get_all(); 92 $t_default = null; 93 94 $t_view_issues_page_columns = config_get( 'view_issues_page_columns', $t_default, $t_user_id, $t_src_project_id ); 95 $t_view_issues_page_columns = columns_remove_invalid( $t_view_issues_page_columns, $t_all_columns ); 96 97 $t_print_issues_page_columns = config_get( 'print_issues_page_columns', $t_default, $t_user_id, $t_src_project_id ); 98 $t_print_issues_page_columns = columns_remove_invalid( $t_print_issues_page_columns, $t_all_columns ); 99 100 $t_csv_columns = config_get( 'csv_columns', $t_default, $t_user_id, $t_src_project_id ); 101 $t_csv_columns = columns_remove_invalid( $t_csv_columns, $t_all_columns ); 102 103 $t_excel_columns = config_get( 'excel_columns', $t_default, $t_user_id, $t_src_project_id ); 104 $t_excel_columns = columns_remove_invalid( $t_excel_columns, $t_all_columns ); 105 106 config_set( 'view_issues_page_columns', $t_view_issues_page_columns, $t_user_id, $t_dst_project_id ); 107 config_set( 'print_issues_page_columns', $t_print_issues_page_columns, $t_user_id, $t_dst_project_id ); 108 config_set( 'csv_columns', $t_csv_columns, $t_user_id, $t_dst_project_id ); 109 config_set( 'excel_columns', $t_excel_columns, $t_user_id, $t_dst_project_id ); 110 111 form_security_purge( 'manage_columns_copy' ); 112 113 $t_redirect_url = $f_manage_page ? 'manage_config_columns_page.php' : 'account_manage_columns_page.php'; 114 print_header_redirect( $t_redirect_url );
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 |