From de45dd242ead8bfb0a10e413f389c4b2075b61e9 Mon Sep 17 00:00:00 2001 From: Moc Date: Mon, 4 Aug 2014 10:27:42 +0200 Subject: [PATCH] #310 - Forum attachment downloading should work now. TODO: checks and error handling --- e107_plugins/forum/forum_class.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php index 5e601e9d1..36311808d 100644 --- a/e107_plugins/forum/forum_class.php +++ b/e107_plugins/forum/forum_class.php @@ -210,17 +210,18 @@ class e107forum } - function sendFile($data) - { - $sql = e107::getDb(); - $fid = intval($data['dl']); - - $array = $sql->retrieve('forum_post','post_user,post_attachments','post_id='.intval($data['id'])); - $attach = e107::serialize($array['post_attachments']); - $file = $this->getAttachmentPath($array['post_user']).varset($attach['file'][$fid]); + function sendFile($data) + { + $sql = e107::getDb(); + $id = intval($data['id']); // forum (post) id + $fid = intval($data['dl']); // file id - e107::getFile()->send($file); - } + $array = $sql->retrieve('forum_post','post_user,post_attachments','post_id='.$id); + $attach = e107::unserialize($array['post_attachments']); + $file = $this->getAttachmentPath($array['post_user']).varset($attach['file'][$fid]); + + e107::getFile()->send($file); + } /**