View Issue Details

IDProjectCategoryView StatusLast Update
0004659mantisbtfeaturepublic2004-11-06 06:25
Reportersly Assigned Tothraxisp  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version0.19.0 
Fixed in Version0.19.1 
Summary0004659: FTP unload don't work fine
Description

I've found some bugs when set upload/download with FTP

a) UID file name are't used in all FTP file functions.
b) FTP delete file of attachments don't work fine.
c) FTP delete file of documents don't work file.
d) many others...

Additional Information

All bugs are fixed in attached mantis-0.19.0-qem-1.patch file

TagsNo tags attached.
Attached Files
mantis-0.19.0-qem-1.patch (3,787 bytes)   
diff -u --recursive --new-file mantis-0.19.0/core/file_api.php mantis-0.19.0-qem-1/core/file_api.php
--- mantis-0.19.0/core/file_api.php	2004-08-31 15:11:50.000000000 +0200
+++ mantis-0.19.0-qem-1/core/file_api.php	2004-10-04 13:43:34.000000000 +0200
@@ -230,7 +230,7 @@
 				file_delete_local ( $row['diskfile'] );
 
 				if ( FTP == $t_method ) {
-					file_ftp_delete ( $ftp, $row['filename'] );
+					file_ftp_delete ( $ftp, $row['diskfile'] );
 				}
 			}
 
@@ -273,7 +273,7 @@
 				file_delete_local ( $row['diskfile'] );
 
 				if ( FTP == $t_method ) {
-					file_ftp_delete ( $ftp, $row['filename'] );
+					file_ftp_delete ( $ftp, $row['diskfile'] );
 				}
 			}
 
@@ -363,7 +363,7 @@
 
 			if ( FTP == $t_upload_method ) {
 				$ftp = file_ftp_connect();
-				file_ftp_delete ( $ftp, $t_filename );
+				file_ftp_delete ( $ftp, $t_diskfile );
 				file_ftp_disconnect( $ftp );
 			}
 
diff -u --recursive --new-file mantis-0.19.0/file_download.php mantis-0.19.0-qem-1/file_download.php
--- mantis-0.19.0/file_download.php	2004-06-16 06:28:28.000000000 +0200
+++ mantis-0.19.0-qem-1/file_download.php	2004-10-04 13:43:58.000000000 +0200
@@ -88,7 +88,7 @@
 				readfile( $v_diskfile );
 			} else {
 				$ftp = file_ftp_connect();
-				file_ftp_get ( $ftp, $v_diskfile, $v_filename );
+				file_ftp_get ( $ftp, $v_diskfile, $v_diskfile );
 				file_ftp_disconnect( $ftp );
 				readfile( $v_diskfile );
 			}
diff -u --recursive --new-file mantis-0.19.0/proj_doc_add.php mantis-0.19.0-qem-1/proj_doc_add.php
--- mantis-0.19.0/proj_doc_add.php	2004-08-31 15:11:50.000000000 +0200
+++ mantis-0.19.0-qem-1/proj_doc_add.php	2004-10-04 13:44:12.000000000 +0200
@@ -97,7 +97,7 @@
 		$query = "INSERT INTO $t_project_file_table
 				(project_id, title, description, diskfile, filename, folder, filesize, file_type, date_added, content)
 				VALUES
-				($t_project_id, '$c_title', '$c_description', '$t_disk_file_name', '$c_file_name', '$c_file_path', $c_file_size, '$c_file_type', " . db_now() .", '$c_content')";
+				($t_project_id, '$c_title', '$c_description', '$c_disk_file_name', '$c_file_name', '$c_file_path', $c_file_size, '$c_file_type', " . db_now() .", '$c_content')";
 
 		$result = db_query( $query );
 	}
diff -u --recursive --new-file mantis-0.19.0/proj_doc_delete.php mantis-0.19.0-qem-1/proj_doc_delete.php
--- mantis-0.19.0/proj_doc_delete.php	2004-02-29 10:07:44.000000000 +0100
+++ mantis-0.19.0-qem-1/proj_doc_delete.php	2004-10-04 10:50:00.000000000 +0200
@@ -9,7 +9,12 @@
 	# $Id: proj_doc_delete.php,v 1.20 2004/02/29 09:07:45 vboctor Exp $
 	# --------------------------------------------------------
 ?>
-<?php require_once( 'core.php' ) ?>
+<?php 
+	require_once( 'core.php' );
+
+	$t_core_path = config_get( 'core_path' );
+	require_once( $t_core_path . 'file_api.php' );
+?>
 <?php
 	# Check if project documentation feature is enabled.
 	if ( OFF == config_get( 'enable_project_documentation' ) ) {
@@ -26,17 +31,22 @@
 	helper_ensure_confirmed( lang_get( 'confirm_file_delete_msg' ),
 							 lang_get( 'file_delete_button' ) );
 
-	if ( DISK == $g_file_upload_method ) {
+
+	if ( ( DISK == $g_file_upload_method ) || ( FTP == $g_file_upload_method ) ) {
 		# grab the file name
 		$query = "SELECT diskfile
 				FROM $g_mantis_project_file_table
 				WHERE id='$c_file_id'";
 		$result = db_query( $query );
 		$t_diskfile = db_result( $result );
-
-		# in windows replace with system("del $t_diskfile");
-		chmod( $t_diskfile, 0775 );
-		unlink( $t_diskfile );
+		if ( FTP == $g_file_upload_method ) {
+			$ftp = file_ftp_connect();
+			file_ftp_delete ( $ftp, $t_diskfile );
+			file_ftp_disconnect( $ftp );
+		}
+		if ( file_exists( $t_diskfile ) ) {
+			system("del $t_diskfile");
+		}
 	}
 
 	$query = "DELETE FROM $g_mantis_project_file_table
mantis-0.19.0-qem-1.patch (3,787 bytes)   

Relationships

child of 0004297 closedvboctor Mantis 0.19.1 release 

Activities

sly

sly

2004-10-04 07:17

reporter   ~0007885

TAKE CARE

In attached mantis-0.19.0-qem-1.path & mantis-0.19.0-qem-2.zip the file proj_doc_delete.php is been configured for windows instead of unix so please use the attachment last_mantis_0.19.0-qem-1.zip.

thraxisp

thraxisp

2004-10-04 19:16

reporter   ~0007900

I'm applying the patches.

In the process, I'm reworking project documents to use the file_api access routines. This means all file access uses the same routines.

It also appears that project documenta can be displayed for "All Projects" (project_id == 0), but they can't be uploaded.

thraxisp

thraxisp

2004-10-05 09:56

reporter   ~0007911

Fixed in CVS