1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/11103] Use report text for report notification, never notify reporter

PHPBB3-11103
This commit is contained in:
Nathan Guse
2012-10-16 17:44:46 -05:00
parent 3557b39115
commit 3839fe6902
3 changed files with 45 additions and 2 deletions

View File

@@ -115,7 +115,8 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
$sql = 'SELECT *
FROM ' . USER_NOTIFICATIONS_TABLE . "
WHERE item_type = '" . self::$notification_option['id'] . "'
AND " . $this->db->sql_in_set('user_id', $auth_approve[$post['forum_id']][$this->permission]);
AND " . $this->db->sql_in_set('user_id', $auth_approve[$post['forum_id']][$this->permission]) . '
AND user_id <> ' . $this->user->data['user_id'];
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))
{
@@ -174,6 +175,16 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
$username = get_username_string('no_profile', $user_data['user_id'], $user_data['username'], $user_data['user_colour']);
if ($this->get_data('report_text'))
{
return $this->user->lang(
$this->language_key,
$username,
censor_text($this->get_data('message_subject')),
$this->get_data('report_text')
);
}
if (isset($this->user->lang[$this->get_data('reason_title')]))
{
return $this->user->lang(
@@ -224,6 +235,7 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
$this->set_data('reporter_id', $this->user->data['user_id']);
$this->set_data('reason_title', strtoupper($post['reason_title']));
$this->set_data('reason_description', $post['reason_description']);
$this->set_data('report_text', $post['report_text']);
return parent::create_insert_array($post, $pre_create_data);
}

View File

@@ -65,6 +65,23 @@ class phpbb_notification_type_report_post extends phpbb_notification_type_post_i
return 'report_post';
}
/**
* Find the users who want to receive notifications
*
* @param array $post Data from the post
*
* @return array
*/
public function find_users_for_notification($post, $options = array())
{
$notify_users = parent::find_users_for_notification($post, $options);
// never notify reporter
unset($notify_users[$this->user->data['user_id']]);
return $notify_users;
}
/**
* Get email template variables
*
@@ -110,6 +127,16 @@ class phpbb_notification_type_report_post extends phpbb_notification_type_post_i
$username = get_username_string('no_profile', $user_data['user_id'], $user_data['username'], $user_data['user_colour']);
if ($this->get_data('report_text'))
{
return $this->user->lang(
$this->language_key,
$username,
censor_text($this->get_data('post_subject')),
$this->get_data('report_text')
);
}
if (isset($this->user->lang[$this->get_data('reason_title')]))
{
return $this->user->lang(
@@ -160,6 +187,7 @@ class phpbb_notification_type_report_post extends phpbb_notification_type_post_i
$this->set_data('reporter_id', $this->user->data['user_id']);
$this->set_data('reason_title', strtoupper($post['reason_title']));
$this->set_data('reason_description', $post['reason_description']);
$this->set_data('report_text', $post['report_text']);
return parent::create_insert_array($post, $pre_create_data);
}