[feature/save-post-on-report] The complete changes for this feature

This covers all the changes so that when a report is made, the post
itself is copied and displayed in the MCP instead of the current post.
Unfortunatly, I made all commits in the wrong way and they were lost.
Now I have only the final files.
This commit is contained in:
Bruno Ais 2012-01-25 14:30:52 +00:00 committed by Oleg Pudeyev
parent 1fa39ea722
commit 95b5109c62
4 changed files with 13 additions and 6 deletions

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_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
@ -226,7 +226,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' => $report['reported_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' => array('TEXT', ''),
),
), ),
'change_columns' => array( 'change_columns' => array(
GROUPS_TABLE => array( GROUPS_TABLE => array(

View file

@ -71,8 +71,9 @@ if ($post_id)
trigger_error('POST_NOT_EXIST'); trigger_error('POST_NOT_EXIST');
} }
$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_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_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_text' => $reported_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.POST_ID == REPORTED_POST_ID -->reported<!-- ELSEIF topic_review_row.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
<div class="inner"><span class="corners-top"><span></span></span> <div class="inner"><span class="corners-top"><span></span></span>
<!-- ENDIF --> <!-- ENDIF -->