From 98731b127748af4673fdee92db2e139e84fd4d4b Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Thu, 20 Sep 2012 10:36:11 -0500 Subject: [ticket/11103] Prettify the output for prosilver. Create a way to mark items read from the output list. PHPBB3-11103 --- phpBB/index.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'phpBB/index.php') diff --git a/phpBB/index.php b/phpBB/index.php index 0ac8034d7f..38eeb2514e 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -56,6 +56,14 @@ if ($ext = $request->variable('ext', '')) exit_handler(); } +// Mark notifications read +$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); +} + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); $user->add_lang('viewforum'); -- cgit v1.2.1 From b9bc65eed88bbd2dff12102909903cbf4dc9b368 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 4 Oct 2012 14:47:13 -0500 Subject: [ticket/11103] Make $phpbb_notifications a global and use it everywhere Do not use phpbb_container everywhere (makes testing difficult) PHPBB3-11103 --- phpBB/index.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/index.php') 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); } -- cgit v1.2.1 From a48f09033810148fd9b2d5a0b6a683f14ac73a6a Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sun, 14 Oct 2012 12:35:35 -0500 Subject: [ticket/11103] Make sure notifications are marked read when clicking them How do we do this? If an item is unread, the URL to view that item will be the URL to mark it as read (index.php?mark_notification=$id). When the URL is visited it marks the item as read and redirects them to the correct URL for the item. If the item is read, the URL is directly to the item. Prettify the html output PHPBB-11103 --- phpBB/index.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'phpBB/index.php') diff --git a/phpBB/index.php b/phpBB/index.php index af0441f5e3..7f85879d23 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -23,6 +23,23 @@ $user->session_begin(); $auth->acl($user->data); $user->setup(); +// Mark notifications read +if (($mark_notification = request_var('mark_notification', 0))) +{ + $notification = $phpbb_notifications->load_notifications(array( + 'notification_id' => $mark_notification + )); + + if (isset($notification['notifications'][$mark_notification])) + { + $notification = $notification['notifications'][$mark_notification]; + + $notification->mark_read(); + + redirect($notification->get_url()); + } +} + // Handle the display of extension front pages if ($ext = $request->variable('ext', '')) { @@ -56,13 +73,6 @@ if ($ext = $request->variable('ext', '')) exit_handler(); } -// Mark notifications read -$mark_notifications = request_var('mark_notification', array(0)); -if (!empty($mark_notifications)) -{ - $phpbb_notifications->mark_notifications_read_by_id($mark_notifications); -} - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); $user->add_lang('viewforum'); -- cgit v1.2.1 From c8b66a26ef4f6ac2a71980c75a13356dcda72dd6 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Tue, 16 Oct 2012 10:51:07 -0500 Subject: [ticket/11103] Mark read link if notification has no URL to view it Other style stuff PHPBB3-11103 --- phpBB/index.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'phpBB/index.php') diff --git a/phpBB/index.php b/phpBB/index.php index 7f85879d23..3cb49f1a28 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -36,6 +36,11 @@ if (($mark_notification = request_var('mark_notification', 0))) $notification->mark_read(); + if (($redirect = request_var('redirect', ''))) + { + redirect(append_sid($phpbb_root_path . $redirect)); + } + redirect($notification->get_url()); } } -- cgit v1.2.1 From 2227ceab8bf0cccf95598f4e2a59cc7134adf7f0 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 8 Dec 2012 13:56:39 -0600 Subject: [ticket/11103] Use $request->variable rather than request_var PHPBB3-11103 --- phpBB/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/index.php') diff --git a/phpBB/index.php b/phpBB/index.php index 94b2b17084..5e76d653eb 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -25,7 +25,7 @@ $auth->acl($user->data); $user->setup('viewforum'); // Mark notifications read -if (($mark_notification = request_var('mark_notification', 0))) +if (($mark_notification = $request->variable('mark_notification', 0))) { $notification = $phpbb_notifications->load_notifications(array( 'notification_id' => $mark_notification @@ -37,7 +37,7 @@ if (($mark_notification = request_var('mark_notification', 0))) $notification->mark_read(); - if (($redirect = request_var('redirect', ''))) + if (($redirect = $request->variable('redirect', ''))) { redirect(append_sid($phpbb_root_path . $redirect)); } -- cgit v1.2.1 From 249f3c8885d461ae3981dfd7b62093c2175175e3 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 13 Dec 2012 19:19:40 -0600 Subject: [ticket/11103] Instantiate $phpbb_notifications as needed https://github.com/phpbb/phpbb3/pull/992#discussion_r2413976 PHPBB3-11103 --- phpBB/index.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'phpBB/index.php') 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 )); -- cgit v1.2.1