diff options
author | Andreas Fischer <bantu@phpbb.com> | 2012-08-10 03:14:55 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2012-08-10 03:14:55 +0200 |
commit | e5a3bc03b492a573291e2a241b1ed9bcffc19a02 (patch) | |
tree | 6e8a835c910ca0942b1acf2a61de82c5e3531560 /phpBB/download | |
parent | 7bd81cd0cd088ba13648f293fb738060f221a8de (diff) | |
download | forums-e5a3bc03b492a573291e2a241b1ed9bcffc19a02.tar forums-e5a3bc03b492a573291e2a241b1ed9bcffc19a02.tar.gz forums-e5a3bc03b492a573291e2a241b1ed9bcffc19a02.tar.bz2 forums-e5a3bc03b492a573291e2a241b1ed9bcffc19a02.tar.xz forums-e5a3bc03b492a573291e2a241b1ed9bcffc19a02.zip |
[feature/attach-dl] Consider that post_id can mean private message id as well.
PHPBB3-11042
Diffstat (limited to 'phpBB/download')
-rw-r--r-- | phpBB/download/file.php | 17 |
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; |