Merge remote-tracking branch 'remotes/brunoais/ticket/11171' into develop

# By Bruno Ais
# Via Bruno Ais
* remotes/brunoais/ticket/11171:
  [ticket/11171] Moved the DB schema changes to its place
  [ticket/11171] Cleanup of leftovers
  [ticket/11171] Adapted the code in report.php
  [ticket/11171] Use the options stored to decide how to show it
  [ticket/11171] DB changes for the update
  [ticket/11171] DB additions for these changes

Conflicts:
	phpBB/install/schemas/firebird_schema.sql
	phpBB/install/schemas/mssql_schema.sql
	phpBB/install/schemas/mysql_40_schema.sql
	phpBB/install/schemas/mysql_41_schema.sql
	phpBB/install/schemas/oracle_schema.sql
	phpBB/install/schemas/postgres_schema.sql
	phpBB/install/schemas/sqlite_schema.sql
This commit is contained in:
Nathan Guse 2013-01-14 12:16:59 -06:00
commit a2f6e494f3
11 changed files with 80 additions and 51 deletions

View file

@ -1520,18 +1520,21 @@ function get_schema_struct()
$schema_data['phpbb_reports'] = array(
'COLUMNS' => array(
'report_id' => array('UINT', NULL, 'auto_increment'),
'reason_id' => array('USINT', 0),
'post_id' => array('UINT', 0),
'pm_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'user_notify' => array('BOOL', 0),
'report_closed' => array('BOOL', 0),
'report_time' => array('TIMESTAMP', 0),
'report_text' => array('MTEXT_UNI', ''),
'reported_post_text' => array('MTEXT_UNI', ''),
'reported_post_uid' => array('VCHAR:8', ''),
'reported_post_bitfield' => array('VCHAR:255', ''),
'report_id' => array('UINT', NULL, 'auto_increment'),
'reason_id' => array('USINT', 0),
'post_id' => array('UINT', 0),
'pm_id' => array('UINT', 0),
'user_id' => array('UINT', 0),
'user_notify' => array('BOOL', 0),
'report_closed' => array('BOOL', 0),
'report_time' => array('TIMESTAMP', 0),
'report_text' => array('MTEXT_UNI', ''),
'reported_post_text' => array('MTEXT_UNI', ''),
'reported_post_uid' => array('VCHAR:8', ''),
'reported_post_bitfield' => array('VCHAR:255', ''),
'reported_post_enable_magic_url' => array('BOOL', 1),
'reported_post_enable_smilies' => array('BOOL', 1),
'reported_post_enable_bbcode' => array('BOOL', 1)
),
'PRIMARY_KEY' => 'report_id',
'KEYS' => array(

View file

@ -71,7 +71,7 @@ class mcp_reports
// closed reports are accessed by report id
$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, r.reported_post_text, r.reported_post_uid, r.reported_post_bitfield, 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, r.reported_post_uid, r.reported_post_bitfield, r.reported_post_enable_magic_url, r.reported_post_enable_smilies, r.reported_post_enable_bbcode, 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
WHERE ' . (($report_id) ? 'r.report_id = ' . $report_id : "r.post_id = $post_id") . '
AND rr.reason_id = r.reason_id
@ -94,6 +94,10 @@ class mcp_reports
$post_id = $report['post_id'];
$report_id = $report['report_id'];
$parse_post_flags = $report['reported_post_enable_bbcode'] ? OPTION_FLAG_BBCODE : 0;
$parse_post_flags += $report['reported_post_enable_smilies'] ? OPTION_FLAG_SMILIES : 0;
$parse_post_flags += $report['reported_post_enable_magic_url'] ? OPTION_FLAG_LINKS : 0;
$post_info = get_post_data(array($post_id), 'm_report', true);
@ -136,18 +140,7 @@ class mcp_reports
$post_unread = (isset($topic_tracking_info[$post_info['topic_id']]) && $post_info['post_time'] > $topic_tracking_info[$post_info['topic_id']]) ? true : false;
// Process message, leave it uncensored
$message = $post_info['post_text'];
if ($post_info['bbcode_bitfield'])
{
include_once($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$bbcode = new bbcode($post_info['bbcode_bitfield']);
$bbcode->bbcode_second_pass($message, $post_info['bbcode_uid'], $post_info['bbcode_bitfield']);
}
$message = bbcode_nl2br($message);
$message = smiley_text($message);
$report['report_text'] = make_clickable(bbcode_nl2br($report['report_text']));
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
@ -168,7 +161,7 @@ class mcp_reports
if (sizeof($attachments))
{
$update_count = array();
parse_attachments($post_info['forum_id'], $message, $attachments, $update_count);
parse_attachments($post_info['forum_id'], $report['reported_post_text'], $attachments, $update_count);
}
// Display not already displayed Attachments for this post, we already parsed them. ;)
@ -227,7 +220,7 @@ class mcp_reports
'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']),
'POST_PREVIEW' => generate_text_for_display($report['reported_post_text'], $report['reported_post_uid'], $report['reported_post_bitfield'], OPTION_FLAG_BBCODE | OPTION_FLAG_SMILIES, false),
'POST_PREVIEW' => generate_text_for_display($report['reported_post_text'], $report['reported_post_uid'], $report['reported_post_bitfield'], $parse_post_flags, false),
'POST_SUBJECT' => ($post_info['post_subject']) ? $post_info['post_subject'] : $user->lang['NO_SUBJECT'],
'POST_DATE' => $user->format_date($post_info['post_time']),
'POST_IP' => $post_info['poster_ip'],

View file

@ -1180,9 +1180,12 @@ function database_update_info()
'style_parent_tree' => array('TEXT', ''),
),
REPORTS_TABLE => array(
'reported_post_text' => array('MTEXT_UNI', ''),
'reported_post_uid' => array('VCHAR:8', ''),
'reported_post_bitfield' => array('VCHAR:255', ''),
'reported_post_text' => array('MTEXT_UNI', ''),
'reported_post_uid' => array('VCHAR:8', ''),
'reported_post_bitfield' => array('VCHAR:255', ''),
'reported_post_enable_bbcode' => array('BOOL', 1),
'reported_post_enable_smilies' => array('BOOL', 1),
'reported_post_enable_magic_url' => array('BOOL', 1),
),
),
'change_columns' => array(
@ -2926,6 +2929,7 @@ function change_database_data(&$no_updates, $version)
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
// Add new permissions
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);

View file

@ -913,7 +913,10 @@ CREATE TABLE phpbb_reports (
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,
reported_post_uid VARCHAR(8) CHARACTER SET NONE DEFAULT '' NOT NULL,
reported_post_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL
reported_post_bitfield VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
reported_post_enable_magic_url INTEGER DEFAULT 1 NOT NULL,
reported_post_enable_smilies INTEGER DEFAULT 1 NOT NULL,
reported_post_enable_bbcode INTEGER DEFAULT 1 NOT NULL
);;
ALTER TABLE phpbb_reports ADD PRIMARY KEY (report_id);;

View file

@ -1112,7 +1112,10 @@ CREATE TABLE [phpbb_reports] (
[report_text] [text] DEFAULT ('') NOT NULL ,
[reported_post_text] [text] DEFAULT ('') NOT NULL ,
[reported_post_uid] [varchar] (8) DEFAULT ('') NOT NULL ,
[reported_post_bitfield] [varchar] (255) DEFAULT ('') NOT NULL
[reported_post_bitfield] [varchar] (255) DEFAULT ('') NOT NULL ,
[reported_post_enable_magic_url] [int] DEFAULT (1) NOT NULL ,
[reported_post_enable_smilies] [int] DEFAULT (1) NOT NULL ,
[reported_post_enable_bbcode] [int] DEFAULT (1) NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

View file

@ -651,6 +651,9 @@ CREATE TABLE phpbb_reports (
reported_post_text mediumblob NOT NULL,
reported_post_uid varbinary(8) DEFAULT '' NOT NULL,
reported_post_bitfield varbinary(255) DEFAULT '' NOT NULL,
reported_post_enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
reported_post_enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
reported_post_enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
PRIMARY KEY (report_id),
KEY post_id (post_id),
KEY pm_id (pm_id)

View file

@ -651,6 +651,9 @@ CREATE TABLE phpbb_reports (
reported_post_text mediumtext NOT NULL,
reported_post_uid varchar(8) DEFAULT '' NOT NULL,
reported_post_bitfield varchar(255) DEFAULT '' NOT NULL,
reported_post_enable_magic_url tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
reported_post_enable_smilies tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
reported_post_enable_bbcode tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
PRIMARY KEY (report_id),
KEY post_id (post_id),
KEY pm_id (pm_id)

View file

@ -1218,6 +1218,9 @@ CREATE TABLE phpbb_reports (
reported_post_text clob DEFAULT '' ,
reported_post_uid varchar2(8) DEFAULT '' ,
reported_post_bitfield varchar2(255) DEFAULT '' ,
reported_post_enable_magic_url number(1) DEFAULT '1' NOT NULL,
reported_post_enable_smilies number(1) DEFAULT '1' NOT NULL,
reported_post_enable_bbcode number(1) DEFAULT '1' NOT NULL,
CONSTRAINT pk_phpbb_reports PRIMARY KEY (report_id)
)
/

View file

@ -857,6 +857,9 @@ CREATE TABLE phpbb_reports (
reported_post_text TEXT DEFAULT '' NOT NULL,
reported_post_uid varchar(8) DEFAULT '' NOT NULL,
reported_post_bitfield varchar(255) DEFAULT '' NOT NULL,
reported_post_enable_magic_url INT2 DEFAULT '1' NOT NULL CHECK (reported_post_enable_magic_url >= 0),
reported_post_enable_smilies INT2 DEFAULT '1' NOT NULL CHECK (reported_post_enable_smilies >= 0),
reported_post_enable_bbcode INT2 DEFAULT '1' NOT NULL CHECK (reported_post_enable_bbcode >= 0),
PRIMARY KEY (report_id)
);

View file

@ -631,7 +631,10 @@ CREATE TABLE phpbb_reports (
report_text mediumtext(16777215) NOT NULL DEFAULT '',
reported_post_text mediumtext(16777215) NOT NULL DEFAULT '',
reported_post_uid varchar(8) NOT NULL DEFAULT '',
reported_post_bitfield varchar(255) NOT NULL DEFAULT ''
reported_post_bitfield varchar(255) NOT NULL DEFAULT '',
reported_post_enable_magic_url INTEGER UNSIGNED NOT NULL DEFAULT '1',
reported_post_enable_smilies INTEGER UNSIGNED NOT NULL DEFAULT '1',
reported_post_enable_bbcode INTEGER UNSIGNED NOT NULL DEFAULT '1'
);
CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id);

View file

@ -71,11 +71,14 @@ if ($post_id)
trigger_error('POST_NOT_EXIST');
}
$forum_id = (int) $report_data['forum_id'];
$topic_id = (int) $report_data['topic_id'];
$reported_post_text = $report_data['post_text'];
$reported_post_bitfield = $report_data['bbcode_bitfield'];
$reported_post_uid = $report_data['bbcode_uid'];
$forum_id = (int) $report_data['forum_id'];
$topic_id = (int) $report_data['topic_id'];
$reported_post_text = $report_data['post_text'];
$reported_post_bitfield = $report_data['bbcode_bitfield'];
$reported_post_uid = $report_data['bbcode_uid'];
$reported_post_enable_bbcode = $report_data['enable_bbcode'];
$reported_post_enable_smilies = $report_data['enable_smilies'];
$reported_post_enable_magic_url = $report_data['enable_magic_url'];
$sql = 'SELECT *
FROM ' . FORUMS_TABLE . '
@ -134,9 +137,11 @@ else
trigger_error($message);
}
$reported_post_text = $report_data['message_text'];
$reported_post_bitfield = $report_data['bbcode_bitfield'];
$reported_post_uid = $report_data['bbcode_uid'];
$reported_post_text = $report_data['message_text'];
$reported_post_bitfield = $report_data['bbcode_bitfield'];
$reported_post_enable_bbcode = $report_data['reported_post_enable_bbcode'];
$reported_post_enable_smilies = $report_data['reported_post_enable_smilies'];
$reported_post_enable_magic_url = $report_data['reported_post_enable_magic_url'];
}
// Submit report?
@ -155,17 +160,20 @@ if ($submit && $reason_id)
}
$sql_ary = array(
'reason_id' => (int) $reason_id,
'post_id' => $post_id,
'pm_id' => $pm_id,
'user_id' => (int) $user->data['user_id'],
'user_notify' => (int) $user_notify,
'report_closed' => 0,
'report_time' => (int) time(),
'report_text' => (string) $report_text,
'reported_post_text' => $reported_post_text,
'reported_post_uid' => $reported_post_uid,
'reported_post_bitfield'=> $reported_post_bitfield,
'reason_id' => (int) $reason_id,
'post_id' => $post_id,
'pm_id' => $pm_id,
'user_id' => (int) $user->data['user_id'],
'user_notify' => (int) $user_notify,
'report_closed' => 0,
'report_time' => (int) time(),
'report_text' => (string) $report_text,
'reported_post_text' => $reported_post_text,
'reported_post_uid' => $reported_post_uid,
'reported_post_bitfield' => $reported_post_bitfield,
'reported_post_enable_bbcode' => $reported_post_enable_bbcode,
'reported_post_enable_smilies' => $reported_post_enable_smilies,
'reported_post_enable_magic_url' => $reported_post_enable_magic_url,
);
$sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);