Skip to content

Commit

Permalink
Fix for 2884: attachments on closed bugs can be deleted.
Browse files Browse the repository at this point in the history
M core/file_api.php
  (file_list_attachments): Only display [delete] link if the user has handler
  access level + the bug status is below the resolved threshold.


git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@1781 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
vboctor committed Jan 29, 2003
1 parent 05441f2 commit 1f678cf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/file_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: file_api.php,v 1.20 2003-01-25 18:21:08 jlatour Exp $
# $Id: file_api.php,v 1.21 2003-01-29 00:53:04 vboctor Exp $
# --------------------------------------------------------

$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
Expand Down Expand Up @@ -37,6 +37,10 @@ function file_list_attachments ( $p_bug_id ) {
WHERE bug_id='$c_bug_id'";
$result = db_query( $query );

$t_bug = bug_get( $c_bug_id, false );
$t_can_delete = ( $t_bug->status < config_get( 'bug_resolved_status_threshold' ) ) &&
access_level_check_greater_or_equal( config_get( 'handle_bug_threshold' ) );

$num_files = db_num_rows( $result );
for ( $i = 0 ; $i < $num_files ; $i++ ) {
$row = db_fetch_array( $result );
Expand All @@ -47,7 +51,7 @@ function file_list_attachments ( $p_bug_id ) {

echo "<a href=\"file_download.php?file_id=$v_id&amp;type=bug\">".file_get_display_name($v_filename)."</a> ($v_filesize bytes) <span class=\"italic\">$v_date_added</span>";

if ( access_level_check_greater_or_equal( config_get( 'handle_bug_threshold' ) ) ) {
if ( $t_can_delete ) {
echo " [<a class=\"small\" href=\"bug_file_delete.php?file_id=$v_id\">" . lang_get('delete_link') . '</a>]';
}

Expand Down

0 comments on commit 1f678cf

Please sign in to comment.