/
bug_report.php
155 lines (131 loc) · 5.43 KB
/
bug_report.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 - 2003 Mantis Team - mantisbt-dev@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
# --------------------------------------------------------
# $Id: bug_report.php,v 1.19 2003-02-15 10:25:16 jfitzell Exp $
# --------------------------------------------------------
?>
<?php
# This page stores the reported bug
?>
<?php
require_once( 'core.php' );
$t_core_path = config_get( 'core_path' );
require_once( $t_core_path.'string_api.php' );
require_once( $t_core_path.'file_api.php' );
require_once( $t_core_path.'bug_api.php' );
require_once( $t_core_path.'custom_field_api.php' );
?>
<?php
# this page is invalid for the 'All Project' selection
if ( 0 == helper_get_current_project() ) {
print_header_redirect( 'login_select_proj_page.php?ref=' . string_get_bug_report_url() );
}
access_ensure_project_level( config_get('report_bug_threshold' ) );
$f_build = gpc_get_string( 'build', '' );
$f_platform = gpc_get_string( 'platform', '' );
$f_os = gpc_get_string( 'os', '' );
$f_os_build = gpc_get_string( 'os_build', '' );
$f_product_version = gpc_get_string( 'product_version', '' );
$f_profile_id = gpc_get_int( 'profile_id', 0 );
$f_handler_id = gpc_get_int( 'handler_id', 0 );
$f_view_state = gpc_get_int( 'view_state', 0 );
$f_category = gpc_get_string( 'category', '' );
$f_reproducibility = gpc_get_int( 'reproducibility' );
$f_severity = gpc_get_int( 'severity' );
$f_priority = gpc_get_int( 'priority', NORMAL );
$f_summary = gpc_get_string( 'summary' );
$f_description = gpc_get_string( 'description' );
$f_steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', '' );
$f_additional_info = gpc_get_string( 'additional_info', '' );
$f_file = gpc_get_file( 'file', null );
$f_report_stay = gpc_get_bool( 'report_stay' );
$t_reporter_id = auth_get_current_user_id();
$t_project_id = helper_get_current_project();
$t_upload_method = config_get( 'file_upload_method' );
# If a file was uploaded, and we need to store it on disk, let's make
# sure that the file path for this project exists
if ( is_uploaded_file( $f_file['tmp_name'] ) &&
file_allow_bug_upload() &&
( DISK == $t_upload_method || FTP == $t_upload_method ) ) {
$t_file_path = project_get_field( $t_project_id, 'file_path' );
if ( !file_exists( $t_file_path ) ) {
trigger_error( ERROR_NO_DIRECTORY, ERROR );
}
}
# if a profile was selected then let's use that information
if ( 0 != $f_profile_id ) {
$row = user_get_profile_row( $t_reporter_id, $f_profile_id );
if ( is_blank( $f_platform ) ) {
$f_platform = $row['platform'];
}
if ( is_blank( $f_os ) ) {
$f_os = $row['os'];
}
if ( is_blank( $f_os_build ) ) {
$f_os_build = $row['os_build'];
}
}
$t_bug_id = bug_create( $t_project_id,
$t_reporter_id, $f_handler_id,
$f_priority,
$f_severity, $f_reproducibility,
$f_category,
$f_os, $f_os_build,
$f_platform, $f_product_version,
$f_build,
$f_profile_id, $f_summary, $f_view_state,
$f_description, $f_steps_to_reproduce, $f_additional_info );
# Handle the file upload
if ( is_uploaded_file( $f_file['tmp_name'] ) &&
0 != $f_file['size'] &&
file_allow_bug_upload() ) {
file_add( $t_bug_id, $f_file['tmp_name'], $f_file['name'], $f_file['type'] );
}
# Handle custom field submission
if( ON == config_get( 'use_experimental_custom_fields' ) ) {
$t_related_custom_field_ids = custom_field_get_linked_ids( helper_get_current_project() );
foreach( $t_related_custom_field_ids as $t_id ) {
$t_def = custom_field_get_definition( $t_id );
if( !custom_field_set_value( $t_id, $t_bug_id, gpc_get_string( "custom_field_$t_id", $t_def['default_value'] ) ) ) {
trigger_error( ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR );
}
}
}
print_page_top1();
if ( ! $f_report_stay ) {
print_meta_redirect( 'view_all_bug_page.php' );
}
print_page_top2();
?>
<br />
<div align="center">
<?php
echo lang_get( 'operation_successful' ) . '<br />';
if ( $f_report_stay ) {
?>
<form method="post" action="<?php echo string_get_bug_report_url() ?>">
<input type="hidden" name="category" value="<?php echo $f_category ?>" />
<input type="hidden" name="severity" value="<?php echo $f_severity ?>" />
<input type="hidden" name="reproducibility" value="<?php echo $f_reproducibility ?>" />
<input type="hidden" name="profile_id" value="<?php echo $f_profile_id ?>" />
<input type="hidden" name="platform" value="<?php echo $f_platform ?>" />
<input type="hidden" name="os" value="<?php echo $f_os ?>" />
<input type="hidden" name="os_build" value="<?php echo $f_os_build ?>" />
<input type="hidden" name="product_version" value="<?php echo $f_product_version ?>" />
<input type="hidden" name="build" value="<?php echo $f_build ?>" />
<input type="hidden" name="report_stay" value="1" />
<input type="hidden" name="view_state" value="<?php echo $f_view_state ?>" />
<input type="submit" value="<?php echo lang_get( 'report_more_bugs' ) ?>" />
</form>
<?php
} else {
print_bracket_link( string_get_bug_view_url( $t_bug_id, 1 ), lang_get( 'view_submitted_bug_link' ) . " $t_bug_id" );
print_bracket_link( 'view_all_bug_page.php', lang_get( 'view_bugs_link' ) );
}
?>
</div>
<?php print_page_bot1( __FILE__ ) ?>