mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
Merge pull request #5274 from rubencm/ticket/14285
[ticket/14285] Move downloads to controller
This commit is contained in:
@@ -14,6 +14,16 @@
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
use phpbb\attachment\manager;
|
||||
use phpbb\config\config;
|
||||
use phpbb\controller\helper;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
use phpbb\filesystem\filesystem_interface;
|
||||
use phpbb\language\language;
|
||||
use phpbb\template\template;
|
||||
use phpbb\user;
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
@@ -21,30 +31,33 @@ if (!defined('IN_PHPBB'))
|
||||
|
||||
class acp_attachments
|
||||
{
|
||||
/** @var \phpbb\db\driver\driver_interface */
|
||||
/** @var driver_interface */
|
||||
protected $db;
|
||||
|
||||
/** @var \phpbb\config\config */
|
||||
/** @var config */
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\language\language */
|
||||
/** @var language */
|
||||
protected $language;
|
||||
|
||||
/** @var ContainerBuilder */
|
||||
protected $phpbb_container;
|
||||
|
||||
/** @var \phpbb\template\template */
|
||||
/** @var template */
|
||||
protected $template;
|
||||
|
||||
/** @var \phpbb\user */
|
||||
/** @var user */
|
||||
protected $user;
|
||||
|
||||
/** @var \phpbb\filesystem\filesystem_interface */
|
||||
/** @var filesystem_interface */
|
||||
protected $filesystem;
|
||||
|
||||
/** @var \phpbb\attachment\manager */
|
||||
/** @var manager */
|
||||
protected $attachment_manager;
|
||||
|
||||
/** @var helper */
|
||||
protected $controller_helper;
|
||||
|
||||
public $id;
|
||||
public $u_action;
|
||||
protected $new_config;
|
||||
@@ -63,6 +76,7 @@ class acp_attachments
|
||||
$this->phpbb_container = $phpbb_container;
|
||||
$this->filesystem = $phpbb_filesystem;
|
||||
$this->attachment_manager = $phpbb_container->get('attachment.manager');
|
||||
$this->controller_helper = $phpbb_container->get('controller.helper');
|
||||
|
||||
$user->add_lang(array('posting', 'viewtopic', 'acp/attachments'));
|
||||
|
||||
@@ -1082,8 +1096,8 @@ class acp_attachments
|
||||
'PHYSICAL_FILENAME' => utf8_basename($row['physical_filename']),
|
||||
'ATTACH_ID' => $row['attach_id'],
|
||||
'POST_IDS' => (!empty($post_ids[$row['attach_id']])) ? $post_ids[$row['attach_id']] : '',
|
||||
'U_FILE' => append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'mode=view&id=' . $row['attach_id']))
|
||||
);
|
||||
'U_FILE' => $this->controller_helper->route('phpbb_storage_attachment', ['file' => (int) $row['attach_id']])
|
||||
));
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
@@ -1270,8 +1284,8 @@ class acp_attachments
|
||||
'S_IN_MESSAGE' => (bool) $row['in_message'],
|
||||
|
||||
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_id']}&p={$row['post_msg_id']}") . "#p{$row['post_msg_id']}",
|
||||
'U_FILE' => append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'mode=view&id=' . $row['attach_id']))
|
||||
);
|
||||
'U_FILE' => $this->controller_helper->route('phpbb_storage_attachment', ['file' => $row['attach_id']])
|
||||
));
|
||||
}
|
||||
|
||||
break;
|
||||
|
@@ -14,6 +14,9 @@
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
|
||||
use phpbb\controller\helper;
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
@@ -36,6 +39,9 @@ class acp_users
|
||||
global $phpbb_dispatcher, $request;
|
||||
global $phpbb_container, $phpbb_log;
|
||||
|
||||
/** @var helper $controller_helper */
|
||||
$controller_helper = $phpbb_container->get('controller.helper');
|
||||
|
||||
$user->add_lang(array('posting', 'ucp', 'acp/users'));
|
||||
$this->tpl_name = 'acp_users';
|
||||
|
||||
@@ -2126,9 +2132,6 @@ class acp_users
|
||||
$decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_flags);
|
||||
}
|
||||
|
||||
/** @var \phpbb\controller\helper $controller_helper */
|
||||
$controller_helper = $phpbb_container->get('controller.helper');
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_SIGNATURE' => true,
|
||||
|
||||
@@ -2298,7 +2301,7 @@ class acp_users
|
||||
|
||||
'S_IN_MESSAGE' => $row['in_message'],
|
||||
|
||||
'U_DOWNLOAD' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'mode=view&id=' . $row['attach_id']),
|
||||
'U_DOWNLOAD' => $controller_helper->route('phpbb_storage_attachment', ['file' => (int) $row['attach_id']]),
|
||||
'U_VIEW_TOPIC' => $view_topic)
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user