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/functions_privmsgs.php | |
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/functions_privmsgs.php')
-rw-r--r-- | phpBB/includes/functions_privmsgs.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index ae8ffbe90e..14278a2529 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -876,7 +876,9 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id) return; } - global $db, $user, $phpbb_notifications; + global $db, $user, $phpbb_container; + + $phpbb_notifications = $phpbb_container->get('notification_manager'); $phpbb_notifications->mark_notifications_read('pm', $msg_id, $user_id); @@ -983,8 +985,7 @@ function handle_mark_actions($user_id, $mark_action) */ function delete_pm($user_id, $msg_ids, $folder_id) { - global $db, $user, $phpbb_root_path, $phpEx; - global $phpbb_notifications; + global $db, $user, $phpbb_root_path, $phpEx, $phpbb_container; $user_id = (int) $user_id; $folder_id = (int) $folder_id; @@ -1096,6 +1097,8 @@ function delete_pm($user_id, $msg_ids, $folder_id) $user->data['user_unread_privmsg'] -= $num_unread; } + $phpbb_notifications = $phpbb_container->get('notification_manager'); + $phpbb_notifications->delete_notifications('pm', array_keys($delete_rows)); // Now we have to check which messages we can delete completely @@ -1162,8 +1165,7 @@ function phpbb_delete_user_pms($user_id) */ function phpbb_delete_users_pms($user_ids) { - global $db, $user, $phpbb_root_path, $phpEx; - global $phpbb_notifications; + global $db, $user, $phpbb_root_path, $phpEx, $phpbb_container; $user_id_sql = $db->sql_in_set('user_id', $user_ids); $author_id_sql = $db->sql_in_set('author_id', $user_ids); @@ -1208,6 +1210,8 @@ function phpbb_delete_users_pms($user_ids) $db->sql_transaction('begin'); + $phpbb_notifications = $phpbb_container->get('notification_manager'); + if (!empty($undelivered_msg)) { // A pm is delivered, if for any recipient the message was moved @@ -1571,8 +1575,7 @@ function get_folder_status($folder_id, $folder) */ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) { - global $db, $auth, $config, $phpEx, $template, $user, $phpbb_root_path; - global $phpbb_notifications; + global $db, $auth, $config, $phpEx, $template, $user, $phpbb_root_path, $phpbb_container; // We do not handle erasing pms here if ($mode == 'delete') @@ -1877,6 +1880,8 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) 'recipients' => $recipients, )); + $phpbb_notifications = $phpbb_container->get('notification_manager'); + if ($mode == 'edit') { $phpbb_notifications->update_notifications('pm', $pm_data); |