mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
#310 - Forum upload should be functional now. Downloading files not working yet.
This commit is contained in:
@@ -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);
|
$user = intval($user);
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$baseDir = e_MEDIA.'plugins/forum/attachments/';
|
$baseDir = e_MEDIA.'plugins/forum/attachments/';
|
||||||
$baseDir .= ($user) ? "user_". $tp->leadingZeros($user, 6) : "anon";
|
$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 .= "/";
|
$baseDir .= "/";
|
||||||
@@ -206,8 +210,6 @@ class e107forum
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function sendFile($data)
|
function sendFile($data)
|
||||||
{
|
{
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
|
@@ -569,17 +569,11 @@ function process_upload()
|
|||||||
{
|
{
|
||||||
require_once(e_HANDLER.'upload_handler.php');
|
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))
|
if($uploaded = process_uploaded_files($attachmentDir, 'attachment', ''))
|
||||||
{
|
{
|
||||||
mkdir($attachmentDir, 0755);
|
|
||||||
}
|
|
||||||
// $thumbDir = e_PLUGIN.'forum/attachments/thumb/';
|
|
||||||
|
|
||||||
if ($uploaded = process_uploaded_files($attachmentDir, 'attachment', ''))
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach($uploaded as $upload)
|
foreach($uploaded as $upload)
|
||||||
{
|
{
|
||||||
if ($upload['error'] == 0)
|
if ($upload['error'] == 0)
|
||||||
@@ -664,9 +658,10 @@ function process_upload()
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
//exit;
|
{
|
||||||
|
// error message?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function image_getsize($fname)
|
function image_getsize($fname)
|
||||||
|
Reference in New Issue
Block a user