diff options
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/mcp/mcp_pm_reports.php | 4 | ||||
-rw-r--r-- | phpBB/includes/notification/type/report_pm.php | 44 | ||||
-rw-r--r-- | phpBB/includes/notification/type/report_post.php | 2 | ||||
-rw-r--r-- | phpBB/language/en/common.php | 3 | ||||
-rw-r--r-- | phpBB/language/en/email/notifications/report_pm.txt | 14 | ||||
-rw-r--r-- | phpBB/report.php | 5 |
6 files changed, 54 insertions, 18 deletions
diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php index 24e531517c..227c89bb79 100644 --- a/phpBB/includes/mcp/mcp_pm_reports.php +++ b/phpBB/includes/mcp/mcp_pm_reports.php @@ -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']; diff --git a/phpBB/includes/notification/type/report_pm.php b/phpBB/includes/notification/type/report_pm.php index 9c680ce6a9..e9fa4c0f11 100644 --- a/phpBB/includes/notification/type/report_pm.php +++ b/phpBB/includes/notification/type/report_pm.php @@ -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) @@ -58,7 +65,18 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_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'))), - - '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')}", + 'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']), + 'SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))), + + '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') ); } diff --git a/phpBB/includes/notification/type/report_post.php b/phpBB/includes/notification/type/report_post.php index 70d3a4c114..df67a8e338 100644 --- a/phpBB/includes/notification/type/report_post.php +++ b/phpBB/includes/notification/type/report_post.php @@ -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) diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index ae487f7159..cbf8e6ee4c 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -397,7 +397,8 @@ $lang = array_merge($lang, array( 'NOTIFICATION_POST_DISAPPROVED' => 'Your post "%1$s" was disapproved because "%2$s".', 'NOTIFICATION_POST_IN_QUEUE' => 'A new post titled "%2$s" was posted by "%1$s" and needs approval.', 'NOTIFICATION_QUOTE' => '%1$s quoted you in the post "%2$s".', - 'NOTIFICATION_REPORT' => 'A post "%1$s" was reported because "%2$s".', + 'NOTIFICATION_REPORT_PM' => 'A Private Message "%1$s" was reported because "%2$s".', + 'NOTIFICATION_REPORT_POST' => 'A post "%1$s" was reported because "%2$s".', 'NOTIFICATION_TOPIC' => '%1$s posted a new topic "%2$s" in the forum "%3$s".', 'NOTIFICATION_TOPIC_APPROVED' => 'Your topic "%2$s" in the forum "%3$s" was approved.', 'NOTIFICATION_TOPIC_DISAPPROVED' => 'Your topic "%1$s" was disapproved because "%2$s".', diff --git a/phpBB/language/en/email/notifications/report_pm.txt b/phpBB/language/en/email/notifications/report_pm.txt new file mode 100644 index 0000000000..eeaa8ee9b9 --- /dev/null +++ b/phpBB/language/en/email/notifications/report_pm.txt @@ -0,0 +1,14 @@ +Subject: Topic reply notification - "{TOPIC_TITLE}" + +Hello {USERNAME}, + +You are receiving this notification because a Private Message titled, "{SUBJECT}" by "{AUTHOR_NAME}" at "{SITENAME}" was reported. + +If you want to view the report, click the following link: +{U_VIEW_REPORT} + +If you no longer wish to receive updates about replies to bookmarks, please update your notification settings here: + +{U_NOTIFICATION_SETTINGS} + +{EMAIL_SIG}
\ No newline at end of file diff --git a/phpBB/report.php b/phpBB/report.php index 8bede2cffd..dd1cc2514c 100644 --- a/phpBB/report.php +++ b/phpBB/report.php @@ -215,7 +215,10 @@ if ($submit && $reason_id) $lang_success = $user->lang['PM_REPORTED_SUCCESS']; // Notify relevant users - //$phpbb_notifications->add_notifications('report_pm', $report_data); + $phpbb_notifications->add_notifications('report_pm', array_merge($report_data, $row, array( + 'from_user_id' => $report_data['author_id'], + 'report_id' => $report_id, + ))); } meta_refresh(3, $redirect_url); |