diff options
author | Marc Alexander <admin@m-a-styles.de> | 2015-09-23 10:43:33 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2015-10-09 10:18:40 +0200 |
commit | 98ebbbdca2b7a57136745354b204d9aef181df4a (patch) | |
tree | d6848504160f12e7762b472015c05fdfbce8459c /phpBB/includes | |
parent | 04786313892df25f5adce555ebae6b2e5ad4d222 (diff) | |
download | forums-98ebbbdca2b7a57136745354b204d9aef181df4a.tar forums-98ebbbdca2b7a57136745354b204d9aef181df4a.tar.gz forums-98ebbbdca2b7a57136745354b204d9aef181df4a.tar.bz2 forums-98ebbbdca2b7a57136745354b204d9aef181df4a.tar.xz forums-98ebbbdca2b7a57136745354b204d9aef181df4a.zip |
[ticket/14168] No longer use deprecated functions in core files
PHPBB3-14168
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_attachments.php | 10 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_forums.php | 7 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_users.php | 10 | ||||
-rw-r--r-- | phpBB/includes/functions_admin.php | 5 | ||||
-rw-r--r-- | phpBB/includes/functions_privmsgs.php | 20 | ||||
-rw-r--r-- | phpBB/includes/message_parser.php | 9 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_attachments.php | 10 |
7 files changed, 42 insertions, 29 deletions
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 7ff9846a75..49b8ea462c 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -39,6 +39,9 @@ class acp_attachments /** @var \phpbb\filesystem\filesystem_interface */ protected $filesystem; + /** @var \phpbb\attachment\delete */ + protected $attachment_delete; + public $id; public $u_action; protected $new_config; @@ -55,6 +58,7 @@ class acp_attachments $this->user = $user; $this->phpbb_container = $phpbb_container; $this->filesystem = $phpbb_filesystem; + $this->attachment_delete = $phpbb_container->get('attachment.delete'); $user->add_lang(array('posting', 'viewtopic', 'acp/attachments')); @@ -922,11 +926,11 @@ class acp_attachments $delete_files = array(); while ($row = $db->sql_fetchrow($result)) { - phpbb_unlink($row['physical_filename'], 'file'); + $this->attachment_delete->unlink_attachment($row['physical_filename'], 'file'); if ($row['thumbnail']) { - phpbb_unlink($row['physical_filename'], 'thumbnail'); + $this->attachment_delete->unlink_attachment($row['physical_filename'], 'thumbnail'); } $delete_files[$row['attach_id']] = $row['real_filename']; @@ -1091,7 +1095,7 @@ class acp_attachments } $db->sql_freeresult($result); - if ($num_deleted = delete_attachments('attach', $delete_files)) + if ($num_deleted = $this->attachment_delete->delete('attach', $delete_files)) { if (sizeof($delete_files) != $num_deleted) { diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index f252f2a594..905a885a56 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1788,7 +1788,7 @@ class acp_forums */ function delete_forum_content($forum_id) { - global $db, $config, $phpbb_root_path, $phpEx, $phpbb_dispatcher; + global $db, $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher; include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); @@ -1809,7 +1809,10 @@ class acp_forums } $db->sql_freeresult($result); - delete_attachments('topic', $topic_ids, false); + /** @var \phpbb\attachment\delete $attachment_delete */ + $attachment_delete = $phpbb_container->get('attachment.delete'); + $attachment_delete->delete('topic', $topic_ids, false); + unset($attachment_delete); // Delete shadow topics pointing to topics in this forum delete_topic_shadows($forum_id); diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 857c625867..ab0eda507e 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -543,7 +543,10 @@ class acp_users if (confirm_box(true)) { - delete_attachments('user', $user_id); + /** @var \phpbb\attachment\delete $attachment_delete */ + $attachment_delete = $phpbb_container->get('attachment.delete'); + $attachment_delete->delete('user', $user_id); + unset($attachment_delete); $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_ATTACH', false, array($user_row['username'])); trigger_error($user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); @@ -2126,7 +2129,10 @@ class acp_users } $db->sql_freeresult($result); - delete_attachments('attach', $marked); + /** @var \phpbb\attachment\delete $attachment_delete */ + $attachment_delete = $phpbb_container->get('attachment.delete'); + $attachment_delete->delete('attach', $marked); + unset($attachment_delete); $message = (sizeof($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']; diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 8928aeb2d6..c267577117 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1024,7 +1024,10 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = $search->index_remove($post_ids, $poster_ids, $forum_ids); - delete_attachments('post', $post_ids, false); + /** @var \phpbb\attachment\delete $attachment_delete */ + $attachment_delete = $phpbb_container->get('attachment.delete'); + $attachment_delete->delete('post', $post_ids, false); + unset($attachment_delete); /** * Perform additional actions during post(s) deletion diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 7b6540cda7..fa84a5ed3c 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1153,12 +1153,10 @@ function delete_pm($user_id, $msg_ids, $folder_id) if (sizeof($delete_ids)) { // Check if there are any attachments we need to remove - if (!function_exists('delete_attachments')) - { - include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); - } - - delete_attachments('message', $delete_ids, false); + /** @var \phpbb\attachment\delete $attachment_delete */ + $attachment_delete = $phpbb_container->get('attachment.delete'); + $attachment_delete->delete('message', $delete_ids, false); + unset($attachment_delete); $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' WHERE ' . $db->sql_in_set('msg_id', $delete_ids); @@ -1363,12 +1361,10 @@ function phpbb_delete_users_pms($user_ids) if (!empty($delete_ids)) { // Check if there are any attachments we need to remove - if (!function_exists('delete_attachments')) - { - include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); - } - - delete_attachments('message', $delete_ids, false); + /** @var \phpbb\attachment\delete $attachment_delete */ + $attachment_delete = $phpbb_container->get('attachment.delete'); + $attachment_delete->delete('message', $delete_ids, false); + unset($attachment_delete); $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' WHERE ' . $db->sql_in_set('msg_id', $delete_ids); diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index a56ef0d4a9..05ab115141 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1643,6 +1643,9 @@ class parse_message extends bbcode_firstpass if ($index !== false && !empty($this->attachment_data[$index])) { + /** @var \phpbb\attachment\delete $attachment_delete */ + $attachment_delete = $phpbb_container->get('attachment.delete'); + // delete selected attachment if ($this->attachment_data[$index]['is_orphan']) { @@ -1657,11 +1660,11 @@ class parse_message extends bbcode_firstpass if ($row) { - phpbb_unlink($row['physical_filename'], 'file'); + $attachment_delete->unlink_attachment($row['physical_filename'], 'file'); if ($row['thumbnail']) { - phpbb_unlink($row['physical_filename'], 'thumbnail'); + $attachment_delete->unlink_attachment($row['physical_filename'], 'thumbnail'); } $db->sql_query('DELETE FROM ' . ATTACHMENTS_TABLE . ' WHERE attach_id = ' . (int) $this->attachment_data[$index]['attach_id']); @@ -1669,7 +1672,7 @@ class parse_message extends bbcode_firstpass } else { - delete_attachments('attach', array(intval($this->attachment_data[$index]['attach_id']))); + $attachment_delete->delete('attach', $this->attachment_data[$index]['attach_id']); } unset($this->attachment_data[$index]); diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php index 639f308091..64cad1aa90 100644 --- a/phpBB/includes/ucp/ucp_attachments.php +++ b/phpBB/includes/ucp/ucp_attachments.php @@ -70,12 +70,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\delete $attachment_delete */ + $attachment_delete = $phpbb_container->get('attachment.delete'); + $attachment_delete->delete('attach', $delete_ids); + unset($attachment_delete); 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>'); |