mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/11103] Starting work on UCP Notifications list
PHPBB3-11103
This commit is contained in:
parent
94a3dc5ff7
commit
6df3de2b9c
1 changed files with 48 additions and 41 deletions
|
@ -25,59 +25,66 @@ class ucp_notifications
|
||||||
|
|
||||||
add_form_key('ucp_notification_options');
|
add_form_key('ucp_notification_options');
|
||||||
|
|
||||||
$subscriptions = $phpbb_notifications->get_subscriptions(false, true);
|
switch ($mode)
|
||||||
|
|
||||||
// Add/remove subscriptions
|
|
||||||
if ($request->is_set_post('submit'))
|
|
||||||
{
|
{
|
||||||
if (!check_form_key('ucp_notification_options'))
|
case 'notification_options':
|
||||||
{
|
$subscriptions = $phpbb_notifications->get_subscriptions(false, true);
|
||||||
trigger_error('FORM_INVALID');
|
|
||||||
}
|
|
||||||
|
|
||||||
$notification_methods = $phpbb_notifications->get_subscription_methods();
|
// Add/remove subscriptions
|
||||||
|
if ($request->is_set_post('submit'))
|
||||||
foreach($phpbb_notifications->get_subscription_types() as $type => $data)
|
|
||||||
{
|
|
||||||
if ($request->is_set_post($type . '_notification') && !isset($subscriptions[$type]))
|
|
||||||
{
|
{
|
||||||
// add
|
if (!check_form_key('ucp_notification_options'))
|
||||||
$phpbb_notifications->add_subscription($type);
|
|
||||||
}
|
|
||||||
else if (!$request->is_set_post($type . '_notification') && isset($subscriptions[$type]))
|
|
||||||
{
|
|
||||||
// remove
|
|
||||||
$phpbb_notifications->delete_subscription($type);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($notification_methods as $method)
|
|
||||||
{
|
|
||||||
if ($request->is_set_post($type . '_' . $method) && (!isset($subscriptions[$type]) || !in_array($method, $subscriptions[$type])))
|
|
||||||
{
|
{
|
||||||
// add
|
trigger_error('FORM_INVALID');
|
||||||
$phpbb_notifications->add_subscription($type, 0, $method);
|
|
||||||
}
|
}
|
||||||
else if (!$request->is_set_post($type . '_' . $method) && isset($subscriptions[$type]) && in_array($method, $subscriptions[$type]))
|
|
||||||
|
$notification_methods = $phpbb_notifications->get_subscription_methods();
|
||||||
|
|
||||||
|
foreach($phpbb_notifications->get_subscription_types() as $type => $data)
|
||||||
{
|
{
|
||||||
// remove
|
if ($request->is_set_post($type . '_notification') && !isset($subscriptions[$type]))
|
||||||
$phpbb_notifications->delete_subscription($type, 0, $method);
|
{
|
||||||
|
// add
|
||||||
|
$phpbb_notifications->add_subscription($type);
|
||||||
|
}
|
||||||
|
else if (!$request->is_set_post($type . '_notification') && isset($subscriptions[$type]))
|
||||||
|
{
|
||||||
|
// remove
|
||||||
|
$phpbb_notifications->delete_subscription($type);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($notification_methods as $method)
|
||||||
|
{
|
||||||
|
if ($request->is_set_post($type . '_' . $method) && (!isset($subscriptions[$type]) || !in_array($method, $subscriptions[$type])))
|
||||||
|
{
|
||||||
|
// add
|
||||||
|
$phpbb_notifications->add_subscription($type, 0, $method);
|
||||||
|
}
|
||||||
|
else if (!$request->is_set_post($type . '_' . $method) && isset($subscriptions[$type]) && in_array($method, $subscriptions[$type]))
|
||||||
|
{
|
||||||
|
// remove
|
||||||
|
$phpbb_notifications->delete_subscription($type, 0, $method);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
meta_refresh(3, $this->u_action);
|
||||||
|
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
||||||
|
trigger_error($message);
|
||||||
}
|
}
|
||||||
}
|
// todo include language files for extensions?
|
||||||
|
|
||||||
meta_refresh(3, $this->u_action);
|
$this->output_notification_methods('notification_methods', $phpbb_notifications, $template, $user);
|
||||||
$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
|
|
||||||
trigger_error($message);
|
|
||||||
}
|
|
||||||
|
|
||||||
// todo include language files for extensions?
|
$this->output_notification_types('notification_types', $phpbb_notifications, $template, $user);
|
||||||
|
|
||||||
$this->output_notification_methods('notification_methods', $phpbb_notifications, $template, $user);
|
$this->tpl_name = 'ucp_notifications';
|
||||||
|
$this->page_title = 'UCP_NOTIFICATIONS';
|
||||||
|
break;
|
||||||
|
|
||||||
$this->output_notification_types('notification_types', $phpbb_notifications, $template, $user);
|
default:
|
||||||
|
//$phpbb_notifications->load_notifications();
|
||||||
$this->tpl_name = 'ucp_notifications';
|
break;
|
||||||
$this->page_title = 'UCP_NOTIFICATIONS';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue