aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/ucp/ucp_attachments.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/ucp/ucp_attachments.php')
-rw-r--r--phpBB/includes/ucp/ucp_attachments.php22
1 files changed, 10 insertions, 12 deletions
diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php
index 42724209aa..66c3109b3d 100644
--- a/phpBB/includes/ucp/ucp_attachments.php
+++ b/phpBB/includes/ucp/ucp_attachments.php
@@ -29,15 +29,14 @@ class ucp_attachments
function main($id, $mode)
{
- global $template, $user, $db, $config, $phpEx, $phpbb_root_path, $phpbb_container;
+ global $template, $user, $db, $config, $phpEx, $phpbb_root_path, $phpbb_container, $request;
- $start = request_var('start', 0);
- $sort_key = request_var('sk', 'a');
- $sort_dir = request_var('sd', 'a');
+ $start = $request->variable('start', 0);
+ $sort_key = $request->variable('sk', 'a');
+ $sort_dir = $request->variable('sd', 'a');
$delete = (isset($_POST['delete'])) ? true : false;
- $confirm = (isset($_POST['confirm'])) ? true : false;
- $delete_ids = array_keys(request_var('attachment', array(0)));
+ $delete_ids = array_keys($request->variable('attachment', array(0)));
if ($delete && sizeof($delete_ids))
{
@@ -70,12 +69,10 @@ class ucp_attachments
if (confirm_box(true))
{
- if (!function_exists('delete_attachments'))
- {
- include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
- }
-
- delete_attachments('attach', $delete_ids);
+ /** @var \phpbb\attachment\manager $attachment_manager */
+ $attachment_manager = $phpbb_container->get('attachment.manager');
+ $attachment_manager->delete('attach', $delete_ids);
+ unset($attachment_manager);
meta_refresh(3, $this->u_action);
$message = ((sizeof($delete_ids) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']) . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
@@ -123,6 +120,7 @@ class ucp_attachments
$db->sql_freeresult($result);
// Ensure start is a valid value
+ /* @var $pagination \phpbb\pagination */
$pagination = $phpbb_container->get('pagination');
$start = $pagination->validate_start($start, $config['topics_per_page'], $num_attachments);