aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/download/file.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/download/file.php')
-rw-r--r--phpBB/download/file.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index db71052707..13494b12f4 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -343,9 +343,18 @@ else
if ($post_id)
{
- $sql = 'SELECT post_subject
- FROM ' . POSTS_TABLE . "
- WHERE post_id = $post_id";
+ if ($attachment['in_message'])
+ {
+ $sql = 'SELECT message_subject
+ FROM ' . PRIVMSGS_TABLE . "
+ WHERE msg_id = $post_id";
+ }
+ else
+ {
+ $sql = 'SELECT post_subject
+ FROM ' . POSTS_TABLE . "
+ WHERE post_id = $post_id";
+ }
}
else
{
@@ -359,7 +368,7 @@ else
$db->sql_freeresult($result);
$bad_chars = array("'", "\\", ' ', '/', ':', '*', '?', '"', '<', '>', '|');
- $clean_name = ($post_id) ? $row['post_subject'] : $row['topic_title'];
+ $clean_name = current($row);
$clean_name = rawurlencode(str_replace($bad_chars, '_', strtolower($clean_name)));
$clean_name = preg_replace("/%(\w{2})/", '_', $clean_name);
$suffix = '_' . (($post_id) ? $post_id : $topic_id) . '_' . $clean_name;