Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 760efda

Browse files
committedApr 18, 2012
Merge commit 'release-1.2.10' into oracle
Conflicts: config_defaults_inc.php
2 parents fb4a44a + 974f363 commit 760efda

35 files changed

+522
-396
lines changed
 

‎api/soap/mc_tag_api.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ function mci_tag_set_for_issue ( $p_issue_id, $p_tags, $p_user_id ) {
149149

150150
foreach ( $t_tag_ids_to_detach as $t_tag_id ) {
151151
if ( access_has_bug_level ( config_get('tag_detach_threshold'), $p_issue_id, $p_user_id ) ) {
152-
tag_bug_detach( $t_tag_id, $p_issue_id, true);
152+
tag_bug_detach( $t_tag_id, $p_issue_id);
153153
}
154154
}
155155

156156
foreach ( $t_tag_ids_to_attach as $t_tag_id ) {
157157
if ( access_has_bug_level ( config_get('tag_attach_threshold'), $p_issue_id, $p_user_id ) ) {
158-
tag_bug_attach( $t_tag_id, $p_issue_id, true);
158+
tag_bug_attach( $t_tag_id, $p_issue_id);
159159
}
160160
}
161161
}

‎bug_actiongroup_page.php

-3
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,6 @@
265265
print_enum_string_option_list( 'view_state', config_get( 'default_bug_view_status' ) );
266266
break;
267267
case 'UP_TARGET_VERSION':
268-
print_version_option_list( '', $t_project_id, VERSION_FUTURE,
269-
/* allow blank version */ true, /* include subprojects */ true );
270-
break;
271268
case 'UP_FIXED_IN_VERSION':
272269
print_version_option_list( '', $t_project_id, VERSION_ALL,
273270
/* allow blank version */ true, /* include subprojects */ true );

‎bug_file_add.php

+16-5
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
/**
2626
* MantisBT Core API's
2727
*/
28-
require_once( 'core.php' );
2928

29+
require_once( 'core.php' );
3030
require_once( 'file_api.php' );
3131

32-
$f_bug_id = gpc_get_int( 'bug_id', -1 );
33-
$f_file = gpc_get_file( 'file', -1 );
32+
$f_bug_id = gpc_get_int( 'bug_id', -1 );
33+
$f_files = gpc_get_file( 'ufile', -1 );
3434

35-
if ( $f_bug_id == -1 && $f_file == -1 ) {
35+
if ( $f_bug_id == -1 && $f_files == -1 ) {
3636
# _POST/_FILES does not seem to get populated if you exceed size limit so check if bug_id is -1
3737
trigger_error( ERROR_FILE_TOO_BIG, ERROR );
3838
}
@@ -52,7 +52,18 @@
5252

5353
access_ensure_bug_level( config_get( 'upload_bug_file_threshold' ), $f_bug_id );
5454

55-
file_add( $f_bug_id, $f_file, 'bug' );
55+
// Process array of files to upload
56+
for( $i = 0; $i < count( $f_files ); $i++ ) {
57+
if( !empty( $f_files['name'][$i] ) ) {
58+
$t_file['name'] = $f_files['name'][$i];
59+
$t_file['tmp_name'] = $f_files['tmp_name'][$i];
60+
$t_file['type'] = $f_files['type'][$i];
61+
$t_file['error'] = $f_files['error'][$i];
62+
$t_file['size'] = $f_files['size'][$i];
63+
64+
file_add( $f_bug_id, $t_file, 'bug' );
65+
}
66+
}
5667

5768
form_security_purge( 'bug_file_add' );
5869

‎bug_file_upload_inc.php

+18-4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
<?php
3838
collapse_open( 'upload_form' );
39+
$t_file_upload_max_num = max( 1, config_get( 'file_upload_max_num' ) );
3940
?>
4041
<form method="post" enctype="multipart/form-data" action="bug_file_add.php">
4142
<?php echo form_security_field( 'bug_file_add' ) ?>
@@ -45,19 +46,32 @@
4546
<td class="form-title" colspan="2">
4647
<?php
4748
collapse_icon( 'upload_form' );
48-
echo lang_get( 'upload_file' ) ?>
49+
echo lang_get( $t_file_upload_max_num == 1 ? 'upload_file' : 'upload_files' );
50+
?>
4951
</td>
5052
</tr>
5153
<tr class="row-1">
5254
<td class="category" width="15%">
53-
<?php echo lang_get( 'select_file' ) ?><br />
55+
<?php echo lang_get( $t_file_upload_max_num == 1 ? 'select_file' : 'select_files' ) ?><br />
5456
<?php echo '<span class="small">(' . lang_get( 'max_file_size' ) . ': ' . number_format( $t_max_file_size/1000 ) . 'k)</span>'?>
5557
</td>
5658
<td width="85%">
5759
<input type="hidden" name="bug_id" value="<?php echo $f_bug_id ?>" />
5860
<input type="hidden" name="max_file_size" value="<?php echo $t_max_file_size ?>" />
59-
<input name="file" type="file" size="40" />
60-
<input type="submit" class="button" value="<?php echo lang_get( 'upload_file_button' ) ?>" />
61+
<?php
62+
// Display multiple file upload fields
63+
for( $i = 0; $i < $t_file_upload_max_num; $i++ ) {
64+
?>
65+
<input id="ufile[]" name="ufile[]" type="file" size="50" />
66+
<?php
67+
if( $t_file_upload_max_num > 1 ) {
68+
echo '<br />';
69+
}
70+
}
71+
?>
72+
<input type="submit" class="button"
73+
value="<?php echo lang_get( $t_file_upload_max_num == 1 ? 'upload_file_button' : 'upload_files_button' ) ?>"
74+
/>
6175
</td>
6276
</tr>
6377
</table>

‎bug_report.php

+37-37
Original file line numberDiff line numberDiff line change
@@ -58,45 +58,37 @@
5858
access_ensure_project_level( config_get('report_bug_threshold' ) );
5959

6060
$t_bug_data = new BugData;
61-
$t_bug_data->build = gpc_get_string( 'build', '' );
62-
$t_bug_data->platform = gpc_get_string( 'platform', '' );
63-
$t_bug_data->os = gpc_get_string( 'os', '' );
64-
$t_bug_data->os_build = gpc_get_string( 'os_build', '' );
65-
$t_bug_data->version = gpc_get_string( 'product_version', '' );
66-
$t_bug_data->profile_id = gpc_get_int( 'profile_id', 0 );
67-
$t_bug_data->handler_id = gpc_get_int( 'handler_id', 0 );
68-
$t_bug_data->view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) );
69-
70-
$t_bug_data->category_id = gpc_get_int( 'category_id', 0 );
71-
$t_bug_data->reproducibility = gpc_get_int( 'reproducibility', config_get( 'default_bug_reproducibility' ) );
72-
$t_bug_data->severity = gpc_get_int( 'severity', config_get( 'default_bug_severity' ) );
73-
$t_bug_data->priority = gpc_get_int( 'priority', config_get( 'default_bug_priority' ) );
74-
$t_bug_data->projection = gpc_get_int( 'projection', config_get( 'default_bug_projection' ) );
75-
$t_bug_data->eta = gpc_get_int( 'eta', config_get( 'default_bug_eta' ) );
76-
$t_bug_data->resolution = config_get( 'default_bug_resolution' );
77-
$t_bug_data->status = config_get( 'bug_submit_status' );
78-
$t_bug_data->summary = gpc_get_string( 'summary' );
79-
$t_bug_data->description = gpc_get_string( 'description' );
80-
$t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', config_get( 'default_bug_steps_to_reproduce' ) );
81-
$t_bug_data->additional_information = gpc_get_string( 'additional_info', config_get ( 'default_bug_additional_info' ) );
82-
$t_bug_data->due_date = gpc_get_string( 'due_date', '');
61+
$t_bug_data->project_id = $t_project_id;
62+
$t_bug_data->reporter_id = auth_get_current_user_id();
63+
$t_bug_data->build = gpc_get_string( 'build', '' );
64+
$t_bug_data->platform = gpc_get_string( 'platform', '' );
65+
$t_bug_data->os = gpc_get_string( 'os', '' );
66+
$t_bug_data->os_build = gpc_get_string( 'os_build', '' );
67+
$t_bug_data->version = gpc_get_string( 'product_version', '' );
68+
$t_bug_data->profile_id = gpc_get_int( 'profile_id', 0 );
69+
$t_bug_data->handler_id = gpc_get_int( 'handler_id', 0 );
70+
$t_bug_data->view_state = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) );
71+
$t_bug_data->category_id = gpc_get_int( 'category_id', 0 );
72+
$t_bug_data->reproducibility = gpc_get_int( 'reproducibility', config_get( 'default_bug_reproducibility' ) );
73+
$t_bug_data->severity = gpc_get_int( 'severity', config_get( 'default_bug_severity' ) );
74+
$t_bug_data->priority = gpc_get_int( 'priority', config_get( 'default_bug_priority' ) );
75+
$t_bug_data->projection = gpc_get_int( 'projection', config_get( 'default_bug_projection' ) );
76+
$t_bug_data->eta = gpc_get_int( 'eta', config_get( 'default_bug_eta' ) );
77+
$t_bug_data->resolution = config_get( 'default_bug_resolution' );
78+
$t_bug_data->status = config_get( 'bug_submit_status' );
79+
$t_bug_data->summary = trim( gpc_get_string( 'summary' ) );
80+
$t_bug_data->description = gpc_get_string( 'description' );
81+
$t_bug_data->steps_to_reproduce = gpc_get_string( 'steps_to_reproduce', config_get( 'default_bug_steps_to_reproduce' ) );
82+
$t_bug_data->additional_information = gpc_get_string( 'additional_info', config_get ( 'default_bug_additional_info' ) );
83+
$t_bug_data->due_date = gpc_get_string( 'due_date', '');
8384
if ( is_blank ( $t_bug_data->due_date ) ) {
8485
$t_bug_data->due_date = date_get_null();
85-
} else {
86-
$t_bug_data->due_date = $t_bug_data->due_date;
8786
}
8887

89-
$f_file = gpc_get_file( 'file', null ); /** @todo (thraxisp) Note that this always returns a structure */
90-
# size = 0, if no file
91-
$f_report_stay = gpc_get_bool( 'report_stay', false );
92-
$f_copy_notes_from_parent = gpc_get_bool( 'copy_notes_from_parent', false);
93-
$f_copy_attachments_from_parent = gpc_get_bool( 'copy_attachments_from_parent', false);
94-
95-
$t_bug_data->project_id = $t_project_id;
96-
97-
$t_bug_data->reporter_id = auth_get_current_user_id();
98-
99-
$t_bug_data->summary = trim( $t_bug_data->summary );
88+
$f_files = gpc_get_file( 'ufile', null ); /** @todo (thraxisp) Note that this always returns a structure */
89+
$f_report_stay = gpc_get_bool( 'report_stay', false );
90+
$f_copy_notes_from_parent = gpc_get_bool( 'copy_notes_from_parent', false);
91+
$f_copy_attachments_from_parent = gpc_get_bool( 'copy_attachments_from_parent', false);
10092

10193
if ( access_has_project_level( config_get( 'roadmap_update_threshold' ), $t_bug_data->project_id ) ) {
10294
$t_bug_data->target_version = gpc_get_string( 'target_version', '' );
@@ -150,8 +142,16 @@
150142
last_visited_issue( $t_bug_id );
151143

152144
# Handle the file upload
153-
if ( !is_blank( $f_file['tmp_name'] ) && ( 0 < $f_file['size'] ) ) {
154-
file_add( $t_bug_id, $f_file, 'bug' );
145+
for( $i = 0; $i < count( $f_files ); $i++ ) {
146+
if( !empty( $f_files['name'][$i] ) ) {
147+
$t_file['name'] = $f_files['name'][$i];
148+
$t_file['tmp_name'] = $f_files['tmp_name'][$i];
149+
$t_file['type'] = $f_files['type'][$i];
150+
$t_file['error'] = $f_files['error'][$i];
151+
$t_file['size'] = $f_files['size'][$i];
152+
153+
file_add( $t_bug_id, $t_file, 'bug' );
154+
}
155155
}
156156

157157
# Handle custom field submission

‎bug_report_page.php

+23-9
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
</tr>
211211
<?php
212212
}
213-
213+
214214
if ( $tpl_show_eta ) {
215215
?>
216216

@@ -226,7 +226,7 @@
226226
</tr>
227227
<?php
228228
}
229-
229+
230230
if ( $tpl_show_severity ) {
231231
?>
232232
<tr <?php echo helper_alternate_class() ?>>
@@ -413,7 +413,7 @@
413413
</td>
414414
<td>
415415
<select <?php echo helper_get_tab_index() ?> name="target_version">
416-
<?php print_version_option_list( '', null, VERSION_FUTURE ) ?>
416+
<?php print_version_option_list() ?>
417417
</select>
418418
</td>
419419
</tr>
@@ -479,22 +479,36 @@
479479
}
480480
} # foreach( $t_related_custom_field_ids as $t_id )
481481
?>
482-
<?php if ( $tpl_show_attachments ) { // File Upload (if enabled)
483-
$t_max_file_size = (int)min( ini_get_number( 'upload_max_filesize' ), ini_get_number( 'post_max_size' ), config_get( 'max_file_size' ) );
482+
<?php
483+
// File Upload (if enabled)
484+
if ( $tpl_show_attachments ) {
485+
$t_max_file_size = (int)min( ini_get_number( 'upload_max_filesize' ), ini_get_number( 'post_max_size' ), config_get( 'max_file_size' ) );
486+
$t_file_upload_max_num = max( 1, config_get( 'file_upload_max_num' ) );
484487
?>
485488
<tr <?php echo helper_alternate_class() ?>>
486489
<td class="category">
487-
<?php echo lang_get( 'upload_file' ) ?>
490+
<?php echo lang_get( $t_file_upload_max_num == 1 ? 'upload_file' : 'upload_files' ) ?>
488491
<?php echo '<span class="small">(' . lang_get( 'max_file_size' ) . ': ' . number_format( $t_max_file_size/1000 ) . 'k)</span>'?>
489492
</td>
490493
<td>
491494
<input type="hidden" name="max_file_size" value="<?php echo $t_max_file_size ?>" />
492-
<input <?php echo helper_get_tab_index() ?> name="file" type="file" size="60" />
493-
</td>
494-
</tr>
495495
<?php
496+
// Display multiple file upload fields
497+
for( $i = 0; $i < $t_file_upload_max_num; $i++ ) {
498+
?>
499+
<input id="ufile[]" name="ufile[]" type="file" size="50" />
500+
<?php
501+
if( $t_file_upload_max_num > 1 ) {
502+
echo '<br />';
503+
}
504+
}
496505
}
506+
?>
507+
</td>
508+
</tr>
509+
497510

511+
<?php
498512
if ( $tpl_show_view_state ) {
499513
?>
500514
<tr <?php echo helper_alternate_class() ?>>

‎bug_update_advanced_page.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206

207207
if ( $tpl_show_reporter ) {
208208
echo '<tr ', helper_alternate_class(), '>';
209-
209+
210210
$t_spacer = 4;
211211

212212
if ( $tpl_show_reporter ) {
@@ -240,7 +240,7 @@
240240

241241
if ( $tpl_show_handler || $tpl_show_due_date ) {
242242
echo '<tr ', helper_alternate_class(), '>';
243-
243+
244244
$t_spacer = 2;
245245

246246
# Assigned To
@@ -288,7 +288,7 @@
288288
} else {
289289
$t_spacer += 2;
290290
}
291-
291+
292292
# spacer
293293
echo '<td colspan="', $t_spacer, '">&#160;</td>';
294294

@@ -301,7 +301,7 @@
301301

302302
if ( $tpl_show_priority || $tpl_show_severity || $tpl_show_reproducibility ) {
303303
echo '<tr ', helper_alternate_class(), '>';
304-
304+
305305
$t_spacer = 0;
306306

307307
if ( $tpl_show_priority ) {
@@ -525,7 +525,7 @@
525525
}
526526

527527
#
528-
# Target Version, Fixed in Version
528+
# Target Versiom, Fixed in Version
529529
#
530530

531531
if ( $tpl_show_target_version || $tpl_show_fixed_in_version ) {
@@ -537,7 +537,7 @@
537537
if ( $tpl_show_target_version ) {
538538
echo '<td class="category">', lang_get( 'target_version' ), '</td>';
539539
echo '<td><select ', helper_get_tab_index(), ' name="target_version">';
540-
print_version_option_list( $tpl_bug->target_version, $tpl_bug->project_id, VERSION_FUTURE );
540+
print_version_option_list( $tpl_bug->target_version, $tpl_bug->project_id, VERSION_ALL );
541541
echo '</select></td>';
542542
} else {
543543
$t_spacer += 2;

0 commit comments

Comments
 (0)
Please sign in to comment.