1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-12 03:34:04 +02:00

[ticket/12034] AJAXify notifications popup.

PHPBB3-12034
This commit is contained in:
Cesar G
2013-11-23 20:11:49 -08:00
parent be67124dc7
commit f4b832a27d
11 changed files with 141 additions and 24 deletions

View File

@@ -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 (isset($notification['notifications'][$mark_notification]))
if ($user->data['user_id'] == ANONYMOUS)
{
$notification = $notification['notifications'][$mark_notification];
$notification->mark_read();
if (($redirect = $request->variable('redirect', '')))
if ($request->is_ajax())
{
redirect(append_sid($phpbb_root_path . $redirect));
trigger_error('LOGIN_REQUIRED');
}
login_box('', $user->lang['LOGIN_REQUIRED']);
}
redirect($notification->get_url());
if (check_link_hash($request->variable('hash', ''), 'mark_notification_read'))
{
$phpbb_notifications = $phpbb_container->get('notification_manager');
$notification = $phpbb_notifications->load_notifications(array(
'notification_id' => $mark_notification
));
if (isset($notification['notifications'][$mark_notification]))
{
$notification = $notification['notifications'][$mark_notification];
$notification->mark_read();
if ($request->is_ajax())
{
$json_response = new \phpbb\json_response();
$json_response->send(array(
'success' => true,
));
}
if (($redirect = $request->variable('redirect', '')))
{
redirect(append_sid($phpbb_root_path . $redirect));
}
redirect($notification->get_url());
}
}
}