Skip to content

Commit

Permalink
Modified disk uploads to use the file_download.php script. Removed di…
Browse files Browse the repository at this point in the history
…rect links to files. Files can be stored in non web accessible folders.

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@976 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Kenzaburo Ito committed May 19, 2002
1 parent f26f433 commit e3cf12d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 28 deletions.
3 changes: 2 additions & 1 deletion doc/ChangeLog
Expand Up @@ -14,7 +14,8 @@ Mantis
* Updated PHP and MySQL requirements.
* Updated Norwegian, Russian, Danish translations.
* Added russian_koi8 translation.
* Fixed no colors when using non-English languages.
* Fixed no colors when using non-English languages (temporary fix).
* Modified disk uploads to use the file_download.php script.

05.12.2002 - 0.17.2

Expand Down
9 changes: 7 additions & 2 deletions file_download.php
Expand Up @@ -13,6 +13,8 @@
db_connect( $g_hostname, $g_db_username, $g_db_password, $g_database_name );
#check_access( DEVELOPER );

# we handle the case where the file is attached to a bug
# or attached to a project as a project doc.
switch ( $f_type ) {
case "bug": $query = "SELECT *
FROM $g_mantis_bug_file_table
Expand All @@ -23,7 +25,6 @@
WHERE id='$f_id'";
break;
}

$result = db_query( $query );
$row = db_fetch_array( $result );
extract( $row, EXTR_PREFIX_ALL, "v" );
Expand All @@ -34,5 +35,9 @@
header( "Content-Description: Download Data" );

# dump file content to the connection.
echo $v_content;
if ( DISK == $g_file_upload_method ) {
readfile( $v_diskfile );
} else {
echo $v_content;
}
?>
9 changes: 2 additions & 7 deletions proj_doc_page.php
Expand Up @@ -47,13 +47,8 @@
<tr valign="top">
<td bgcolor="<?php echo $status_color ?>">
<?php
switch ( $g_file_upload_method ) {
case DISK: PRINT "<a href=\"$v_diskfile\">$v_title</a> ($v_filesize bytes)";
break;
case DATABASE:
PRINT "<a href=\"$g_file_download?f_id=$v_id&f_type=doc\">$v_title</a> ($v_filesize bytes)";
break;
}
PRINT "<a href=\"$g_file_download?f_id=$v_id&f_type=doc\">$v_title</a> ($v_filesize bytes)";

if ( access_level_check_greater_or_equal( MANAGER ) ) {
print_bracket_link( $g_proj_doc_edit_page."?f_id=".$v_id, "edit" );
}
Expand Down
10 changes: 1 addition & 9 deletions view_bug_advanced_page.php
Expand Up @@ -303,18 +303,10 @@
for ($i=0;$i<$num_files;$i++) {
$row = db_fetch_array( $result );
extract( $row, EXTR_PREFIX_ALL, "v2" );
$v2_diskfile = str_replace( $DOCUMENT_ROOT, "", $v2_diskfile );
$v2_diskfile = dirname( $v2_diskfile )."/".rawurlencode( $v2_filename );
$v2_filesize = number_format( $v2_filesize );
$v2_date_added = date( $g_normal_date_format, ( $v2_date_added ) );

switch ( $g_file_upload_method ) {
case DISK: PRINT "<a href=\"$v2_diskfile\">$v2_filename</a> ($v2_filesize bytes) <span class=\"italic\">$v2_date_added</span>";
break;
case DATABASE:
PRINT "<a href=\"$g_file_download?f_id=$v2_id&f_type=bug\">$v2_filename</a> ($v2_filesize bytes) <span class=\"italic\">$v2_date_added</span>";
break;
}
PRINT "<a href=\"$g_file_download?f_id=$v2_id&f_type=bug\">$v2_filename</a> ($v2_filesize bytes) <span class=\"italic\">$v2_date_added</span>";

if ( access_level_check_greater_or_equal( DEVELOPER ) ) {
PRINT " [<a class=\"small\" href=\"$g_bug_file_delete?f_id=$f_id&f_file_id=$v2_id\">$s_delete_link</a>]";
Expand Down
10 changes: 1 addition & 9 deletions view_bug_page.php
Expand Up @@ -203,18 +203,10 @@
for ($i=0;$i<$num_files;$i++) {
$row = db_fetch_array( $result );
extract( $row, EXTR_PREFIX_ALL, "v2" );
$v2_diskfile = str_replace( $DOCUMENT_ROOT, "", $v2_diskfile );
$v2_diskfile = dirname( $v2_diskfile )."/".rawurlencode( $v2_filename );
$v2_filesize = number_format( $v2_filesize );
$v2_date_added = date( $g_normal_date_format, ( $v2_date_added ) );

switch ( $g_file_upload_method ) {
case DISK: PRINT "<a href=\"$v2_diskfile\">$v2_filename</a> ($v2_filesize bytes) <span class=\"italic\">$v2_date_added</span>";
break;
case DATABASE:
PRINT "<a href=\"$g_file_download?f_id=$v2_id&f_type=bug\">$v2_filename</a> ($v2_filesize bytes) <span class=\"italic\">$v2_date_added</span>";
break;
}
PRINT "<a href=\"$g_file_download?f_id=$v2_id&f_type=bug\">$v2_filename</a> ($v2_filesize bytes) <span class=\"italic\">$v2_date_added</span>";

if ( access_level_check_greater_or_equal( DEVELOPER ) ) {
PRINT " [<a class=\"small\" href=\"$g_bug_file_delete?f_id=$f_id&f_file_id=$v2_id\">$s_delete_link</a>]";
Expand Down

0 comments on commit e3cf12d

Please sign in to comment.