aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/ucp/ucp_notifications.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/ucp/ucp_notifications.php')
-rw-r--r--phpBB/includes/ucp/ucp_notifications.php84
1 files changed, 35 insertions, 49 deletions
diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php
index 7c487b9073..51bd77bd4c 100644
--- a/phpBB/includes/ucp/ucp_notifications.php
+++ b/phpBB/includes/ucp/ucp_notifications.php
@@ -1,9 +1,13 @@
<?php
/**
*
-* @package notifications
-* @copyright (c) 2012 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
*
*/
@@ -30,7 +34,10 @@ class ucp_notifications
$form_time = $request->variable('form_time', 0);
$form_time = ($form_time <= 0 || $form_time > time()) ? time() : $form_time;
+ /* @var $phpbb_notifications \phpbb\notification\manager */
$phpbb_notifications = $phpbb_container->get('notification_manager');
+
+ /* @var $pagination \phpbb\pagination */
$pagination = $phpbb_container->get('pagination');
switch ($mode)
@@ -48,30 +55,21 @@ class ucp_notifications
$notification_methods = $phpbb_notifications->get_subscription_methods();
- foreach($phpbb_notifications->get_subscription_types() as $group => $subscription_types)
+ foreach ($phpbb_notifications->get_subscription_types() as $group => $subscription_types)
{
- foreach($subscription_types as $type => $data)
+ foreach ($subscription_types as $type => $data)
{
- foreach($notification_methods as $method => $method_data)
+ foreach ($notification_methods as $method => $method_data)
{
- if ($request->is_set_post($type . '_' . $method_data['id']) && (!isset($subscriptions[$type]) || !in_array($method_data['id'], $subscriptions[$type])))
+ if ($request->is_set_post(str_replace('.', '_', $type . '_' . $method_data['id'])) && (!isset($subscriptions[$type]) || !in_array($method_data['id'], $subscriptions[$type])))
{
$phpbb_notifications->add_subscription($type, 0, $method_data['id']);
}
- else if (!$request->is_set_post($type . '_' . $method_data['id']) && isset($subscriptions[$type]) && in_array($method_data['id'], $subscriptions[$type]))
+ else if (!$request->is_set_post(str_replace('.', '_', $type . '_' . $method_data['id'])) && isset($subscriptions[$type]) && in_array($method_data['id'], $subscriptions[$type]))
{
$phpbb_notifications->delete_subscription($type, 0, $method_data['id']);
}
}
-
- if ($request->is_set_post($type . '_notification') && !isset($subscriptions[$type]))
- {
- $phpbb_notifications->add_subscription($type);
- }
- else if (!$request->is_set_post($type . '_notification') && isset($subscriptions[$type]))
- {
- $phpbb_notifications->delete_subscription($type);
- }
}
}
@@ -91,35 +89,25 @@ class ucp_notifications
case 'notification_list':
default:
// Mark all items read
- if ($request->variable('mark', '') == 'all' && (confirm_box(true) || check_link_hash($request->variable('token', ''), 'mark_all_notifications_read')))
+ if ($request->variable('mark', '') == 'all' && check_link_hash($request->variable('token', ''), 'mark_all_notifications_read'))
{
- if (confirm_box(true))
- {
- $phpbb_notifications->mark_notifications_read(false, false, $user->data['user_id'], $form_time);
+ $phpbb_notifications->mark_notifications(false, false, $user->data['user_id'], $form_time);
- meta_refresh(3, $this->u_action);
- $message = $user->lang['NOTIFICATIONS_MARK_ALL_READ_SUCCESS'];
-
- if ($request->is_ajax())
- {
- $json_response = new \phpbb\json_response();
- $json_response->send(array(
- 'MESSAGE_TITLE' => $user->lang['INFORMATION'],
- 'MESSAGE_TEXT' => $message,
- 'success' => true,
- ));
- }
- $message .= '<br /><br />' . $user->lang('RETURN_UCP', '<a href="' . $this->u_action . '">', '</a>');
+ meta_refresh(3, $this->u_action);
+ $message = $user->lang['NOTIFICATIONS_MARK_ALL_READ_SUCCESS'];
- trigger_error($message);
- }
- else
+ if ($request->is_ajax())
{
- confirm_box(false, 'NOTIFICATIONS_MARK_ALL_READ', build_hidden_fields(array(
- 'mark' => 'all',
- 'form_time' => $form_time,
- )));
+ $json_response = new \phpbb\json_response();
+ $json_response->send(array(
+ 'MESSAGE_TITLE' => $user->lang['INFORMATION'],
+ 'MESSAGE_TEXT' => $message,
+ 'success' => true,
+ ));
}
+ $message .= '<br /><br />' . $user->lang('RETURN_UCP', '<a href="' . $this->u_action . '">', '</a>');
+
+ trigger_error($message);
}
// Mark specific notifications read
@@ -134,11 +122,11 @@ class ucp_notifications
if (!empty($mark_read))
{
- $phpbb_notifications->mark_notifications_read_by_id($mark_read, $form_time);
+ $phpbb_notifications->mark_notifications_by_id('notification.method.board', $mark_read, $form_time);
}
}
- $notifications = $phpbb_notifications->load_notifications(array(
+ $notifications = $phpbb_notifications->load_notifications('notification.method.board', array(
'start' => $start,
'limit' => $config['topics_per_page'],
'count_total' => true,
@@ -186,24 +174,22 @@ class ucp_notifications
{
$notification_methods = $phpbb_notifications->get_subscription_methods();
- foreach($phpbb_notifications->get_subscription_types() as $group => $subscription_types)
+ foreach ($phpbb_notifications->get_subscription_types() as $group => $subscription_types)
{
$template->assign_block_vars($block, array(
'GROUP_NAME' => $user->lang($group),
));
- foreach($subscription_types as $type => $data)
+ foreach ($subscription_types as $type => $data)
{
$template->assign_block_vars($block, array(
'TYPE' => $type,
'NAME' => $user->lang($data['lang']),
'EXPLAIN' => (isset($user->lang[$data['lang'] . '_EXPLAIN'])) ? $user->lang($data['lang'] . '_EXPLAIN') : '',
-
- 'SUBSCRIBED' => (isset($subscriptions[$type])) ? true : false,
));
- foreach($notification_methods as $method => $method_data)
+ foreach ($notification_methods as $method => $method_data)
{
$template->assign_block_vars($block . '.notification_methods', array(
'METHOD' => $method_data['id'],
@@ -233,7 +219,7 @@ class ucp_notifications
{
$notification_methods = $phpbb_notifications->get_subscription_methods();
- foreach($notification_methods as $method => $method_data)
+ foreach ($notification_methods as $method => $method_data)
{
$template->assign_block_vars($block, array(
'METHOD' => $method_data['id'],