diff options
-rw-r--r-- | phpBB/common.php | 3 | ||||
-rw-r--r-- | phpBB/config/services.yml | 2 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 8 | ||||
-rw-r--r-- | phpBB/includes/functions_admin.php | 6 | ||||
-rw-r--r-- | phpBB/includes/functions_posting.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions_privmsgs.php | 35 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 6 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_notifications.php | 7 | ||||
-rw-r--r-- | phpBB/index.php | 3 |
9 files changed, 28 insertions, 46 deletions
diff --git a/phpBB/common.php b/phpBB/common.php index c6bb5c6cfe..8035b31d49 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -125,6 +125,9 @@ $phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader'); $template = $phpbb_container->get('template'); $phpbb_style = $phpbb_container->get('style'); +// Notifications manager +$phpbb_notifications = $phpbb_container->get('notification_manager'); + $ids = array_keys($phpbb_container->findTaggedServiceIds('container.processor')); foreach ($ids as $id) { diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index f9ae35ba57..4ae519091b 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -89,7 +89,7 @@ services: - .%core.php_ext% - @cache.driver - notifications: + notification_manager: class: phpbb_notification_manager arguments: - @dbal.conn diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index d005ccaaab..9513c6919f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1285,7 +1285,7 @@ function phpbb_timezone_select($user, $default = '', $truncate = false) function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $user_id = 0) { global $db, $user, $config; - global $request, $phpbb_container; + global $request, $phpbb_notifications; if ($mode == 'all') { @@ -1294,7 +1294,6 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ // Mark all forums read (index page) // Mark all topic notifications read for this user - $phpbb_notifications = $phpbb_container->get('notifications'); $phpbb_notifications->mark_notifications_read(array('topic', 'quote', 'bookmark', 'post', 'approve_topic', 'approve_post'), false, $user->data['user_id'], $post_time); if ($config['load_db_lastread'] && $user->data['is_registered']) @@ -1336,7 +1335,6 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } // Mark topic notifications read for this user in this forum - $phpbb_notifications = $phpbb_container->get('notifications'); $phpbb_notifications->mark_notifications_read_by_parent(array('topic', 'approve_topic'), $forum_id, $user->data['user_id'], $post_time); // Mark all post/quote notifications read for this user in this forum @@ -1448,7 +1446,6 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } // Mark post notifications read for this user in this topic - $phpbb_notifications = $phpbb_container->get('notifications'); $phpbb_notifications->mark_notifications_read(array('topic', 'approve_topic'), $topic_id, $user->data['user_id'], $post_time); $phpbb_notifications->mark_notifications_read_by_parent(array('quote', 'bookmark', 'post', 'approve_post'), $topic_id, $user->data['user_id'], $post_time); @@ -4806,7 +4803,7 @@ function phpbb_http_login($param) function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum') { global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path; - global $phpbb_dispatcher, $phpbb_container; + global $phpbb_dispatcher, $phpbb_notifications; if (defined('HEADER_INC')) { @@ -4996,7 +4993,6 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 } // Output the notifications - $phpbb_notifications = $phpbb_container->get('notifications'); $notifications = $phpbb_notifications->load_notifications(array( 'all_unread' => true, 'limit' => 5, diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 27128aafac..3deb2e9c59 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -619,7 +619,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_sync = true, $call_delete_posts = true) { global $db, $config; - global $phpbb_container; + global $phpbb_notifications; $approved_topics = 0; $forum_ids = $topic_ids = array(); @@ -717,7 +717,6 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s } // Delete notifications - $phpbb_notifications = $phpbb_container->get('notifications'); $phpbb_notifications->delete_notifications(array('topic', 'approve_topic', 'topic_in_queue'), $topic_ids); return $return; @@ -729,7 +728,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true, $post_count_sync = true, $call_delete_topics = true) { global $db, $config, $phpbb_root_path, $phpEx, $auth, $user; - global $phpbb_container; + global $phpbb_notifications; if ($where_type === 'range') { @@ -899,7 +898,6 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = } // Delete notifications - $phpbb_notifications = $phpbb_container->get('notifications'); $phpbb_notifications->delete_notifications(array('quote', 'bookmark', 'post', 'approve_post', 'post_in_queue'), $post_ids); return sizeof($post_ids); diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 6262cee4ad..3658757e5e 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1409,7 +1409,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data) function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $update_message = true, $update_search_index = true) { global $db, $auth, $user, $config, $phpEx, $template, $phpbb_root_path; - global $phpbb_container; + global $phpbb_notifications; // We do not handle erasing posts here if ($mode == 'delete') @@ -2220,7 +2220,6 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } // Send Notifications - $phpbb_notifications = $phpbb_container->get('notifications'); $notification_data = array_merge($data, array( 'topic_title' => (isset($data['topic_title'])) ? $data['topic_title'] : $subject, 'post_username' => $username, @@ -2229,6 +2228,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'post_time' => $current_time, 'post_subject' => $subject, )); + if ($post_approval) { switch ($mode) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 8545cc7ef5..6c31c6d6c3 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -269,46 +269,46 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id) case RULE_IS_LIKE: $result = preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0); break; - + case RULE_IS_NOT_LIKE: $result = !preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0); break; - + case RULE_IS: $result = ($check0 == $rule_row['rule_string']); break; - + case RULE_IS_NOT: $result = ($check0 != $rule_row['rule_string']); break; - + case RULE_BEGINS_WITH: $result = preg_match("/^" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0); break; - + case RULE_ENDS_WITH: $result = preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '$/i', $check0); break; - + case RULE_IS_FRIEND: case RULE_IS_FOE: case RULE_ANSWERED: case RULE_FORWARDED: $result = ($check0 == 1); break; - + case RULE_IS_USER: $result = ($check0 == $rule_row['rule_user_id']); break; - + case RULE_IS_GROUP: $result = in_array($rule_row['rule_group_id'], $check0); break; - + case RULE_TO_GROUP: $result = (in_array('g_' . $message_row[$check_ary['check2']], $check0) || in_array('g_' . $message_row[$check_ary['check2']], $message_row[$check_ary['check1']])); break; - + case RULE_TO_ME: $result = (in_array('u_' . $user_id, $check0) || in_array('u_' . $user_id, $message_row[$check_ary['check1']])); break; @@ -876,10 +876,9 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id) return; } - global $db, $user, $phpbb_container; + global $db, $user, $phpbb_notifications; // Mark the PM as read - $phpbb_notifications = $phpbb_container->get('notifications'); $phpbb_notifications->mark_notifications_read('pm', $msg_id, $user_id); $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . " @@ -986,7 +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_container; + global $phpbb_notifications; $user_id = (int) $user_id; $folder_id = (int) $folder_id; @@ -1099,7 +1098,6 @@ function delete_pm($user_id, $msg_ids, $folder_id) } // Delete Notifications - $phpbb_notifications = $phpbb_container->get('notifications'); $phpbb_notifications->delete_notifications('pm', array_keys($delete_rows)); // Now we have to check which messages we can delete completely @@ -1146,7 +1144,7 @@ function delete_pm($user_id, $msg_ids, $folder_id) function phpbb_delete_user_pms($user_id) { global $db, $user, $phpbb_root_path, $phpEx; - global $phpbb_container; + global $phpbb_notifications; $user_id = (int) $user_id; @@ -1265,7 +1263,6 @@ function phpbb_delete_user_pms($user_id) $db->sql_query($sql); // Delete Notifications - $phpbb_notifications = $phpbb_container->get('notifications'); $phpbb_notifications->delete_notifications('pm', $delivered_msg); } @@ -1280,7 +1277,6 @@ function phpbb_delete_user_pms($user_id) $db->sql_query($sql); // Delete Notifications - $phpbb_notifications = $phpbb_container->get('notifications'); $phpbb_notifications->delete_notifications('pm', $undelivered_msg); } } @@ -1326,7 +1322,6 @@ function phpbb_delete_user_pms($user_id) $db->sql_query($sql); // Delete Notifications - $phpbb_notifications = $phpbb_container->get('notifications'); $phpbb_notifications->delete_notifications('pm', $delete_ids); } } @@ -1565,7 +1560,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_container; + global $phpbb_notifications; // We do not handle erasing pms here if ($mode == 'delete') @@ -1865,8 +1860,6 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) $db->sql_transaction('commit'); // Send Notifications - $phpbb_notifications = $phpbb_container->get('notifications'); - $pm_data = array_merge($data, array( 'message_subject' => $subject, 'recipients' => $recipients, diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 1d2caa38d5..77e778fc38 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -451,7 +451,7 @@ function approve_post($post_id_list, $id, $mode) { global $db, $template, $user, $config; global $phpEx, $phpbb_root_path; - global $request, $phpbb_container; + global $request, $phpbb_notifications; if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { @@ -601,7 +601,6 @@ function approve_post($post_id_list, $id, $mode) $email_sig = str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']); // Handle notifications - $phpbb_notifications = $phpbb_container->get('notifications'); 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']) @@ -720,7 +719,7 @@ function disapprove_post($post_id_list, $id, $mode) { global $db, $template, $user, $config; global $phpEx, $phpbb_root_path; - global $request, $phpbb_container; + global $request, $phpbb_notifications; if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { @@ -854,7 +853,6 @@ function disapprove_post($post_id_list, $id, $mode) } // Handle notifications (topic/post in queue) - $phpbb_notifications = $phpbb_container->get('notifications'); 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/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php index d248099b06..9ea44f49bf 100644 --- a/phpBB/includes/ucp/ucp_notifications.php +++ b/phpBB/includes/ucp/ucp_notifications.php @@ -21,15 +21,10 @@ class ucp_notifications public function main($id, $mode) { - global $phpbb_container; + global $template, $user, $request, $phpbb_notifications; add_form_key('ucp_notification_options'); - $phpbb_notifications = $phpbb_container->get('notifications'); - $template = $phpbb_container->get('template'); - $user = $phpbb_container->get('user'); - $request = $phpbb_container->get('request'); - $subscriptions = $phpbb_notifications->get_subscriptions(false, true); // Add/remove subscriptions diff --git a/phpBB/index.php b/phpBB/index.php index 38eeb2514e..af0441f5e3 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -31,7 +31,7 @@ if ($ext = $request->variable('ext', '')) if (!$phpbb_extension_manager->available($ext)) { send_status_line(404, 'Not Found'); - trigger_error($user->lang('EXTENSION_DOES_NOT_EXIST', $ext)); + trigger_error($user->lang('EXTENSION_DOES_NOT_EXIST', $ext)); } else if (!$phpbb_extension_manager->enabled($ext)) { @@ -60,7 +60,6 @@ if ($ext = $request->variable('ext', '')) $mark_notifications = request_var('mark_notification', array(0)); if (!empty($mark_notifications)) { - $phpbb_notifications = $phpbb_container->get('notifications'); $phpbb_notifications->mark_notifications_read_by_id($mark_notifications); } |