aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/index.php')
-rw-r--r--phpBB/index.php44
1 files changed, 32 insertions, 12 deletions
diff --git a/phpBB/index.php b/phpBB/index.php
index 74fc1b9bda..e3cae26779 100644
--- a/phpBB/index.php
+++ b/phpBB/index.php
@@ -27,24 +27,44 @@ $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
- ));
+ if ($user->data['user_id'] == ANONYMOUS)
+ {
+ if ($request->is_ajax())
+ {
+ trigger_error('LOGIN_REQUIRED');
+ }
+ login_box('', $user->lang['LOGIN_REQUIRED']);
+ }
- if (isset($notification['notifications'][$mark_notification]))
+ if (check_link_hash($request->variable('hash', ''), 'mark_notification_read'))
{
- $notification = $notification['notifications'][$mark_notification];
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
- $notification->mark_read();
+ $notification = $phpbb_notifications->load_notifications(array(
+ 'notification_id' => $mark_notification,
+ ));
- if (($redirect = $request->variable('redirect', '')))
+ if (isset($notification['notifications'][$mark_notification]))
{
- redirect(append_sid($phpbb_root_path . $redirect));
- }
+ $notification = $notification['notifications'][$mark_notification];
+
+ $notification->mark_read();
+
+ if ($request->is_ajax())
+ {
+ $json_response = new \phpbb\json_response();
+ $json_response->send(array(
+ 'success' => true,
+ ));
+ }
- redirect($notification->get_url());
+ if (($redirect = $request->variable('redirect', '')))
+ {
+ redirect(append_sid($phpbb_root_path . $redirect));
+ }
+
+ redirect($notification->get_url());
+ }
}
}