diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2012-12-13 19:19:40 -0600 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2012-12-13 19:19:40 -0600 |
commit | 249f3c8885d461ae3981dfd7b62093c2175175e3 (patch) | |
tree | b078403292276199d70e0b782b5ebea57285d6e2 /phpBB/includes/mcp | |
parent | 84284a9ccee7d5ccc658c3d1f751a5254b3b9175 (diff) | |
download | forums-249f3c8885d461ae3981dfd7b62093c2175175e3.tar forums-249f3c8885d461ae3981dfd7b62093c2175175e3.tar.gz forums-249f3c8885d461ae3981dfd7b62093c2175175e3.tar.bz2 forums-249f3c8885d461ae3981dfd7b62093c2175175e3.tar.xz forums-249f3c8885d461ae3981dfd7b62093c2175175e3.zip |
[ticket/11103] Instantiate $phpbb_notifications as needed
https://github.com/phpbb/phpbb3/pull/992#discussion_r2413976
PHPBB3-11103
Diffstat (limited to 'phpBB/includes/mcp')
-rw-r--r-- | phpBB/includes/mcp/mcp_pm_reports.php | 5 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 13 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_reports.php | 12 |
3 files changed, 20 insertions, 10 deletions
diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index 4ba1b2fd0c..db73506d1d 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -33,8 +33,7 @@ class mcp_pm_reports function main($id, $mode) { global $auth, $db, $user, $template, $cache; - global $config, $phpbb_root_path, $phpEx, $action; - global $phpbb_notifications; + global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container; include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); @@ -90,6 +89,8 @@ class mcp_pm_reports trigger_error('NO_REPORT'); } + $phpbb_notifications = $phpbb_container->get('notification_manager'); + $phpbb_notifications->mark_notifications_read_by_parent('report_pm', $report_id, $user->data['user_id']); $pm_id = $report['pm_id']; diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 4a3d443006..2a2146db71 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -33,8 +33,7 @@ class mcp_queue function main($id, $mode) { global $auth, $db, $user, $template, $cache; - global $config, $phpbb_root_path, $phpEx, $action; - global $phpbb_notifications; + global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container; include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); @@ -79,6 +78,8 @@ class mcp_queue $post_id = request_var('p', 0); $topic_id = request_var('t', 0); + $phpbb_notifications = $phpbb_container->get('notification_manager'); + if ($topic_id) { $topic_info = get_topic_data(array($topic_id), 'm_approve'); @@ -456,7 +457,7 @@ function approve_post($post_id_list, $id, $mode) { global $db, $template, $user, $config; global $phpEx, $phpbb_root_path; - global $request, $phpbb_notifications; + global $request, $phpbb_container; if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { @@ -605,6 +606,8 @@ function approve_post($post_id_list, $id, $mode) // Send out normal user notifications $email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']); + $phpbb_notifications = $phpbb_container->get('notification_manager'); + // Handle notifications foreach ($post_info as $post_id => $post_data) { @@ -722,7 +725,7 @@ function disapprove_post($post_id_list, $id, $mode) { global $db, $template, $user, $config; global $phpEx, $phpbb_root_path; - global $request, $phpbb_notifications; + global $request, $phpbb_container; if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { @@ -855,6 +858,8 @@ function disapprove_post($post_id_list, $id, $mode) } } + $phpbb_notifications = $phpbb_container->get('notification_manager'); + foreach ($post_info as $post_id => $post_data) { if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 85723ab3f7..91ff31c51c 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -33,8 +33,7 @@ class mcp_reports function main($id, $mode) { global $auth, $db, $user, $template, $cache; - global $config, $phpbb_root_path, $phpEx, $action; - global $phpbb_notifications; + global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container; include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); @@ -88,6 +87,8 @@ class mcp_reports trigger_error('NO_REPORT'); } + $phpbb_notifications = $phpbb_container->get('notification_manager'); + $phpbb_notifications->mark_notifications_read('report_post', $post_id, $user->data['user_id']); if (!$report_id && $report['report_closed']) @@ -446,8 +447,7 @@ class mcp_reports function close_report($report_id_list, $mode, $action, $pm = false) { global $db, $template, $user, $config, $auth; - global $phpEx, $phpbb_root_path; - global $phpbb_notifications; + global $phpEx, $phpbb_root_path, $phpbb_container; $pm_where = ($pm) ? ' AND r.post_id = 0 ' : ' AND r.pm_id = 0 '; $id_column = ($pm) ? 'pm_id' : 'post_id'; @@ -636,6 +636,8 @@ function close_report($report_id_list, $mode, $action, $pm = false) // Notify reporters if (sizeof($notify_reporters)) { + $phpbb_notifications = $phpbb_container->get('notification_manager'); + foreach ($notify_reporters as $report_id => $reporter) { if ($reporter['user_id'] == ANONYMOUS) @@ -652,6 +654,7 @@ function close_report($report_id_list, $mode, $action, $pm = false) 'closer_id' => $user->data['user_id'], 'from_user_id' => $post_info[$post_id]['author_id'], ))); + $phpbb_notifications->delete_notifications('report_pm', $post_id); } else @@ -660,6 +663,7 @@ function close_report($report_id_list, $mode, $action, $pm = false) 'reporter' => $reporter['user_id'], 'closer_id' => $user->data['user_id'], ))); + $phpbb_notifications->delete_notifications('report_post', $post_id); } } |