aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2012-10-16 17:44:46 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2012-10-16 17:44:46 -0500
commit3839fe69027836d0c9083095208e4ed548a7ea38 (patch)
treef9e4a549c07846f546382ee9a3472686a879b0c8
parent3557b391154286d1cb18a6e6f88925758247860d (diff)
downloadforums-3839fe69027836d0c9083095208e4ed548a7ea38.tar
forums-3839fe69027836d0c9083095208e4ed548a7ea38.tar.gz
forums-3839fe69027836d0c9083095208e4ed548a7ea38.tar.bz2
forums-3839fe69027836d0c9083095208e4ed548a7ea38.tar.xz
forums-3839fe69027836d0c9083095208e4ed548a7ea38.zip
[ticket/11103] Use report text for report notification, never notify reporter
PHPBB3-11103
-rw-r--r--phpBB/includes/notification/type/report_pm.php14
-rw-r--r--phpBB/includes/notification/type/report_post.php28
-rw-r--r--phpBB/report.php5
3 files changed, 45 insertions, 2 deletions
diff --git a/phpBB/includes/notification/type/report_pm.php b/phpBB/includes/notification/type/report_pm.php
index 440092afdc..3327dbe734 100644
--- a/phpBB/includes/notification/type/report_pm.php
+++ b/phpBB/includes/notification/type/report_pm.php
@@ -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);
}
diff --git a/phpBB/includes/notification/type/report_post.php b/phpBB/includes/notification/type/report_post.php
index d860fb1b38..151841ef02 100644
--- a/phpBB/includes/notification/type/report_post.php
+++ b/phpBB/includes/notification/type/report_post.php
@@ -66,6 +66,23 @@ class phpbb_notification_type_report_post extends phpbb_notification_type_post_i
}
/**
+ * 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
*
* @return array
@@ -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);
}
diff --git a/phpBB/report.php b/phpBB/report.php
index dd1cc2514c..9f3b09d5ba 100644
--- a/phpBB/report.php
+++ b/phpBB/report.php
@@ -186,7 +186,9 @@ if ($submit && $reason_id)
$lang_success = $user->lang['POST_REPORTED_SUCCESS'];
// Notify relevant users
- $phpbb_notifications->add_notifications('report_post', array_merge($report_data, $row, $forum_data));
+ $phpbb_notifications->add_notifications('report_post', array_merge($report_data, $row, $forum_data, array(
+ 'report_text' => $report_text,
+ )));
}
else
{
@@ -216,6 +218,7 @@ if ($submit && $reason_id)
// Notify relevant users
$phpbb_notifications->add_notifications('report_pm', array_merge($report_data, $row, array(
+ 'report_text' => $report_text,
'from_user_id' => $report_data['author_id'],
'report_id' => $report_id,
)));