Merge remote-tracking branch 'brunoais/feature/save-post-on-report' into develop

* brunoais/feature/save-post-on-report:
  [feature/save-post-on-report] Changed mark in subsilver2 to look like viewtopic
  [feature/save-post-on-report] bbcode_nl2br missing.
  [feature/save-post-on-report] Change the column type of reported text
  [feature/save-post-on-report] Changed the name of the column
  [feature/save-post-on-report] Bug fix table name
  [feature/save-post-on-report] Saves the post reported when a report is creat
  [feature/save-post-on-report] The complete changes for this feature
This commit is contained in:
Oleg Pudeyev 2012-03-27 22:45:02 -04:00
commit 4239d8aa4e
13 changed files with 34 additions and 11 deletions

View file

@ -1528,6 +1528,7 @@ function get_schema_struct()
'report_closed' => array('BOOL', 0), 'report_closed' => array('BOOL', 0),
'report_time' => array('TIMESTAMP', 0), 'report_time' => array('TIMESTAMP', 0),
'report_text' => array('MTEXT_UNI', ''), 'report_text' => array('MTEXT_UNI', ''),
'reported_post_text' => array('MTEXT_UNI', ''),
), ),
'PRIMARY_KEY' => 'report_id', 'PRIMARY_KEY' => 'report_id',
'KEYS' => array( 'KEYS' => array(

View file

@ -71,7 +71,7 @@ class mcp_reports
// closed reports are accessed by report id // closed reports are accessed by report id
$report_id = request_var('r', 0); $report_id = request_var('r', 0);
$sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour $sql = 'SELECT r.post_id, r.user_id, r.report_id, r.report_closed, report_time, r.report_text, r.reported_post_text, rr.reason_title, rr.reason_description, u.username, u.username_clean, u.user_colour
FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u FROM ' . REPORTS_TABLE . ' r, ' . REPORTS_REASONS_TABLE . ' rr, ' . USERS_TABLE . ' u
WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . ' WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . '
AND rr.reason_id = r.reason_id AND rr.reason_id = r.reason_id
@ -116,8 +116,9 @@ class mcp_reports
$template->assign_vars(array( $template->assign_vars(array(
'S_TOPIC_REVIEW' => true, 'S_TOPIC_REVIEW' => true,
'S_BBCODE_ALLOWED' => $post_info['enable_bbcode'], 'S_BBCODE_ALLOWED' => $post_info['enable_bbcode'],
'TOPIC_TITLE' => $post_info['topic_title']) 'TOPIC_TITLE' => $post_info['topic_title'],
); 'REPORTED_POST_ID' => $post_id,
));
} }
$topic_tracking_info = $extensions = $attachments = array(); $topic_tracking_info = $extensions = $attachments = array();
@ -226,7 +227,7 @@ class mcp_reports
'REPORTER_NAME' => get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']), 'REPORTER_NAME' => get_username_string('username', $report['user_id'], $report['username'], $report['user_colour']),
'U_VIEW_REPORTER_PROFILE' => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']), 'U_VIEW_REPORTER_PROFILE' => get_username_string('profile', $report['user_id'], $report['username'], $report['user_colour']),
'POST_PREVIEW' => $message, 'POST_PREVIEW' => bbcode_nl2br($report['reported_post_text']),
'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'], 'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'],
'POST_DATE' => $user->format_date($post_info['post_time']), 'POST_DATE' => $user->format_date($post_info['post_time']),
'POST_IP' => $post_info['poster_ip'], 'POST_IP' => $post_info['poster_ip'],

View file

@ -1088,6 +1088,9 @@ function database_update_info()
PROFILE_FIELDS_TABLE => array( PROFILE_FIELDS_TABLE => array(
'field_show_on_pm' => array('BOOL', 0), 'field_show_on_pm' => array('BOOL', 0),
), ),
REPORTS_TABLE => array(
'reported_post_text' => array('MTEXT_UNI', ''),
),
), ),
'change_columns' => array( 'change_columns' => array(
GROUPS_TABLE => array( GROUPS_TABLE => array(

View file

@ -909,7 +909,8 @@ CREATE TABLE phpbb_reports (
user_notify INTEGER DEFAULT 0 NOT NULL, user_notify INTEGER DEFAULT 0 NOT NULL,
report_closed INTEGER DEFAULT 0 NOT NULL, report_closed INTEGER DEFAULT 0 NOT NULL,
report_time INTEGER DEFAULT 0 NOT NULL, report_time INTEGER DEFAULT 0 NOT NULL,
report_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL report_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL,
reported_post_text BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL
);; );;
ALTER TABLE phpbb_reports ADD PRIMARY KEY (report_id);; ALTER TABLE phpbb_reports ADD PRIMARY KEY (report_id);;

View file

@ -1108,7 +1108,8 @@ CREATE TABLE [phpbb_reports] (
[user_notify] [int] DEFAULT (0) NOT NULL , [user_notify] [int] DEFAULT (0) NOT NULL ,
[report_closed] [int] DEFAULT (0) NOT NULL , [report_closed] [int] DEFAULT (0) NOT NULL ,
[report_time] [int] DEFAULT (0) NOT NULL , [report_time] [int] DEFAULT (0) NOT NULL ,
[report_text] [text] DEFAULT ('') NOT NULL [report_text] [text] DEFAULT ('') NOT NULL ,
[reported_post_text] [text] DEFAULT ('') NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO GO

View file

@ -647,6 +647,7 @@ CREATE TABLE phpbb_reports (
report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, report_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
report_text mediumblob NOT NULL, report_text mediumblob NOT NULL,
reported_post_text mediumblob NOT NULL,
PRIMARY KEY (report_id), PRIMARY KEY (report_id),
KEY post_id (post_id), KEY post_id (post_id),
KEY pm_id (pm_id) KEY pm_id (pm_id)

View file

@ -647,6 +647,7 @@ CREATE TABLE phpbb_reports (
report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, report_closed tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
report_time int(11) UNSIGNED DEFAULT '0' NOT NULL, report_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
report_text mediumtext NOT NULL, report_text mediumtext NOT NULL,
reported_post_text mediumtext NOT NULL,
PRIMARY KEY (report_id), PRIMARY KEY (report_id),
KEY post_id (post_id), KEY post_id (post_id),
KEY pm_id (pm_id) KEY pm_id (pm_id)

View file

@ -1214,6 +1214,7 @@ CREATE TABLE phpbb_reports (
report_closed number(1) DEFAULT '0' NOT NULL, report_closed number(1) DEFAULT '0' NOT NULL,
report_time number(11) DEFAULT '0' NOT NULL, report_time number(11) DEFAULT '0' NOT NULL,
report_text clob DEFAULT '' , report_text clob DEFAULT '' ,
reported_post_text clob DEFAULT '' ,
CONSTRAINT pk_phpbb_reports PRIMARY KEY (report_id) CONSTRAINT pk_phpbb_reports PRIMARY KEY (report_id)
) )
/ /

View file

@ -853,6 +853,7 @@ CREATE TABLE phpbb_reports (
report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0), report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0),
report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0), report_time INT4 DEFAULT '0' NOT NULL CHECK (report_time >= 0),
report_text TEXT DEFAULT '' NOT NULL, report_text TEXT DEFAULT '' NOT NULL,
reported_post_text TEXT DEFAULT '' NOT NULL,
PRIMARY KEY (report_id) PRIMARY KEY (report_id)
); );

View file

@ -627,7 +627,8 @@ CREATE TABLE phpbb_reports (
user_notify INTEGER UNSIGNED NOT NULL DEFAULT '0', user_notify INTEGER UNSIGNED NOT NULL DEFAULT '0',
report_closed INTEGER UNSIGNED NOT NULL DEFAULT '0', report_closed INTEGER UNSIGNED NOT NULL DEFAULT '0',
report_time INTEGER UNSIGNED NOT NULL DEFAULT '0', report_time INTEGER UNSIGNED NOT NULL DEFAULT '0',
report_text mediumtext(16777215) NOT NULL DEFAULT '' report_text mediumtext(16777215) NOT NULL DEFAULT '',
reported_post_text mediumtext(16777215) NOT NULL DEFAULT ''
); );
CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id); CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id);

View file

@ -73,6 +73,7 @@ if ($post_id)
$forum_id = (int) $report_data['forum_id']; $forum_id = (int) $report_data['forum_id'];
$topic_id = (int) $report_data['topic_id']; $topic_id = (int) $report_data['topic_id'];
$reported_post_text = $report_data['post_text'];
$sql = 'SELECT * $sql = 'SELECT *
FROM ' . FORUMS_TABLE . ' FROM ' . FORUMS_TABLE . '
@ -130,6 +131,8 @@ else
$message .= '<br /><br />' . sprintf($user->lang['RETURN_PM'], '<a href="' . $redirect_url . '">', '</a>'); $message .= '<br /><br />' . sprintf($user->lang['RETURN_PM'], '<a href="' . $redirect_url . '">', '</a>');
trigger_error($message); trigger_error($message);
} }
$reported_post_text = $report_data['message_text'];
} }
// Submit report? // Submit report?
@ -155,7 +158,8 @@ if ($submit && $reason_id)
'user_notify' => (int) $user_notify, 'user_notify' => (int) $user_notify,
'report_closed' => 0, 'report_closed' => 0,
'report_time' => (int) time(), 'report_time' => (int) time(),
'report_text' => (string) $report_text 'report_text' => (string) $report_text,
'reported_post_text' => $reported_post_text,
); );
$sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);

View file

@ -17,7 +17,7 @@
<div class="inner"><span class="corners-top"><span></span></span> <div class="inner"><span class="corners-top"><span></span></span>
{topic_review_row.L_IGNORE_POST} {topic_review_row.L_IGNORE_POST}
<!-- ELSE --> <!-- ELSE -->
<div class="post <!-- IF topic_review_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->"> <div class="post <!-- IF topic_review_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF topic_review_row.POST_ID == REPORTED_POST_ID --> reported<!-- ENDIF -->">
<div class="inner"><span class="corners-top"><span></span></span> <div class="inner"><span class="corners-top"><span></span></span>
<!-- ENDIF --> <!-- ENDIF -->

View file

@ -51,6 +51,13 @@
<table width="100%" cellspacing="0" cellpadding="2"> <table width="100%" cellspacing="0" cellpadding="2">
<tr> <tr>
<td> <td>
<!-- IF topic_review_row.POST_ID == REPORTED_POST_ID -->
<table width="100%" cellspacing="0">
<tr>
<span class="postreported">{REPORTED_IMG}</span>
</tr>
</table>
<!-- ENDIF -->
<div class="postbody">{topic_review_row.MESSAGE}</div> <div class="postbody">{topic_review_row.MESSAGE}</div>
<!-- IF topic_review_row.S_HAS_ATTACHMENTS --> <!-- IF topic_review_row.S_HAS_ATTACHMENTS -->