1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

Merge pull request #6500 from marc1706/ticket/15687

[ticket/15687] Add attachment filename to attachment URL
This commit is contained in:
Marc Alexander
2023-07-26 15:19:36 +02:00
committed by GitHub
10 changed files with 78 additions and 17 deletions

View File

@@ -86,11 +86,14 @@ class attachment extends controller
}
/**
* {@inheritdoc}
* Handle attachments
*
* @param int $id File ID
* @param string $filename Filename
*/
public function handle(string $file): Response
public function handle_attachment(int $id, string $filename): Response
{
$attach_id = (int) $file;
$attach_id = $id;
$thumbnail = $this->request->variable('t', false);
$this->language->add_lang('viewtopic');
@@ -109,7 +112,8 @@ class attachment extends controller
is_orphan, physical_filename, real_filename, extension, mimetype,
filesize, filetime
FROM ' . ATTACHMENTS_TABLE . "
WHERE attach_id = $attach_id";
WHERE attach_id = $attach_id" .
(($filename) ? " AND real_filename = '" . $this->db->sql_escape($filename) . "'" : '');
$result = $this->db->sql_query($sql);
$attachment = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);