mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-14 12:44:06 +02:00
Users can report PMs to moderators which are then visible in a new MCP module
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9814 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -701,11 +701,21 @@ function database_update_info()
|
||||
GROUPS_TABLE => array(
|
||||
'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'),
|
||||
),
|
||||
PRIVMSGS_TABLE => array(
|
||||
'message_reported' => array('BOOL', 0),
|
||||
),
|
||||
REPORTS_TABLE => array(
|
||||
'pm_id' => array('UINT', 0),
|
||||
),
|
||||
),
|
||||
'add_index' => array(
|
||||
LOG_TABLE => array(
|
||||
'log_time' => array('log_time'),
|
||||
),
|
||||
REPORTS_TABLE => array(
|
||||
'post_id' => array('post_id'),
|
||||
'pm_id' => array('pm_id'),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -1076,6 +1086,9 @@ function change_database_data(&$no_updates, $version)
|
||||
// Entries for smiley pagination
|
||||
set_config('smilies_per_page', '50');
|
||||
|
||||
// Entry for reporting PMs
|
||||
set_config('allow_pm_report', '1');
|
||||
|
||||
include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx);
|
||||
|
||||
$_module = new acp_modules();
|
||||
@@ -1168,6 +1181,58 @@ function change_database_data(&$no_updates, $version)
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
||||
// Also install the "PM Reports" module
|
||||
$sql = 'SELECT module_id
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_class = 'mcp'
|
||||
AND module_langname = 'MCP_REPORTS'
|
||||
AND module_mode = ''
|
||||
AND module_basename = ''";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$category_id = (int) $row['module_id'];
|
||||
|
||||
$modes = array(
|
||||
'pm_reports' => array('title' => 'MCP_PM_REPORTS_OPEN', 'auth' => 'aclf_m_report'),
|
||||
'pm_reports_closed' => array('title' => 'MCP_PM_REPORTS_CLOSED', 'auth' => 'aclf_m_report'),
|
||||
'pm_report_details' => array('title' => 'MCP_PM_REPORT_DETAILS', 'auth' => 'aclf_m_report'),
|
||||
);
|
||||
|
||||
foreach ($modes as $mode => $data)
|
||||
{
|
||||
// Check if we actually need to add the module or if it is already added. ;)
|
||||
$sql = 'SELECT *
|
||||
FROM ' . MODULES_TABLE . "
|
||||
WHERE module_class = 'mcp'
|
||||
AND module_langname = '{$data['title']}'
|
||||
AND module_mode = '$mode'
|
||||
AND parent_id = {$category_id}";
|
||||
$result2 = $db->sql_query($sql);
|
||||
$row2 = $db->sql_fetchrow($result2);
|
||||
$db->sql_freeresult($result2);
|
||||
|
||||
if (!$row2)
|
||||
{
|
||||
$module_data = array(
|
||||
'module_basename' => 'users',
|
||||
'module_enabled' => 1,
|
||||
'module_display' => 1,
|
||||
'parent_id' => $category_id,
|
||||
'module_class' => 'mcp',
|
||||
'module_langname' => $data['title'],
|
||||
'module_mode' => $mode,
|
||||
'module_auth' => $data['auth'],
|
||||
);
|
||||
|
||||
$_module->update_module_data($module_data, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$_module->remove_cache_file();
|
||||
|
||||
// Add newly_registered group... but check if it already exists (we always supported running the updater on any schema)
|
||||
|
@@ -685,7 +685,8 @@ CREATE TABLE phpbb_privmsgs (
|
||||
message_edit_time INTEGER DEFAULT 0 NOT NULL,
|
||||
message_edit_count INTEGER DEFAULT 0 NOT NULL,
|
||||
to_address BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL,
|
||||
bcc_address BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL
|
||||
bcc_address BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL,
|
||||
message_reported INTEGER DEFAULT 0 NOT NULL
|
||||
);;
|
||||
|
||||
ALTER TABLE phpbb_privmsgs ADD PRIMARY KEY (msg_id);;
|
||||
@@ -872,6 +873,7 @@ CREATE TABLE phpbb_reports (
|
||||
report_id INTEGER NOT NULL,
|
||||
reason_id INTEGER DEFAULT 0 NOT NULL,
|
||||
post_id INTEGER DEFAULT 0 NOT NULL,
|
||||
pm_id INTEGER DEFAULT 0 NOT NULL,
|
||||
user_id INTEGER DEFAULT 0 NOT NULL,
|
||||
user_notify INTEGER DEFAULT 0 NOT NULL,
|
||||
report_closed INTEGER DEFAULT 0 NOT NULL,
|
||||
@@ -881,6 +883,8 @@ CREATE TABLE phpbb_reports (
|
||||
|
||||
ALTER TABLE phpbb_reports ADD PRIMARY KEY (report_id);;
|
||||
|
||||
CREATE INDEX phpbb_reports_post_id ON phpbb_reports(post_id);;
|
||||
CREATE INDEX phpbb_reports_pm_id ON phpbb_reports(pm_id);;
|
||||
|
||||
CREATE GENERATOR phpbb_reports_gen;;
|
||||
SET GENERATOR phpbb_reports_gen TO 0;;
|
||||
|
@@ -831,7 +831,8 @@ CREATE TABLE [phpbb_privmsgs] (
|
||||
[message_edit_time] [int] DEFAULT (0) NOT NULL ,
|
||||
[message_edit_count] [int] DEFAULT (0) NOT NULL ,
|
||||
[to_address] [varchar] (4000) DEFAULT ('') NOT NULL ,
|
||||
[bcc_address] [varchar] (4000) DEFAULT ('') NOT NULL
|
||||
[bcc_address] [varchar] (4000) DEFAULT ('') NOT NULL ,
|
||||
[message_reported] [int] DEFAULT (0) NOT NULL
|
||||
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||
GO
|
||||
|
||||
@@ -1055,6 +1056,7 @@ CREATE TABLE [phpbb_reports] (
|
||||
[report_id] [int] IDENTITY (1, 1) NOT NULL ,
|
||||
[reason_id] [int] DEFAULT (0) NOT NULL ,
|
||||
[post_id] [int] DEFAULT (0) NOT NULL ,
|
||||
[pm_id] [int] DEFAULT (0) NOT NULL ,
|
||||
[user_id] [int] DEFAULT (0) NOT NULL ,
|
||||
[user_notify] [int] DEFAULT (0) NOT NULL ,
|
||||
[report_closed] [int] DEFAULT (0) NOT NULL ,
|
||||
@@ -1070,6 +1072,12 @@ ALTER TABLE [phpbb_reports] WITH NOCHECK ADD
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE INDEX [post_id] ON [phpbb_reports]([post_id]) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
CREATE INDEX [pm_id] ON [phpbb_reports]([pm_id]) ON [PRIMARY]
|
||||
GO
|
||||
|
||||
|
||||
/*
|
||||
Table: 'phpbb_reports_reasons'
|
||||
|
@@ -486,6 +486,7 @@ CREATE TABLE phpbb_privmsgs (
|
||||
message_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
to_address blob NOT NULL,
|
||||
bcc_address blob NOT NULL,
|
||||
message_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
PRIMARY KEY (msg_id),
|
||||
KEY author_ip (author_ip),
|
||||
KEY message_time (message_time),
|
||||
@@ -609,12 +610,15 @@ CREATE TABLE phpbb_reports (
|
||||
report_id mediumint(8) UNSIGNED NOT NULL auto_increment,
|
||||
reason_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
pm_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
user_notify 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_text mediumblob NOT NULL,
|
||||
PRIMARY KEY (report_id)
|
||||
PRIMARY KEY (report_id),
|
||||
KEY post_id (post_id),
|
||||
KEY pm_id (pm_id)
|
||||
);
|
||||
|
||||
|
||||
|
@@ -486,6 +486,7 @@ CREATE TABLE phpbb_privmsgs (
|
||||
message_edit_count smallint(4) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
to_address text NOT NULL,
|
||||
bcc_address text NOT NULL,
|
||||
message_reported tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
PRIMARY KEY (msg_id),
|
||||
KEY author_ip (author_ip),
|
||||
KEY message_time (message_time),
|
||||
@@ -609,12 +610,15 @@ CREATE TABLE phpbb_reports (
|
||||
report_id mediumint(8) UNSIGNED NOT NULL auto_increment,
|
||||
reason_id smallint(4) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
pm_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
user_notify 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_text mediumtext NOT NULL,
|
||||
PRIMARY KEY (report_id)
|
||||
PRIMARY KEY (report_id),
|
||||
KEY post_id (post_id),
|
||||
KEY pm_id (pm_id)
|
||||
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
|
||||
|
||||
|
||||
|
@@ -923,6 +923,7 @@ CREATE TABLE phpbb_privmsgs (
|
||||
message_edit_count number(4) DEFAULT '0' NOT NULL,
|
||||
to_address clob DEFAULT '' ,
|
||||
bcc_address clob DEFAULT '' ,
|
||||
message_reported number(1) DEFAULT '0' NOT NULL,
|
||||
CONSTRAINT pk_phpbb_privmsgs PRIMARY KEY (msg_id)
|
||||
)
|
||||
/
|
||||
@@ -1164,6 +1165,7 @@ CREATE TABLE phpbb_reports (
|
||||
report_id number(8) NOT NULL,
|
||||
reason_id number(4) DEFAULT '0' NOT NULL,
|
||||
post_id number(8) DEFAULT '0' NOT NULL,
|
||||
pm_id number(8) DEFAULT '0' NOT NULL,
|
||||
user_id number(8) DEFAULT '0' NOT NULL,
|
||||
user_notify number(1) DEFAULT '0' NOT NULL,
|
||||
report_closed number(1) DEFAULT '0' NOT NULL,
|
||||
@@ -1173,6 +1175,10 @@ CREATE TABLE phpbb_reports (
|
||||
)
|
||||
/
|
||||
|
||||
CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id)
|
||||
/
|
||||
CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id)
|
||||
/
|
||||
|
||||
CREATE SEQUENCE phpbb_reports_seq
|
||||
/
|
||||
|
@@ -659,6 +659,7 @@ CREATE TABLE phpbb_privmsgs (
|
||||
message_edit_count INT2 DEFAULT '0' NOT NULL CHECK (message_edit_count >= 0),
|
||||
to_address varchar(4000) DEFAULT '' NOT NULL,
|
||||
bcc_address varchar(4000) DEFAULT '' NOT NULL,
|
||||
message_reported INT2 DEFAULT '0' NOT NULL CHECK (message_reported >= 0),
|
||||
PRIMARY KEY (msg_id)
|
||||
);
|
||||
|
||||
@@ -810,6 +811,7 @@ CREATE TABLE phpbb_reports (
|
||||
report_id INT4 DEFAULT nextval('phpbb_reports_seq'),
|
||||
reason_id INT2 DEFAULT '0' NOT NULL CHECK (reason_id >= 0),
|
||||
post_id INT4 DEFAULT '0' NOT NULL CHECK (post_id >= 0),
|
||||
pm_id INT4 DEFAULT '0' NOT NULL CHECK (pm_id >= 0),
|
||||
user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
|
||||
user_notify INT2 DEFAULT '0' NOT NULL CHECK (user_notify >= 0),
|
||||
report_closed INT2 DEFAULT '0' NOT NULL CHECK (report_closed >= 0),
|
||||
@@ -818,6 +820,8 @@ CREATE TABLE phpbb_reports (
|
||||
PRIMARY KEY (report_id)
|
||||
);
|
||||
|
||||
CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id);
|
||||
CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id);
|
||||
|
||||
/*
|
||||
Table: 'phpbb_reports_reasons'
|
||||
|
@@ -23,6 +23,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_name_chars',
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_namechange', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_nocensors', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_pm_attach', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_pm_report', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_flash', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_links', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_privmsg', '1');
|
||||
|
@@ -471,7 +471,8 @@ CREATE TABLE phpbb_privmsgs (
|
||||
message_edit_time INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
message_edit_count INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
to_address text(65535) NOT NULL DEFAULT '',
|
||||
bcc_address text(65535) NOT NULL DEFAULT ''
|
||||
bcc_address text(65535) NOT NULL DEFAULT '',
|
||||
message_reported INTEGER UNSIGNED NOT NULL DEFAULT '0'
|
||||
);
|
||||
|
||||
CREATE INDEX phpbb_privmsgs_author_ip ON phpbb_privmsgs (author_ip);
|
||||
@@ -590,6 +591,7 @@ CREATE TABLE phpbb_reports (
|
||||
report_id INTEGER PRIMARY KEY NOT NULL ,
|
||||
reason_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
post_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
pm_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
user_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
user_notify INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
report_closed INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
@@ -597,6 +599,8 @@ CREATE TABLE phpbb_reports (
|
||||
report_text mediumtext(16777215) NOT NULL DEFAULT ''
|
||||
);
|
||||
|
||||
CREATE INDEX phpbb_reports_post_id ON phpbb_reports (post_id);
|
||||
CREATE INDEX phpbb_reports_pm_id ON phpbb_reports (pm_id);
|
||||
|
||||
# Table: 'phpbb_reports_reasons'
|
||||
CREATE TABLE phpbb_reports_reasons (
|
||||
|
Reference in New Issue
Block a user