mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[ticket/11103] Finishing up report post/pm and adding report closed
PHPBB3-11103
This commit is contained in:
parent
6d53bd4675
commit
1b56a1d6be
6 changed files with 345 additions and 24 deletions
|
@ -448,6 +448,7 @@ function close_report($report_id_list, $mode, $action, $pm = false)
|
||||||
{
|
{
|
||||||
global $db, $template, $user, $config, $auth;
|
global $db, $template, $user, $config, $auth;
|
||||||
global $phpEx, $phpbb_root_path;
|
global $phpEx, $phpbb_root_path;
|
||||||
|
global $phpbb_notifications;
|
||||||
|
|
||||||
$pm_where = ($pm) ? ' AND r.post_id = 0 ' : ' AND r.pm_id = 0 ';
|
$pm_where = ($pm) ? ' AND r.post_id = 0 ' : ' AND r.pm_id = 0 ';
|
||||||
$id_column = ($pm) ? 'pm_id' : 'post_id';
|
$id_column = ($pm) ? 'pm_id' : 'post_id';
|
||||||
|
@ -633,8 +634,6 @@ function close_report($report_id_list, $mode, $action, $pm = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$messenger = new messenger();
|
|
||||||
|
|
||||||
// Notify reporters
|
// Notify reporters
|
||||||
if (sizeof($notify_reporters))
|
if (sizeof($notify_reporters))
|
||||||
{
|
{
|
||||||
|
@ -647,30 +646,23 @@ function close_report($report_id_list, $mode, $action, $pm = false)
|
||||||
|
|
||||||
$post_id = $reporter[$id_column];
|
$post_id = $reporter[$id_column];
|
||||||
|
|
||||||
$messenger->template((($pm) ? 'pm_report_' : 'report_') . $action . 'd', $reporter['user_lang']);
|
|
||||||
|
|
||||||
$messenger->to($reporter['user_email'], $reporter['username']);
|
|
||||||
$messenger->im($reporter['user_jabber'], $reporter['username']);
|
|
||||||
|
|
||||||
if ($pm)
|
if ($pm)
|
||||||
{
|
{
|
||||||
$messenger->assign_vars(array(
|
$phpbb_notifications->add_notifications('report_pm_closed', array_merge($post_info[$post_id], array(
|
||||||
'USERNAME' => htmlspecialchars_decode($reporter['username']),
|
'reporter' => $reporter['user_id'],
|
||||||
'CLOSER_NAME' => htmlspecialchars_decode($user->data['username']),
|
'closer_id' => $user->data['user_id'],
|
||||||
'PM_SUBJECT' => htmlspecialchars_decode(censor_text($post_info[$post_id]['message_subject'])),
|
'from_user_id' => $post_info[$post_id]['author_id'],
|
||||||
));
|
)));
|
||||||
|
$phpbb_notifications->delete_notifications('report_pm', $post_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$messenger->assign_vars(array(
|
$phpbb_notifications->add_notifications('report_post_closed', array_merge($post_info[$post_id], array(
|
||||||
'USERNAME' => htmlspecialchars_decode($reporter['username']),
|
'reporter' => $reporter['user_id'],
|
||||||
'CLOSER_NAME' => htmlspecialchars_decode($user->data['username']),
|
'closer_id' => $user->data['user_id'],
|
||||||
'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_info[$post_id]['post_subject'])),
|
)));
|
||||||
'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_info[$post_id]['topic_title'])))
|
$phpbb_notifications->delete_notifications('report_post', $post_id);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$messenger->send($reporter['user_notify_type']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -685,8 +677,6 @@ function close_report($report_id_list, $mode, $action, $pm = false)
|
||||||
|
|
||||||
unset($notify_reporters, $post_info, $reports);
|
unset($notify_reporters, $post_info, $reports);
|
||||||
|
|
||||||
$messenger->save_queue();
|
|
||||||
|
|
||||||
$success_msg = (sizeof($report_id_list) == 1) ? "{$pm_prefix}REPORT_" . strtoupper($action) . 'D_SUCCESS' : "{$pm_prefix}REPORTS_" . strtoupper($action) . 'D_SUCCESS';
|
$success_msg = (sizeof($report_id_list) == 1) ? "{$pm_prefix}REPORT_" . strtoupper($action) . 'D_SUCCESS' : "{$pm_prefix}REPORTS_" . strtoupper($action) . 'D_SUCCESS';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -158,10 +158,15 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
|
||||||
{
|
{
|
||||||
$this->user->add_lang('mcp');
|
$this->user->add_lang('mcp');
|
||||||
|
|
||||||
|
$user_data = $this->notification_manager->get_user($this->get_data('reporter_id'));
|
||||||
|
|
||||||
|
$username = get_username_string('no_profile', $user_data['user_id'], $user_data['username'], $user_data['user_colour']);
|
||||||
|
|
||||||
if (isset($this->user->lang[$this->get_data('reason_title')]))
|
if (isset($this->user->lang[$this->get_data('reason_title')]))
|
||||||
{
|
{
|
||||||
return $this->user->lang(
|
return $this->user->lang(
|
||||||
$this->language_key,
|
$this->language_key,
|
||||||
|
$username,
|
||||||
censor_text($this->get_data('message_subject')),
|
censor_text($this->get_data('message_subject')),
|
||||||
$this->user->lang[$this->get_data('reason_title')]
|
$this->user->lang[$this->get_data('reason_title')]
|
||||||
);
|
);
|
||||||
|
@ -169,11 +174,30 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
|
||||||
|
|
||||||
return $this->user->lang(
|
return $this->user->lang(
|
||||||
$this->language_key,
|
$this->language_key,
|
||||||
|
$username,
|
||||||
censor_text($this->get_data('message_subject')),
|
censor_text($this->get_data('message_subject')),
|
||||||
$this->get_data('reason_description')
|
$this->get_data('reason_description')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the user's avatar
|
||||||
|
*/
|
||||||
|
public function get_avatar()
|
||||||
|
{
|
||||||
|
return $this->_get_avatar($this->get_data('reporter_id'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Users needed to query before this notification can be displayed
|
||||||
|
*
|
||||||
|
* @return array Array of user_ids
|
||||||
|
*/
|
||||||
|
public function users_to_query()
|
||||||
|
{
|
||||||
|
return array($this->data['reporter_id']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function for preparing the data for insertion in an SQL query
|
* Function for preparing the data for insertion in an SQL query
|
||||||
* (The service handles insertion)
|
* (The service handles insertion)
|
||||||
|
@ -184,6 +208,7 @@ class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
|
||||||
*/
|
*/
|
||||||
public function create_insert_array($post)
|
public function create_insert_array($post)
|
||||||
{
|
{
|
||||||
|
$this->set_data('reporter_id', $this->user->data['user_id']);
|
||||||
$this->set_data('reason_title', strtoupper($post['reason_title']));
|
$this->set_data('reason_title', strtoupper($post['reason_title']));
|
||||||
$this->set_data('reason_description', $post['reason_description']);
|
$this->set_data('reason_description', $post['reason_description']);
|
||||||
|
|
||||||
|
|
140
phpBB/includes/notification/type/report_pm_closed.php
Normal file
140
phpBB/includes/notification/type/report_pm_closed.php
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package notifications
|
||||||
|
* @copyright (c) 2012 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reported post notifications class
|
||||||
|
* This class handles notifications for reported pms
|
||||||
|
*
|
||||||
|
* @package notifications
|
||||||
|
*/
|
||||||
|
class phpbb_notification_type_report_pm_closed extends phpbb_notification_type_pm
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Email template to use to send notifications
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $email_template = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Language key used to output the text
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $language_key = 'NOTIFICATION_REPORT_CLOSED';
|
||||||
|
|
||||||
|
public function is_available()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the type of notification this is
|
||||||
|
* phpbb_notification_type_
|
||||||
|
*/
|
||||||
|
public static function get_item_type()
|
||||||
|
{
|
||||||
|
return 'report_pm_closed';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the users who want to receive notifications
|
||||||
|
*
|
||||||
|
* @param array $post Data from
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function find_users_for_notification($post, $options = array())
|
||||||
|
{
|
||||||
|
return array($post['reporter'] => array(''));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get email template variables
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_email_template_variables()
|
||||||
|
{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the url to this item
|
||||||
|
*
|
||||||
|
* @return string URL
|
||||||
|
*/
|
||||||
|
public function get_url()
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the HTML formatted title of this notification
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_title()
|
||||||
|
{
|
||||||
|
$user_data = $this->notification_manager->get_user($this->get_data('closer_id'));
|
||||||
|
|
||||||
|
$username = get_username_string('no_profile', $user_data['user_id'], $user_data['username'], $user_data['user_colour']);
|
||||||
|
|
||||||
|
return $this->user->lang(
|
||||||
|
$this->language_key,
|
||||||
|
$username,
|
||||||
|
censor_text($this->get_data('message_subject'))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the user's avatar
|
||||||
|
*/
|
||||||
|
public function get_avatar()
|
||||||
|
{
|
||||||
|
return $this->_get_avatar($this->get_data('closer_id'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Users needed to query before this notification can be displayed
|
||||||
|
*
|
||||||
|
* @return array Array of user_ids
|
||||||
|
*/
|
||||||
|
public function users_to_query()
|
||||||
|
{
|
||||||
|
return array($this->data['closer_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function for preparing the data for insertion in an SQL query
|
||||||
|
* (The service handles insertion)
|
||||||
|
*
|
||||||
|
* @param array $post Data from submit_post
|
||||||
|
*
|
||||||
|
* @return array Array of data ready to be inserted into the database
|
||||||
|
*/
|
||||||
|
public function create_insert_array($post)
|
||||||
|
{
|
||||||
|
$this->set_data('closer_id', $post['closer_id']);
|
||||||
|
|
||||||
|
$data = parent::create_insert_array($post);
|
||||||
|
|
||||||
|
$this->time = $data['time'] = time();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
|
@ -105,10 +105,15 @@ class phpbb_notification_type_report_post extends phpbb_notification_type_post_i
|
||||||
{
|
{
|
||||||
$this->user->add_lang('mcp');
|
$this->user->add_lang('mcp');
|
||||||
|
|
||||||
|
$user_data = $this->notification_manager->get_user($this->get_data('reporter_id'));
|
||||||
|
|
||||||
|
$username = get_username_string('no_profile', $user_data['user_id'], $user_data['username'], $user_data['user_colour']);
|
||||||
|
|
||||||
if (isset($this->user->lang[$this->get_data('reason_title')]))
|
if (isset($this->user->lang[$this->get_data('reason_title')]))
|
||||||
{
|
{
|
||||||
return $this->user->lang(
|
return $this->user->lang(
|
||||||
$this->language_key,
|
$this->language_key,
|
||||||
|
$username,
|
||||||
censor_text($this->get_data('post_subject')),
|
censor_text($this->get_data('post_subject')),
|
||||||
$this->user->lang[$this->get_data('reason_title')]
|
$this->user->lang[$this->get_data('reason_title')]
|
||||||
);
|
);
|
||||||
|
@ -116,11 +121,30 @@ class phpbb_notification_type_report_post extends phpbb_notification_type_post_i
|
||||||
|
|
||||||
return $this->user->lang(
|
return $this->user->lang(
|
||||||
$this->language_key,
|
$this->language_key,
|
||||||
|
$username,
|
||||||
censor_text($this->get_data('post_subject')),
|
censor_text($this->get_data('post_subject')),
|
||||||
$this->get_data('reason_description')
|
$this->get_data('reason_description')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the user's avatar
|
||||||
|
*/
|
||||||
|
public function get_avatar()
|
||||||
|
{
|
||||||
|
return $this->_get_avatar($this->get_data('reporter_id'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Users needed to query before this notification can be displayed
|
||||||
|
*
|
||||||
|
* @return array Array of user_ids
|
||||||
|
*/
|
||||||
|
public function users_to_query()
|
||||||
|
{
|
||||||
|
return array($this->data['reporter_id']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function for preparing the data for insertion in an SQL query
|
* Function for preparing the data for insertion in an SQL query
|
||||||
* (The service handles insertion)
|
* (The service handles insertion)
|
||||||
|
@ -131,6 +155,7 @@ class phpbb_notification_type_report_post extends phpbb_notification_type_post_i
|
||||||
*/
|
*/
|
||||||
public function create_insert_array($post)
|
public function create_insert_array($post)
|
||||||
{
|
{
|
||||||
|
$this->set_data('reporter_id', $this->user->data['user_id']);
|
||||||
$this->set_data('reason_title', strtoupper($post['reason_title']));
|
$this->set_data('reason_title', strtoupper($post['reason_title']));
|
||||||
$this->set_data('reason_description', $post['reason_description']);
|
$this->set_data('reason_description', $post['reason_description']);
|
||||||
|
|
||||||
|
|
140
phpBB/includes/notification/type/report_post_closed.php
Normal file
140
phpBB/includes/notification/type/report_post_closed.php
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package notifications
|
||||||
|
* @copyright (c) 2012 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reported post notifications class
|
||||||
|
* This class handles notifications for reported posts
|
||||||
|
*
|
||||||
|
* @package notifications
|
||||||
|
*/
|
||||||
|
class phpbb_notification_type_report_post_closed extends phpbb_notification_type_post
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Email template to use to send notifications
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $email_template = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Language key used to output the text
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $language_key = 'NOTIFICATION_REPORT_CLOSED';
|
||||||
|
|
||||||
|
public function is_available()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the type of notification this is
|
||||||
|
* phpbb_notification_type_
|
||||||
|
*/
|
||||||
|
public static function get_item_type()
|
||||||
|
{
|
||||||
|
return 'report_post_closed';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the users who want to receive notifications
|
||||||
|
*
|
||||||
|
* @param array $post Data from
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function find_users_for_notification($post, $options = array())
|
||||||
|
{
|
||||||
|
return array($post['reporter'] => array(''));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get email template variables
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_email_template_variables()
|
||||||
|
{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the url to this item
|
||||||
|
*
|
||||||
|
* @return string URL
|
||||||
|
*/
|
||||||
|
public function get_url()
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the HTML formatted title of this notification
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function get_title()
|
||||||
|
{
|
||||||
|
$user_data = $this->notification_manager->get_user($this->get_data('closer_id'));
|
||||||
|
|
||||||
|
$username = get_username_string('no_profile', $user_data['user_id'], $user_data['username'], $user_data['user_colour']);
|
||||||
|
|
||||||
|
return $this->user->lang(
|
||||||
|
$this->language_key,
|
||||||
|
$username,
|
||||||
|
censor_text($this->get_data('post_subject'))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the user's avatar
|
||||||
|
*/
|
||||||
|
public function get_avatar()
|
||||||
|
{
|
||||||
|
return $this->_get_avatar($this->get_data('closer_id'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Users needed to query before this notification can be displayed
|
||||||
|
*
|
||||||
|
* @return array Array of user_ids
|
||||||
|
*/
|
||||||
|
public function users_to_query()
|
||||||
|
{
|
||||||
|
return array($this->data['closer_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function for preparing the data for insertion in an SQL query
|
||||||
|
* (The service handles insertion)
|
||||||
|
*
|
||||||
|
* @param array $post Data from submit_post
|
||||||
|
*
|
||||||
|
* @return array Array of data ready to be inserted into the database
|
||||||
|
*/
|
||||||
|
public function create_insert_array($post)
|
||||||
|
{
|
||||||
|
$this->set_data('closer_id', $post['closer_id']);
|
||||||
|
|
||||||
|
$data = parent::create_insert_array($post);
|
||||||
|
|
||||||
|
$this->time = $data['time'] = time();
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
|
@ -397,8 +397,9 @@ $lang = array_merge($lang, array(
|
||||||
'NOTIFICATION_POST_DISAPPROVED' => 'Your post "%1$s" was disapproved because "%2$s".',
|
'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_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_QUOTE' => '%1$s quoted you in the post "%2$s".',
|
||||||
'NOTIFICATION_REPORT_PM' => 'A Private Message "%1$s" was reported because "%2$s".',
|
'NOTIFICATION_REPORT_PM' => '%1$s reported a Private Message "%2$s" because "%3$s".',
|
||||||
'NOTIFICATION_REPORT_POST' => 'A post "%1$s" was reported because "%2$s".',
|
'NOTIFICATION_REPORT_POST' => '%1$s reported a post "%2$s" because "%3$s".',
|
||||||
|
'NOTIFICATION_REPORT_CLOSED' => '%1$s closed the report you made for "%2$s".',
|
||||||
'NOTIFICATION_TOPIC' => '%1$s posted a new topic "%2$s" in the forum "%3$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_APPROVED' => 'Your topic "%2$s" in the forum "%3$s" was approved.',
|
||||||
'NOTIFICATION_TOPIC_DISAPPROVED' => 'Your topic "%1$s" was disapproved because "%2$s".',
|
'NOTIFICATION_TOPIC_DISAPPROVED' => 'Your topic "%1$s" was disapproved because "%2$s".',
|
||||||
|
|
Loading…
Add table
Reference in a new issue