aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install/database_update.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2009-07-21 20:59:11 +0000
committerNils Adermann <naderman@naderman.de>2009-07-21 20:59:11 +0000
commit6e4a7c03d14d6fcc03955fbe26c3d5f725eb929d (patch)
tree055fde9f035382ec59b83962cc4120022fbf7ced /phpBB/install/database_update.php
parent0ee8d7ab15caae94cdd381e9f449713c8838b611 (diff)
downloadforums-6e4a7c03d14d6fcc03955fbe26c3d5f725eb929d.tar
forums-6e4a7c03d14d6fcc03955fbe26c3d5f725eb929d.tar.gz
forums-6e4a7c03d14d6fcc03955fbe26c3d5f725eb929d.tar.bz2
forums-6e4a7c03d14d6fcc03955fbe26c3d5f725eb929d.tar.xz
forums-6e4a7c03d14d6fcc03955fbe26c3d5f725eb929d.zip
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
Diffstat (limited to 'phpBB/install/database_update.php')
-rw-r--r--phpBB/install/database_update.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 362a379ec1..3b6c614deb 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -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)