mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
- Added 'max_recipients' setting for private messages. This setting allows admins to define the maximum number of recipients per private message with a board-wide setting and a group-specific setting.
- Added new permission setting for sending private messages to groups. Now there are two permissions to define sending private messages to multiple recipients and private messages to groups. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8911 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -540,6 +540,9 @@ $database_update_info = array(
|
||||
'template_inherits_id' => array('UINT:4', 0),
|
||||
'template_inherit_path' => array('VCHAR', ''),
|
||||
),
|
||||
GROUPS_TABLE => array(
|
||||
'group_max_recipients' => array('UINT', 0),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -1413,7 +1416,7 @@ if (function_exists('exit_handler'))
|
||||
*/
|
||||
function change_database_data(&$no_updates, $version)
|
||||
{
|
||||
global $db, $map_dbms, $errored, $error_ary, $config, $phpbb_root_path;
|
||||
global $db, $map_dbms, $errored, $error_ary, $config, $phpbb_root_path, $phpEx;
|
||||
|
||||
switch ($version)
|
||||
{
|
||||
@@ -1837,22 +1840,94 @@ function change_database_data(&$no_updates, $version)
|
||||
set_config('enable_queue_trigger', '0');
|
||||
set_config('queue_trigger_posts', '3');
|
||||
|
||||
set_config('pm_max_recipients', '0');
|
||||
|
||||
// Set maximum number of recipients for the registered users, bots, guests group
|
||||
$sql = 'UPDATE ' . GROUPS_TABLE . ' SET group_max_recipients = 5
|
||||
WHERE ' . $db->sql_in_set('group_name', array('GUESTS', 'REGISTERED', 'REGISTERED_COPPA', 'BOTS'));
|
||||
_sql($sql, $errored, $error_ary);
|
||||
|
||||
// Not prefilling yet
|
||||
set_config('dbms_version', '');
|
||||
|
||||
// Resync post counts
|
||||
$sql = 'SELECT COUNT(p.post_id) AS num_posts, u.user_id
|
||||
FROM ' . USERS_TABLE . ' u
|
||||
LEFT JOIN ' . POSTS_TABLE . ' p ON (u.user_id = p.poster_id AND p.post_postcount = 1 AND p.post_approved = 1)
|
||||
GROUP BY u.user_id';
|
||||
$result = _sql($sql, $errored, $error_ary);
|
||||
// Add new permission u_masspm_group and duplicate settings from u_masspm
|
||||
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
|
||||
$auth_admin = new auth_admin();
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
// Only add the new permission if it does not already exist
|
||||
if (empty($auth_admin->acl_options['id']['u_masspm_group']))
|
||||
{
|
||||
$sql = 'UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['user_id']}";
|
||||
_sql($sql, $errored, $error_ary);
|
||||
$auth_admin->acl_add_option(array('global' => array('u_masspm_group')));
|
||||
|
||||
// Now the tricky part, filling the permission
|
||||
$old_id = $auth_admin->acl_options['id']['u_masspm'];
|
||||
$new_id = $auth_admin->acl_options['id']['u_masspm_group'];
|
||||
|
||||
$tables = array(ACL_GROUPS_TABLE, ACL_ROLES_DATA_TABLE, ACL_USERS_TABLE);
|
||||
|
||||
foreach ($tables as $table)
|
||||
{
|
||||
$sql = 'SELECT *
|
||||
FROM ' . $table . '
|
||||
WHERE auth_option_id = ' . $old_id;
|
||||
$result = _sql($sql, $errored, $error_ary);
|
||||
|
||||
$sql_ary = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$row['auth_option_id'] = $new_id;
|
||||
$sql_ary[] = $row;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($sql_ary))
|
||||
{
|
||||
$db->sql_multi_insert($table, $sql_ary);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any old permission entries
|
||||
$auth_admin->acl_clear_prefetch();
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
/**
|
||||
* Do not resync post counts here. An admin may later do this from the ACP
|
||||
$start = 0;
|
||||
|
||||
do
|
||||
{
|
||||
@flush();
|
||||
|
||||
$sql = 'SELECT COUNT(p.post_id) AS num_posts, u.user_id
|
||||
FROM ' . USERS_TABLE . ' u
|
||||
LEFT JOIN ' . POSTS_TABLE . ' p ON (u.user_id = p.poster_id AND p.post_postcount = 1 AND p.post_approved = 1)
|
||||
GROUP BY u.user_id
|
||||
ORDER BY u.user_id ASC';
|
||||
$result = $db->sql_query_limit($sql, 200, $start);
|
||||
|
||||
if ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$i = 0;
|
||||
|
||||
do
|
||||
{
|
||||
$sql = 'UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['user_id']}";
|
||||
_sql($sql, $errored, $error_ary);
|
||||
|
||||
$i++;
|
||||
}
|
||||
while ($row = $db->sql_fetchrow($result));
|
||||
|
||||
$start = ($i < 200) ? 0 : $start + 200;
|
||||
}
|
||||
else
|
||||
{
|
||||
$start = 0;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
while ($start);
|
||||
*/
|
||||
|
||||
$no_updates = false;
|
||||
break;
|
||||
|
@@ -440,6 +440,7 @@ CREATE TABLE phpbb_groups (
|
||||
group_sig_chars INTEGER DEFAULT 0 NOT NULL,
|
||||
group_receive_pm INTEGER DEFAULT 0 NOT NULL,
|
||||
group_message_limit INTEGER DEFAULT 0 NOT NULL,
|
||||
group_max_recipients INTEGER DEFAULT 0 NOT NULL,
|
||||
group_legend INTEGER DEFAULT 1 NOT NULL
|
||||
);;
|
||||
|
||||
|
@@ -545,6 +545,7 @@ CREATE TABLE [phpbb_groups] (
|
||||
[group_sig_chars] [int] DEFAULT (0) NOT NULL ,
|
||||
[group_receive_pm] [int] DEFAULT (0) NOT NULL ,
|
||||
[group_message_limit] [int] DEFAULT (0) NOT NULL ,
|
||||
[group_max_recipients] [int] DEFAULT (0) NOT NULL ,
|
||||
[group_legend] [int] DEFAULT (1) NOT NULL
|
||||
) ON [PRIMARY]
|
||||
GO
|
||||
|
@@ -312,6 +312,7 @@ CREATE TABLE phpbb_groups (
|
||||
group_sig_chars mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
group_receive_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
group_legend tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
|
||||
PRIMARY KEY (group_id),
|
||||
KEY group_legend_name (group_legend, group_name(255))
|
||||
|
@@ -312,6 +312,7 @@ CREATE TABLE phpbb_groups (
|
||||
group_sig_chars mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
group_receive_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||
group_legend tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
|
||||
PRIMARY KEY (group_id),
|
||||
KEY group_legend_name (group_legend, group_name)
|
||||
|
@@ -602,6 +602,7 @@ CREATE TABLE phpbb_groups (
|
||||
group_sig_chars number(8) DEFAULT '0' NOT NULL,
|
||||
group_receive_pm number(1) DEFAULT '0' NOT NULL,
|
||||
group_message_limit number(8) DEFAULT '0' NOT NULL,
|
||||
group_max_recipients number(8) DEFAULT '0' NOT NULL,
|
||||
group_legend number(1) DEFAULT '1' NOT NULL,
|
||||
CONSTRAINT pk_phpbb_groups PRIMARY KEY (group_id)
|
||||
)
|
||||
|
@@ -455,6 +455,7 @@ CREATE TABLE phpbb_groups (
|
||||
group_sig_chars INT4 DEFAULT '0' NOT NULL CHECK (group_sig_chars >= 0),
|
||||
group_receive_pm INT2 DEFAULT '0' NOT NULL CHECK (group_receive_pm >= 0),
|
||||
group_message_limit INT4 DEFAULT '0' NOT NULL CHECK (group_message_limit >= 0),
|
||||
group_max_recipients INT4 DEFAULT '0' NOT NULL CHECK (group_max_recipients >= 0),
|
||||
group_legend INT2 DEFAULT '1' NOT NULL CHECK (group_legend >= 0),
|
||||
PRIMARY KEY (group_id)
|
||||
);
|
||||
|
@@ -181,6 +181,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('pass_complex', 'PA
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_edit_time', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_boxes', '4');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs', '50');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_recipients', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page', '10');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('print_pm', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('queue_interval', '600');
|
||||
@@ -346,6 +347,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_download', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_hideonline', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_ignoreflood', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_masspm', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_masspm_group', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_attach', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_bbcode', 1);
|
||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_pm_delete', 1);
|
||||
@@ -487,12 +489,12 @@ INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_reg
|
||||
INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_from, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_occ, user_interests, user_actkey, user_newpasswd) VALUES (3, 5, 'Admin', 'admin', 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', 'en', 1, 1, 'AA0000', 1, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
|
||||
|
||||
# -- Groups
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid) VALUES ('GUESTS', 3, 0, '', 0, '', '', '');
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid) VALUES ('REGISTERED', 3, 0, '', 0, '', '', '');
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid) VALUES ('REGISTERED_COPPA', 3, 0, '', 0, '', '', '');
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid) VALUES ('GLOBAL_MODERATORS', 3, 0, '00AA00', 1, '', '', '');
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid) VALUES ('ADMINISTRATORS', 3, 1, 'AA0000', 1, '', '', '');
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid) VALUES ('BOTS', 3, 0, '9E8DA7', 0, '', '', '');
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GUESTS', 3, 0, '', 0, '', '', '', 5);
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED', 3, 0, '', 0, '', '', '', 5);
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED_COPPA', 3, 0, '', 0, '', '', '', 5);
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GLOBAL_MODERATORS', 3, 0, '00AA00', 1, '', '', '', 0);
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('ADMINISTRATORS', 3, 1, 'AA0000', 1, '', '', '', 0);
|
||||
INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('BOTS', 3, 0, '9E8DA7', 0, '', '', '', 5);
|
||||
|
||||
# -- User -> Group
|
||||
INSERT INTO phpbb_user_group (group_id, user_id, user_pending, group_leader) VALUES (1, 1, 0, 0);
|
||||
@@ -524,15 +526,15 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 6, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_flash', 'u_pm_forward');
|
||||
|
||||
# Limited Features (u_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 7, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_attach', 'u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_attach', 'u_pm_emailpm', 'u_pm_flash', 'u_savedrafts', 'u_search', 'u_sendemail', 'u_sendim');
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 7, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_attach', 'u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_attach', 'u_pm_emailpm', 'u_pm_flash', 'u_savedrafts', 'u_search', 'u_sendemail', 'u_sendim', 'u_masspm', 'u_masspm_group');
|
||||
|
||||
# No Private Messages (u_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 8, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_', 'u_chgavatar', 'u_chgcensors', 'u_chgemail', 'u_chgpasswd', 'u_download', 'u_hideonline', 'u_sig', 'u_viewprofile');
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 8, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_readpm', 'u_sendpm', 'u_masspm');
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 8, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_readpm', 'u_sendpm', 'u_masspm', 'u_masspm_group');
|
||||
|
||||
# No Avatar (u_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option NOT IN ('u_attach', 'u_chgavatar', 'u_viewonline', 'u_chggrp', 'u_chgname', 'u_ignoreflood', 'u_pm_attach', 'u_pm_emailpm', 'u_pm_flash', 'u_savedrafts', 'u_search', 'u_sendemail', 'u_sendim');
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_chgavatar');
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 9, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_chgavatar', 'u_masspm', 'u_masspm_group');
|
||||
|
||||
# Full Moderator (m_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 10, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%';
|
||||
|
@@ -304,6 +304,7 @@ CREATE TABLE phpbb_groups (
|
||||
group_sig_chars INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
group_receive_pm INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
group_message_limit INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
group_max_recipients INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||
group_legend INTEGER UNSIGNED NOT NULL DEFAULT '1'
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user