mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/14285] Add prefix in routing
PHPBB3-14285
This commit is contained in:
parent
31ca404ff7
commit
1e624bef15
4 changed files with 15 additions and 60 deletions
|
@ -33,3 +33,4 @@ phpbb_ucp_routing:
|
|||
|
||||
phpbb_storage_routing:
|
||||
resource: storage.yml
|
||||
prefix: /download
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
phpbb_storage_avatar:
|
||||
path: /download/avatar/{file}
|
||||
path: /avatar/{file}
|
||||
defaults:
|
||||
_controller: storage.controller.avatar:handle
|
||||
|
||||
phpbb_storage_attachment:
|
||||
path: /download/attachment/{id}
|
||||
path: /attachment/{id}
|
||||
defaults:
|
||||
_controller: storage.controller.attachment:handle
|
||||
requirements:
|
||||
|
|
|
@ -967,52 +967,3 @@ function wrap_img_in_html($src, $title)
|
|||
echo '</body>';
|
||||
echo '</html>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Garbage Collection
|
||||
*
|
||||
* @param bool $exit Whether to die or not.
|
||||
*
|
||||
* @return null
|
||||
*
|
||||
* @deprecated: 3.3.0-dev (To be removed: 4.0.0)
|
||||
*/
|
||||
function file_gc($exit = true)
|
||||
{
|
||||
global $cache, $db;
|
||||
|
||||
if (!empty($cache))
|
||||
{
|
||||
$cache->unload();
|
||||
}
|
||||
|
||||
$db->sql_close();
|
||||
|
||||
if ($exit)
|
||||
{
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the browser is internet explorer version 7+
|
||||
*
|
||||
* @param string $user_agent User agent HTTP header
|
||||
* @param int $version IE version to check against
|
||||
*
|
||||
* @return bool true if internet explorer version is greater than $version
|
||||
*
|
||||
* @deprecated: 3.3.0-dev (To be removed: 4.0.0)
|
||||
*/
|
||||
function phpbb_is_greater_ie_version($user_agent, $version)
|
||||
{
|
||||
if (preg_match('/msie (\d+)/', strtolower($user_agent), $matches))
|
||||
{
|
||||
$ie_version = (int) $matches[1];
|
||||
return ($ie_version > $version);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ class attachment extends controller
|
|||
if ($attachment['is_orphan'])
|
||||
{
|
||||
// We allow admins having attachment permissions to see orphan attachments...
|
||||
$own_attachment = ($this->auth->acl_get('a_attach') || $attachment['poster_id'] == $this->user->data['user_id']) ? true : false;
|
||||
$own_attachment = $this->auth->acl_get('a_attach') || $attachment['poster_id'] == $this->user->data['user_id'];
|
||||
|
||||
if (!$own_attachment || ($attachment['in_message'] && !$this->auth->acl_get('u_pm_download')) ||
|
||||
(!$attachment['in_message'] && !$this->auth->acl_get('u_download')))
|
||||
|
@ -301,9 +301,11 @@ class attachment extends controller
|
|||
*
|
||||
* @param int $topic_id The id of the topic that we are downloading from
|
||||
*
|
||||
* @return null
|
||||
* @return void
|
||||
* @throws http_exception If attachment is not found
|
||||
* If user don't have permission to download the attachment
|
||||
*/
|
||||
protected function phpbb_download_handle_forum_auth($topic_id)
|
||||
protected function phpbb_download_handle_forum_auth($topic_id): void
|
||||
{
|
||||
$sql_array = array(
|
||||
'SELECT' => 't.topic_visibility, t.forum_id, f.forum_name, f.forum_password, f.parent_id',
|
||||
|
@ -343,9 +345,10 @@ class attachment extends controller
|
|||
*
|
||||
* @param int $msg_id The id of the PM that we are downloading from
|
||||
*
|
||||
* @return null
|
||||
* @return void
|
||||
* @throws http_exception If attachment is not found
|
||||
*/
|
||||
protected function phpbb_download_handle_pm_auth($msg_id)
|
||||
protected function phpbb_download_handle_pm_auth(int $msg_id): void
|
||||
{
|
||||
if (!$this->auth->acl_get('u_pm_download'))
|
||||
{
|
||||
|
@ -379,7 +382,7 @@ class attachment extends controller
|
|||
*
|
||||
* @return bool Whether the user is allowed to download from that PM or not
|
||||
*/
|
||||
protected function phpbb_download_check_pm_auth($msg_id)
|
||||
protected function phpbb_download_check_pm_auth(int $msg_id): bool
|
||||
{
|
||||
$user_id = $this->user->data['user_id'];
|
||||
|
||||
|
@ -403,9 +406,9 @@ class attachment extends controller
|
|||
*
|
||||
* @param array|int $ids The attach_id of each attachment
|
||||
*
|
||||
* @return null
|
||||
* @return void
|
||||
*/
|
||||
protected function phpbb_increment_downloads($ids)
|
||||
protected function phpbb_increment_downloads($ids): void
|
||||
{
|
||||
if (!is_array($ids))
|
||||
{
|
||||
|
@ -422,7 +425,7 @@ class attachment extends controller
|
|||
* Check if downloading item is allowed
|
||||
* FIXME (See: https://tracker.phpbb.com/browse/PHPBB3-15264 and http://area51.phpbb.com/phpBB/viewtopic.php?f=81&t=51921)
|
||||
*/
|
||||
protected function download_allowed()
|
||||
protected function download_allowed(): bool
|
||||
{
|
||||
if (!$this->config['secure_downloads'])
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue