mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
[ticket/11103] Finishing up PM Report notifications
PHPBB3-11103
This commit is contained in:
@@ -34,6 +34,7 @@ class mcp_pm_reports
|
||||
{
|
||||
global $auth, $db, $user, $template, $cache;
|
||||
global $config, $phpbb_root_path, $phpEx, $action;
|
||||
global $phpbb_notifications;
|
||||
|
||||
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
|
||||
include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
|
||||
@@ -89,6 +90,9 @@ class mcp_pm_reports
|
||||
trigger_error('NO_REPORT');
|
||||
}
|
||||
|
||||
// Mark the notification as read
|
||||
$phpbb_notifications->mark_notifications_read_by_parent('report_pm', $report_id, $user->data['user_id']);
|
||||
|
||||
$pm_id = $report['pm_id'];
|
||||
$report_id = $report['report_id'];
|
||||
|
||||
|
@@ -28,7 +28,14 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $email_template = 'notifications/report_post';
|
||||
public $email_template = 'notifications/report_pm';
|
||||
|
||||
/**
|
||||
* Language key used to output the text
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $language_key = 'NOTIFICATION_REPORT_PM';
|
||||
|
||||
/**
|
||||
* Permission to check for (in find_users_for_notification)
|
||||
@@ -57,8 +64,19 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
|
||||
return 'report_pm';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the id of the parent
|
||||
*
|
||||
* @param array $pm The data from the pm
|
||||
*/
|
||||
public static function get_item_parent_id($pm)
|
||||
{
|
||||
return (int) $pm['report_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the users who want to receive notifications
|
||||
* (copied from post_in_queue)
|
||||
*
|
||||
* @param array $post Data from the post
|
||||
*
|
||||
@@ -70,6 +88,9 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
|
||||
'ignore_users' => array(),
|
||||
), $options);
|
||||
|
||||
// Global
|
||||
$post['forum_id'] = 0;
|
||||
|
||||
$auth_approve = $this->auth->acl_get_list(false, $this->permission, $post['forum_id']);
|
||||
|
||||
if (empty($auth_approve))
|
||||
@@ -110,18 +131,11 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
|
||||
*/
|
||||
public function get_email_template_variables()
|
||||
{
|
||||
$board_url = generate_board_url();
|
||||
|
||||
return array(
|
||||
'POST_SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('post_subject'))),
|
||||
'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($this->get_data('topic_title'))),
|
||||
'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']),
|
||||
'SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))),
|
||||
|
||||
'U_VIEW_REPORT' => "{$board_url}mcp.{$this->php_ext}?f={$this->get_data('forum_id')}&p={$this->item_id}&i=reports&mode=report_details#reports",
|
||||
'U_VIEW_POST' => "{$board_url}/viewtopic.{$this->php_ext}?p={$this->item_id}#p{$this->item_id}",
|
||||
'U_NEWEST_POST' => "{$board_url}/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}&view=unread#unread",
|
||||
'U_TOPIC' => "{$board_url}/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}",
|
||||
'U_VIEW_TOPIC' => "{$board_url}/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}",
|
||||
'U_FORUM' => "{$board_url}/viewforum.{$this->php_ext}?f={$this->get_data('forum_id')}",
|
||||
'U_VIEW_REPORT' => generate_board_url() . "mcp.{$this->php_ext}?r={$this->item_parent_id}&i=pm_reports&mode=pm_report_details",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -132,7 +146,7 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
|
||||
*/
|
||||
public function get_url()
|
||||
{
|
||||
return append_sid($this->phpbb_root_path . 'mcp.' . $this->php_ext, "f={$this->get_data('forum_id')}&p={$this->item_id}&i=reports&mode=report_details#reports");
|
||||
return append_sid($this->phpbb_root_path . 'mcp.' . $this->php_ext, "r={$this->item_parent_id}&i=pm_reports&mode=pm_report_details");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,14 +162,14 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
|
||||
{
|
||||
return $this->user->lang(
|
||||
$this->language_key,
|
||||
censor_text($this->get_data('post_subject')),
|
||||
censor_text($this->get_data('message_subject')),
|
||||
$this->user->lang[$this->get_data('reason_title')]
|
||||
);
|
||||
}
|
||||
|
||||
return $this->user->lang(
|
||||
$this->language_key,
|
||||
censor_text($this->get_data('post_subject')),
|
||||
censor_text($this->get_data('message_subject')),
|
||||
$this->get_data('reason_description')
|
||||
);
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ class phpbb_notification_type_report_post extends phpbb_notification_type_post_i
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $language_key = 'NOTIFICATION_REPORT';
|
||||
protected $language_key = 'NOTIFICATION_REPORT_POST';
|
||||
|
||||
/**
|
||||
* Permission to check for (in find_users_for_notification)
|
||||
|
Reference in New Issue
Block a user