mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/11103] Some fixes for the email method
PHPBB3-11103
This commit is contained in:
parent
1e53f7df9d
commit
86b801df73
4 changed files with 20 additions and 26 deletions
|
@ -1543,6 +1543,7 @@ function get_folder_status($folder_id, $folder)
|
||||||
function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
|
function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
|
||||||
{
|
{
|
||||||
global $db, $auth, $config, $phpEx, $template, $user, $phpbb_root_path;
|
global $db, $auth, $config, $phpEx, $template, $user, $phpbb_root_path;
|
||||||
|
global $phpbb_container;
|
||||||
|
|
||||||
// We do not handle erasing pms here
|
// We do not handle erasing pms here
|
||||||
if ($mode == 'delete')
|
if ($mode == 'delete')
|
||||||
|
@ -1844,7 +1845,16 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
|
||||||
// Send Notifications
|
// Send Notifications
|
||||||
if ($mode != 'edit')
|
if ($mode != 'edit')
|
||||||
{
|
{
|
||||||
pm_notification($mode, $data['from_username'], $recipients, $subject, $data['message'], $data['msg_id']);
|
$phpbb_notifications = $phpbb_container->get('notifications');
|
||||||
|
|
||||||
|
$phpbb_notifications->add_notifications('pm', array(
|
||||||
|
'author_id' => $data['from_user_id'],
|
||||||
|
'recipients' => $recipients,
|
||||||
|
'message_subject' => $subject,
|
||||||
|
'msg_id' => $data['msg_id'],
|
||||||
|
));
|
||||||
|
|
||||||
|
//pm_notification($mode, $data['from_username'], $recipients, $subject, $data['message'], $data['msg_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data['msg_id'];
|
return $data['msg_id'];
|
||||||
|
@ -1855,19 +1865,6 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
|
||||||
*/
|
*/
|
||||||
function pm_notification($mode, $author, $recipients, $subject, $message, $msg_id)
|
function pm_notification($mode, $author, $recipients, $subject, $message, $msg_id)
|
||||||
{
|
{
|
||||||
global $phpbb_container;
|
|
||||||
|
|
||||||
$phpbb_notifications = $phpbb_container->get('notifications');
|
|
||||||
|
|
||||||
$phpbb_notifications->add_notifications('pm', array(
|
|
||||||
'author_id' => $author,
|
|
||||||
'recipients' => $recipients,
|
|
||||||
'message_subject' => $subject,
|
|
||||||
'msg_id' => $msg_id,
|
|
||||||
));
|
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
global $db, $user, $config, $phpbb_root_path, $phpEx, $auth;
|
global $db, $user, $config, $phpbb_root_path, $phpEx, $auth;
|
||||||
|
|
||||||
$subject = censor_text($subject);
|
$subject = censor_text($subject);
|
||||||
|
|
|
@ -29,7 +29,7 @@ class phpbb_notifications_method_email extends phpbb_notifications_method_base
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function notify()
|
public function notify($notification)
|
||||||
{
|
{
|
||||||
// email the user
|
// email the user
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ class phpbb_notifications_method_email extends phpbb_notifications_method_base
|
||||||
{
|
{
|
||||||
$notification->users($users);
|
$notification->users($users);
|
||||||
|
|
||||||
$user = $notification->get_user();
|
$user = $notification->get_user($notification->user_id);
|
||||||
|
|
||||||
$messenger->template('privmsg_notify', $user['user_lang']);
|
$messenger->template('privmsg_notify', $user['user_lang']);
|
||||||
|
|
||||||
|
@ -82,10 +82,10 @@ class phpbb_notifications_method_email extends phpbb_notifications_method_base
|
||||||
'USERNAME' => htmlspecialchars_decode($user['username']),
|
'USERNAME' => htmlspecialchars_decode($user['username']),
|
||||||
|
|
||||||
'U_INBOX' => $board_url . "/ucp.{$this->php_ext}?i=pm&folder=inbox",
|
'U_INBOX' => $board_url . "/ucp.{$this->php_ext}?i=pm&folder=inbox",
|
||||||
'U_VIEW_MESSAGE' => $board_url . "/ucp.{$this->php_ext}?i=pm&mode=view&p={$notification->get_item_id()}",
|
'U_VIEW_MESSAGE' => $board_url . "/ucp.{$this->php_ext}?i=pm&mode=view&p={$notification->item_id}",
|
||||||
));
|
));
|
||||||
|
|
||||||
$messenger->send($addr['method']);
|
$messenger->send('email');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the queue in the messenger class (has to be called or these emails could be lost?)
|
// Save the queue in the messenger class (has to be called or these emails could be lost?)
|
||||||
|
|
|
@ -172,15 +172,14 @@ class phpbb_notifications_service
|
||||||
foreach ($methods as $method)
|
foreach ($methods as $method)
|
||||||
{
|
{
|
||||||
// setup the notification methods and add the notification to the queue
|
// setup the notification methods and add the notification to the queue
|
||||||
if ($row['method'])
|
if ($method)
|
||||||
{
|
{
|
||||||
if (!isset($notification_methods[$row['method']]))
|
if (!isset($notification_methods[$method]))
|
||||||
{
|
{
|
||||||
$method_class_name = 'phpbb_notifications_method_' . $row['method'];
|
$method_class_name = 'phpbb_notifications_method_' . $method;
|
||||||
$notification_methods[$row['method']] = new $method_class_name();
|
$notification_methods[$method] = new $method_class_name($this->phpbb_container);
|
||||||
}
|
}
|
||||||
|
$notification_methods[$method]->add_to_queue($notification);
|
||||||
$notification_methods[$row['method']]->add_to_queue($notification);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ abstract class phpbb_notifications_type_base implements phpbb_notifications_type
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indentification data
|
* Indentification data
|
||||||
* notification_id
|
|
||||||
* item_type
|
* item_type
|
||||||
* item_id
|
* item_id
|
||||||
* user_id
|
* user_id
|
||||||
|
@ -141,7 +140,6 @@ abstract class phpbb_notifications_type_base implements phpbb_notifications_type
|
||||||
'URL' => $this->get_url(),
|
'URL' => $this->get_url(),
|
||||||
'TIME' => $user->format_date($this->time),
|
'TIME' => $user->format_date($this->time),
|
||||||
|
|
||||||
'ID' => $this->notification_id,
|
|
||||||
'UNREAD' => $this->unread,
|
'UNREAD' => $this->unread,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue