mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[feature/attach-dl] Consider that post_id can mean private message id as well.
PHPBB3-11042
This commit is contained in:
parent
7bd81cd0cd
commit
e5a3bc03b4
1 changed files with 13 additions and 4 deletions
|
@ -343,9 +343,18 @@ else
|
||||||
|
|
||||||
if ($post_id)
|
if ($post_id)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT post_subject
|
if ($attachment['in_message'])
|
||||||
FROM ' . POSTS_TABLE . "
|
{
|
||||||
WHERE post_id = $post_id";
|
$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
|
else
|
||||||
{
|
{
|
||||||
|
@ -359,7 +368,7 @@ else
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$bad_chars = array("'", "\\", ' ', '/', ':', '*', '?', '"', '<', '>', '|');
|
$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 = rawurlencode(str_replace($bad_chars, '_', strtolower($clean_name)));
|
||||||
$clean_name = preg_replace("/%(\w{2})/", '_', $clean_name);
|
$clean_name = preg_replace("/%(\w{2})/", '_', $clean_name);
|
||||||
$suffix = '_' . (($post_id) ? $post_id : $topic_id) . '_' . $clean_name;
|
$suffix = '_' . (($post_id) ? $post_id : $topic_id) . '_' . $clean_name;
|
||||||
|
|
Loading…
Add table
Reference in a new issue