mirror of
https://github.com/e107inc/e107.git
synced 2025-03-13 17:09:46 +01:00
#310 - Forum upload should be functional now. Downloading files not working yet.
This commit is contained in:
parent
ecfce3b2c1
commit
d5b99115de
@ -187,17 +187,21 @@ class e107forum
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
function getAttachmentPath($user,$create=false)
|
||||
/**
|
||||
* @param $user integer userid (if empty "anon" will be used)
|
||||
* @param $create boolean creates the attachment folder if set to true
|
||||
* @return forum attachment path for specific user
|
||||
*/
|
||||
function getAttachmentPath($user, $create = FALSE)
|
||||
{
|
||||
$user = intval($user);
|
||||
$tp = e107::getParser();
|
||||
$baseDir = e_MEDIA.'plugins/forum/attachments/';
|
||||
$baseDir .= ($user) ? "user_". $tp->leadingZeros($user, 6) : "anon";
|
||||
|
||||
if($create == true && !is_dir($baseDir))
|
||||
if($create == TRUE && !is_dir($baseDir))
|
||||
{
|
||||
mkdir($baseDir,0755);
|
||||
mkdir($baseDir, 0755, TRUE); // recursively
|
||||
}
|
||||
|
||||
$baseDir .= "/";
|
||||
@ -206,8 +210,6 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function sendFile($data)
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
|
@ -569,17 +569,11 @@ function process_upload()
|
||||
{
|
||||
require_once(e_HANDLER.'upload_handler.php');
|
||||
|
||||
$attachmentDir = $forum->getAttachmentPath(USERID);
|
||||
// retrieve and create attachment directory if needed
|
||||
$attachmentDir = $forum->getAttachmentPath(USERID, TRUE);
|
||||
|
||||
if(!is_dir($attachmentDir))
|
||||
{
|
||||
mkdir($attachmentDir, 0755);
|
||||
}
|
||||
// $thumbDir = e_PLUGIN.'forum/attachments/thumb/';
|
||||
|
||||
if ($uploaded = process_uploaded_files($attachmentDir, 'attachment', ''))
|
||||
{
|
||||
|
||||
if($uploaded = process_uploaded_files($attachmentDir, 'attachment', ''))
|
||||
{
|
||||
foreach($uploaded as $upload)
|
||||
{
|
||||
if ($upload['error'] == 0)
|
||||
@ -664,9 +658,10 @@ function process_upload()
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
//exit;
|
||||
|
||||
else
|
||||
{
|
||||
// error message?
|
||||
}
|
||||
}
|
||||
|
||||
function image_getsize($fname)
|
||||
|
Loading…
x
Reference in New Issue
Block a user