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 * Update Custom Field Configuration
19 *
20 * @package MantisBT
21 * @copyright Copyright 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
22 * @copyright Copyright 2002  MantisBT Team - mantisbt-dev@lists.sourceforge.net
23 * @link http://www.mantisbt.org
24 *
25 * @uses core.php
26 * @uses access_api.php
27 * @uses authentication_api.php
28 * @uses config_api.php
29 * @uses custom_field_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 */
36
37require_once( 'core.php' );
38require_api( 'access_api.php' );
39require_api( 'authentication_api.php' );
40require_api( 'config_api.php' );
41require_api( 'custom_field_api.php' );
42require_api( 'form_api.php' );
43require_api( 'gpc_api.php' );
44require_api( 'html_api.php' );
45require_api( 'lang_api.php' );
46require_api( 'print_api.php' );
47
48form_security_validate( 'manage_custom_field_update' );
49
50auth_reauthenticate();
51access_ensure_global_level( config_get( 'manage_custom_fields_threshold' ) );
52
53$f_field_id						= gpc_get_int( 'field_id' );
54$f_return						= strip_tags( gpc_get_string( 'return', 'manage_custom_field_page.php' ) );
55$t_values['name']				= gpc_get_string( 'name' );
56$t_values['type']				= gpc_get_int( 'type' );
57$t_values['possible_values']	= gpc_get_string( 'possible_values' );
58$t_values['default_value']		= gpc_get_string( 'default_value' );
59$t_values['valid_regexp']		= gpc_get_string( 'valid_regexp' );
60$t_values['access_level_r']		= gpc_get_int( 'access_level_r' );
61$t_values['access_level_rw']	= gpc_get_int( 'access_level_rw' );
62$t_values['length_min']			= gpc_get_int( 'length_min' );
63$t_values['length_max']			= gpc_get_int( 'length_max' );
64$t_values['display_report']		= gpc_get_bool( 'display_report' );
65$t_values['display_update']		= gpc_get_bool( 'display_update' );
66$t_values['display_resolved']	= gpc_get_bool( 'display_resolved' );
67$t_values['display_closed']		= gpc_get_bool( 'display_closed' );
68$t_values['require_report']		= gpc_get_bool( 'require_report' );
69$t_values['require_update']		= gpc_get_bool( 'require_update' );
70$t_values['require_resolved']	= gpc_get_bool( 'require_resolved' );
71$t_values['require_closed']		= gpc_get_bool( 'require_closed' );
72$t_values['filter_by']			= gpc_get_bool( 'filter_by' );
73
74$t_def = custom_field_get_definition( $f_field_id );
75if( $t_def['type'] != $t_values['type'] && custom_field_has_data( $f_field_id ) ) {
76	helper_ensure_confirmed(
77		sprintf( lang_get( 'warning_update_custom_field_type' ),
78			string_attribute( $t_def['name'] )
79		),
80		lang_get( 'update' )
81	);
82}
83
84custom_field_update( $f_field_id, $t_values );
85
86form_security_purge( 'manage_custom_field_update' );
87
88layout_page_header( null, $f_return );
89
90layout_page_begin( 'manage_overview_page.php' );
91
92html_operation_successful( $f_return );
93
94layout_page_end();
95