aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/common.php2
-rw-r--r--phpBB/includes/functions.php22
-rw-r--r--phpBB/includes/functions_admin.php10
-rw-r--r--phpBB/includes/functions_posting.php6
-rw-r--r--phpBB/includes/functions_privmsgs.php19
-rw-r--r--phpBB/includes/mcp/mcp_pm_reports.php5
-rw-r--r--phpBB/includes/mcp/mcp_queue.php13
-rw-r--r--phpBB/includes/mcp/mcp_reports.php12
-rw-r--r--phpBB/includes/ucp/ucp_notifications.php4
-rw-r--r--phpBB/index.php2
-rw-r--r--phpBB/report.php2
11 files changed, 65 insertions, 32 deletions
diff --git a/phpBB/common.php b/phpBB/common.php
index 88e758a004..e99b9edee5 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -125,8 +125,6 @@ $phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader');
$template = $phpbb_container->get('template');
$phpbb_style = $phpbb_container->get('style');
-$phpbb_notifications = $phpbb_container->get('notification_manager');
-
// Add own hook handler
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('phpbb_template', 'display')));
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 6f619ef51d..9b284c5ca9 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1328,7 +1328,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_notifications;
+ global $request, $phpbb_container;
$post_time = ($post_time === 0 || $post_time > time()) ? time() : (int) $post_time;
@@ -1338,6 +1338,8 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
{
// Mark all forums read (index page)
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
+
// Mark all topic notifications read for this user
$phpbb_notifications->mark_notifications_read(array(
'topic',
@@ -1402,6 +1404,8 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
$forum_id = array($forum_id);
}
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
+
$phpbb_notifications->mark_notifications_read_by_parent(array(
'topic',
'approve_topic',
@@ -1523,11 +1527,14 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
return;
}
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
+
// Mark post notifications read for this user in this topic
$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',
@@ -5042,7 +5049,7 @@ function phpbb_build_hidden_fields_for_query_params($request, $exclude = null)
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, $request, $phpbb_notifications;
+ global $phpbb_dispatcher, $request, $phpbb_container;
if (defined('HEADER_INC'))
{
@@ -5230,10 +5237,13 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
{
$timezone_name = $user->lang['timezones'][$timezone_name];
}
-
+
// Output the notifications
- if ($config['load_notifications'])
+ $notifications = false;
+ if ($config['load_notifications'] && $user->data['user_id'] != ANONYMOUS && $user->data['user_type'] != USER_IGNORE)
{
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
+
$notifications = $phpbb_notifications->load_notifications(array(
'all_unread' => true,
'limit' => 5,
@@ -5264,8 +5274,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread,
'HIDDEN_FIELDS_FOR_JUMPBOX' => $hidden_fields_for_jumpbox,
- 'UNREAD_NOTIFICATIONS_COUNT' => ($config['load_notifications']) ? $notifications['unread_count'] : '',
- 'NOTIFICATIONS_COUNT' => ($config['load_notifications']) ? $user->lang('NOTIFICATIONS_COUNT', $notifications['unread_count']) : '',
+ 'UNREAD_NOTIFICATIONS_COUNT' => ($notifications !== false) ? $notifications['unread_count'] : '',
+ 'NOTIFICATIONS_COUNT' => ($notifications !== false) ? $user->lang('NOTIFICATIONS_COUNT', $notifications['unread_count']) : '',
'U_VIEW_ALL_NOTIFICATIONS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_notifications'),
'S_NOTIFICATIONS_DISPLAY' => $config['load_notifications'],
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 69ca44861f..9310b218fb 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -618,8 +618,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_notifications;
+ global $db, $config, $phpbb_container;
$approved_topics = 0;
$forum_ids = $topic_ids = array();
@@ -716,6 +715,8 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s
set_config_count('num_topics', $approved_topics * (-1), true);
}
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
+
$phpbb_notifications->delete_notifications(array(
'topic',
'approve_topic',
@@ -730,8 +731,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_notifications;
+ global $db, $config, $phpbb_root_path, $phpEx, $auth, $user, $phpbb_container;
if ($where_type === 'range')
{
@@ -900,6 +900,8 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
delete_topics('topic_id', $remove_topics, $auto_sync, $post_count_sync, false);
}
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
+
$phpbb_notifications->delete_notifications(array(
'quote',
'bookmark',
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 8ba1fed6a7..1648228af5 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1410,8 +1410,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_notifications;
+ global $db, $auth, $user, $config, $phpEx, $template, $phpbb_root_path, $phpbb_container;
// We do not handle erasing posts here
if ($mode == 'delete')
@@ -2231,6 +2230,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
'post_subject' => $subject,
));
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
+
if ($post_approval)
{
switch ($mode)
@@ -2282,6 +2283,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
case 'edit':
case 'edit_last_post':
$phpbb_notifications->delete_notifications('topic', $data['topic_id']);
+
$phpbb_notifications->delete_notifications(array(
'quote',
'bookmark',
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);
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);
}
}
diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php
index 76fc411584..338c921e94 100644
--- a/phpBB/includes/ucp/ucp_notifications.php
+++ b/phpBB/includes/ucp/ucp_notifications.php
@@ -21,7 +21,7 @@ class ucp_notifications
public function main($id, $mode)
{
- global $config, $template, $user, $request, $phpbb_notifications;
+ global $config, $template, $user, $request, $phpbb_container;
global $phpbb_root_path, $phpEx;
add_form_key('ucp_notification');
@@ -29,6 +29,8 @@ class ucp_notifications
$start = $request->variable('start', 0);
$form_time = min($request->variable('form_time', 0), time());
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
+
switch ($mode)
{
case 'notification_options':
diff --git a/phpBB/index.php b/phpBB/index.php
index 5e76d653eb..74fc1b9bda 100644
--- a/phpBB/index.php
+++ b/phpBB/index.php
@@ -27,6 +27,8 @@ $user->setup('viewforum');
// Mark notifications read
if (($mark_notification = $request->variable('mark_notification', 0)))
{
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
+
$notification = $phpbb_notifications->load_notifications(array(
'notification_id' => $mark_notification
));
diff --git a/phpBB/report.php b/phpBB/report.php
index 07cec7afbc..f9f6b572ef 100644
--- a/phpBB/report.php
+++ b/phpBB/report.php
@@ -172,6 +172,8 @@ if ($submit && $reason_id)
$db->sql_query($sql);
$report_id = $db->sql_nextid();
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
+
if ($post_id)
{
$sql = 'UPDATE ' . POSTS_TABLE . '