Monday, March 23, 2009

error uploading. directory problem with DOCman 1.4 RC3

Bug Fixing in joomla docman component

The paths to the files are as follows:

JOOMLA/components/com_docman/includes_frontend/upload.http.php
JOOMLA/administrator/components/com_docman/includes/files.php
JOOMLA/administrator/components/com_docman/classes/DOCMAN_file.class.php

Where JOOMLA is the root / home folder of the joomla installation (not to be confused with the root folder of the server).

Hello I’ve had the error message “error uploading. directory problem” with DOCman 1.4 RC3, debugged the code and found the solution - it is a bug in RC3:
Effect:
- Error message: “error uploading. directory problem”, after step 2 of uploading a new file,
Occurrence:
- with docman 1.4 RC3, (not with RC1)
- on windows-based webservers (directory paths with backslash)
- if in PHP configuration “magic_quotes_gpc” is set to “on”

Reason:
Bug in RC3:
“DOCMAN_Utils::stripslashes()” removes backslashes in ['tmp_name'], what should NOT be done!!
- in “com_docman/includes_frontend/upload.http.php”, Line 38
- in “com_docman/includes/files.php”, Line 177:

Solution:
In “com_docman/includes/files.php”, line 177
remove DOCMAN_Utils::stripslashes() function:
- incorrect: $file_upload = mosGetParam(DOCMAN_Utils::stripslashes($_FILES), ‘upload’);
- correct: $file_upload = mosGetParam($_FILES, ‘upload’);

In “com_docman/includes_frontend/upload.http.php”, line 38
remove DOCMAN_Utils::stripslashes() function:
- incorrect: $file = mosGetParam(DOCMAN_Utils::stripslashes($_FILES), ‘upload’);
- correct: $file = mosGetParam($_FILES, ‘upload’);

And instead: In “com_docman/classes/DOCMAN_file.class.php”, line 352
add DOCMAN_Utils::stripslashes() function:
- incorrect: $name = $file['name'];
- correct: $name = DOCMAN_Utils::stripslashes($file['name']);

Labels: