mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[feature/attach-dl] Store query result always in $attachments first.
PHPBB3-11042
This commit is contained in:
parent
5986676f4d
commit
56cd7e5475
1 changed files with 6 additions and 5 deletions
|
@ -151,9 +151,6 @@ if (!$config['allow_attachments'] && !$config['allow_pm_attach'])
|
|||
trigger_error('ATTACHMENT_FUNCTIONALITY_DISABLED');
|
||||
}
|
||||
|
||||
$attachment = ($download_id) ? array() : false;
|
||||
$attachments = ($topic_id || $post_id) ? array() : false;
|
||||
|
||||
// If multiple arguments are provided, the precedence is as follows:
|
||||
// $download_id, $post_id, $topic_id
|
||||
if ($download_id)
|
||||
|
@ -162,7 +159,7 @@ if ($download_id)
|
|||
FROM ' . ATTACHMENTS_TABLE . " a
|
||||
WHERE a.attach_id = $download_id";
|
||||
$result = $db->sql_query($sql);
|
||||
$attachment = $db->sql_fetchrow($result);
|
||||
$attachments = $db->sql_fetchrowset($result);
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
else if ($post_id)
|
||||
|
@ -193,11 +190,15 @@ else
|
|||
trigger_error('NO_ATTACHMENT_SELECTED');
|
||||
}
|
||||
|
||||
if (!$attachment && !$attachments)
|
||||
if (empty($attachments))
|
||||
{
|
||||
send_status_line(404, 'Not Found');
|
||||
trigger_error('ERROR_NO_ATTACHMENT');
|
||||
}
|
||||
else if ($download_id)
|
||||
{
|
||||
$attachment = current($attachments);
|
||||
}
|
||||
|
||||
if ($attachment && ((!$attachment['in_message'] && !$config['allow_attachments']) || ($attachment['in_message'] && !$config['allow_pm_attach'])))
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue