Index: bug_api.php =================================================================== --- bug_api.php (revision 217) +++ bug_api.php (revision 218) @@ -1404,16 +1404,17 @@ * @uses database_api.php * @uses file_api.php */ -function bug_get_attachments( $p_bug_id ) { +function bug_get_attachments( $p_bug_id , $p_bugnote_id = 0 ) { $c_bug_id = db_prepare_int( $p_bug_id ); + $c_bugnote_id = db_prepare_int( $p_bugnote_id ); $t_bug_file_table = db_get_table( 'mantis_bug_file_table' ); $query = "SELECT id, title, diskfile, filename, filesize, file_type, date_added, user_id FROM $t_bug_file_table - WHERE bug_id=" . db_param() . " + WHERE bug_id=" . db_param() . " AND bugnote_id=" . db_param() . " ORDER BY date_added"; - $db_result = db_query_bound( $query, Array( $c_bug_id ) ); + $db_result = db_query_bound( $query, Array( $c_bug_id , $c_bugnote_id ) ); $num_files = db_num_rows( $db_result ); $t_result = array(); Index: print_api.php =================================================================== --- print_api.php (revision 217) +++ print_api.php (revision 218) @@ -1667,8 +1667,8 @@ # List the attachments belonging to the specified bug. This is used from within # bug_view_inc.php -function print_bug_attachments_list( $p_bug_id ) { - $t_attachments = file_get_visible_attachments( $p_bug_id ); +function print_bug_attachments_list( $p_bug_id , $p_bugnote_id = 0) { + $t_attachments = file_get_visible_attachments( $p_bug_id, $p_bugnote_id ); $t_attachments_count = count( $t_attachments ); $i = 0; Index: file_api.php =================================================================== --- file_api.php (revision 217) +++ file_api.php (revision 218) @@ -241,14 +241,14 @@ # exists - Applicable for DISK attachments. true: file exists, otherwise false. # can_delete - The logged in user can delete the attachments. # preview - true: the attachment should be previewable, otherwise false. -# type - Can be "image", "text" or empty for other types. -# alt - The alternate text to be associated with the icon. -# icon - array with icon information, contains 'url' and 'alt' elements. -function file_get_visible_attachments( $p_bug_id ) { - $t_attachment_rows = bug_get_attachments( $p_bug_id ); - $t_visible_attachments = array(); - - $t_attachments_count = count( $t_attachment_rows ); +# type - Can be "image", "text" or empty for other types. +# alt - The alternate text to be associated with the icon. +# icon - array with icon information, contains 'url' and 'alt' elements. +function file_get_visible_attachments( $p_bug_id , $p_bugnote_id =0 ) { + $t_attachment_rows = bug_get_attachments( $p_bug_id , $p_bugnote_id ); + $t_visible_attachments = array(); + + $t_attachments_count = count( $t_attachment_rows ); if( $t_attachments_count === 0 ) { return $t_visible_attachments; } @@ -638,13 +638,15 @@ * @param string $p_user_id user id (defaults to current user) * @param int $p_date_added date added * @param bool $p_skip_bug_update skip bug last modification update (useful when importing bug attachments) - */ -function file_add( $p_bug_id, $p_file, $p_table = 'bug', $p_title = '', $p_desc = '', $p_user_id = null, $p_date_added = 0, $p_skip_bug_update = false ) { + */ +function file_add( $p_bug_id, $p_file, $p_table = 'bug', $p_title = '', $p_desc = '', $p_user_id = null, $p_date_added = 0, $p_skip_bug_update = false ) { + + $bugnote_id = gpc_get_int('upload_file_bugnote_id', 0); + + file_ensure_uploaded( $p_file ); + $t_file_name = $p_file['name']; + $t_tmp_file = $p_file['tmp_name']; - file_ensure_uploaded( $p_file ); - $t_file_name = $p_file['name']; - $t_tmp_file = $p_file['tmp_name']; - if( !file_type_check( $t_file_name ) ) { trigger_error( ERROR_FILE_NOT_ALLOWED, ERROR ); } @@ -726,20 +728,21 @@ } $t_file_table = db_get_table( 'mantis_' . $p_table . '_file_table' ); - $t_id_col = $p_table . "_id"; - - $query = "INSERT INTO $t_file_table - ( $t_id_col, title, description, diskfile, filename, folder, filesize, file_type, date_added, content, user_id ) - VALUES - ( " . db_param() . ", " . db_param() . ", " . db_param() . ", " - . db_param() . ", " . db_param() . ", " . db_param() . ", " - . db_param() . ", " . db_param() . ", " . db_param() . ", " - . db_param() . ", " . db_param() . " )"; - db_query_bound( $query, Array( - $t_id, - $p_title, - $p_desc, - $t_unique_name, + $t_id_col = $p_table . "_id"; + + $query = "INSERT INTO $t_file_table + ( $t_id_col, bugnote_id, title, description, diskfile, filename, folder, filesize, file_type, date_added, content, user_id ) + VALUES + ( " . db_param() . ", " . db_param() . ", " . db_param() . ", " . db_param() . ", " + . db_param() . ", " . db_param() . ", " . db_param() . ", " + . db_param() . ", " . db_param() . ", " . db_param() . ", " + . db_param() . ", " . db_param() . " )"; + db_query_bound( $query, Array( + $t_id, + $bugnote_id, + $p_title, + $p_desc, + $t_unique_name, $t_file_name, $t_file_path, $t_file_size, Index: bug_file_upload_inc.php =================================================================== --- bug_file_upload_inc.php (revision 217) +++ bug_file_upload_inc.php (revision 218) @@ -69,6 +69,8 @@ } } ?> + + Bugnote-ID: Index: bugnote_view_inc.php =================================================================== --- bugnote_view_inc.php (revision 217) +++ bugnote_view_inc.php (revision 218) @@ -212,7 +212,12 @@ } echo string_display_links( $t_bugnote->note );; - ?> + ++

++ id ); ++ ?> ++
-------> Datei hochladen -------> id, VS_PRIVATE == $t_bugnote->view_state ) ); ?>