class attachment extends controller

Controller for /download/attachment/{id} routes

Properties

protected service $cache from  controller
protected driver_interface $db from  controller
protected extension_guesser $extension_guesser from  controller
protected storage $storage from  controller
protected Request $symfony_request from  controller
protected auth $auth
protected config $config
protected content_visibility $content_visibility
protected dispatcher_interface $dispatcher
protected language $language
protected request $request
protected user $user

Methods

__construct(auth $auth, service $cache, config $config, content_visibility $content_visibility, driver_interface $db, dispatcher_interface $dispatcher, extension_guesser $extension_guesser, language $language, request $request, storage $storage, Request $symfony_request, user $user)

Constructor

Response
handle(string $file)

Handler

bool
is_allowed(string $file)

If the user is allowed to download the file

bool
file_exists(string $file)

Check if file exists

void
prepare(StreamedResponse $response, string $file)

Prepare response

void
file_gc()

Garbage Collection

Response
handle_attachment(int $id, string $filename)

Handle attachments

void
phpbb_download_handle_forum_auth(int $topic_id)

Handles authentication when downloading attachments from a post or topic

void
phpbb_download_handle_pm_auth(int $msg_id)

Handles authentication when downloading attachments from PMs

bool
phpbb_download_check_pm_auth(int $msg_id)

Checks whether a user can download from a particular PM

void
phpbb_increment_downloads(int $id)

Increments the download count of all provided attachments

Details

at line 77
__construct(auth $auth, service $cache, config $config, content_visibility $content_visibility, driver_interface $db, dispatcher_interface $dispatcher, extension_guesser $extension_guesser, language $language, request $request, storage $storage, Request $symfony_request, user $user)

Constructor

Parameters

auth $auth
service $cache
config $config
content_visibility $content_visibility
driver_interface $db
dispatcher_interface $dispatcher
extension_guesser $extension_guesser
language $language
request $request
storage $storage
Request $symfony_request
user $user

in controller at line 73
Response handle(string $file)

Handler

Parameters

string $file

File path

Return Value

Response

a Symfony response object

Exceptions

http_exception
storage_exception

in controller at line 104
protected bool is_allowed(string $file)

If the user is allowed to download the file

Parameters

string $file

File path

Return Value

bool

in controller at line 116
protected bool file_exists(string $file)

Check if file exists

Parameters

string $file

File path

Return Value

bool

at line 306
protected void prepare(StreamedResponse $response, string $file)

Prepare response

Parameters

StreamedResponse $response
string $file

File path

Return Value

void

Exceptions

storage_exception

in controller at line 186
protected void file_gc()

Garbage Collection

Return Value

void

at line 96
Response handle_attachment(int $id, string $filename)

Handle attachments

Parameters

int $id

File ID

string $filename Filename

Return Value

Response

at line 296
protected filenameFallback($filename)

at line 322
protected void phpbb_download_handle_forum_auth(int $topic_id)

Handles authentication when downloading attachments from a post or topic

Parameters

int $topic_id

The id of the topic that we are downloading from

Return Value

void

Exceptions

http_exception

at line 365
protected void phpbb_download_handle_pm_auth(int $msg_id)

Handles authentication when downloading attachments from PMs

Parameters

int $msg_id

The id of the PM that we are downloading from

Return Value

void

Exceptions

http_exception

at line 399
protected bool phpbb_download_check_pm_auth(int $msg_id)

Checks whether a user can download from a particular PM

Parameters

int $msg_id

The id of the PM that we are downloading from

Return Value

bool

Whether the user is allowed to download from that PM or not

at line 425
protected void phpbb_increment_downloads(int $id)

Increments the download count of all provided attachments

Parameters

int $id

The attach_id of the attachment

Return Value

void

at line 437
protected bool download_allowed()

Return Value

bool