From 8fa8a90b898774e6fa75876e23844a388d5c0ce3 Mon Sep 17 00:00:00 2001 From: acydburn Date: Tue, 23 Sep 2008 13:11:34 +0000 Subject: [PATCH] - Automatically add users/groups to the PM recipient list, if entered or selected. - Reply to PM now includes all previous recipients and not only the original sender. - 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: http://code.phpbb.com/svn/phpbb/trunk@8914 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/acp_groups.html | 4 + phpBB/develop/create_schema_files.php | 1 + phpBB/develop/mysql_upgrader.php | 1 + phpBB/includes/acp/acp_board.php | 1 + phpBB/includes/acp/acp_groups.php | 4 +- phpBB/includes/acp/acp_main.php | 39 ++++++++-- phpBB/includes/functions_user.php | 16 ++-- phpBB/includes/mcp/mcp_queue.php | 4 +- phpBB/includes/ucp/ucp_groups.php | 6 +- phpBB/includes/ucp/ucp_pm_compose.php | 112 ++++++++++++++++++++++------ phpBB/install/schemas/schema_data.sql | 20 ++--- phpBB/language/en/acp/board.php | 3 + phpBB/language/en/acp/groups.php | 2 + phpBB/language/en/acp/permissions_phpbb.php | 3 +- phpBB/language/en/ucp.php | 2 +- phpBB/memberlist.php | 2 +- 16 files changed, 166 insertions(+), 54 deletions(-) diff --git a/phpBB/adm/style/acp_groups.html b/phpBB/adm/style/acp_groups.html index c90a075f9..5df8a16a3 100644 --- a/phpBB/adm/style/acp_groups.html +++ b/phpBB/adm/style/acp_groups.html @@ -75,6 +75,10 @@
+

{L_GROUP_MAX_RECIPIENTS_EXPLAIN}
+
+
+

{L_GROUP_COLOR_EXPLAIN}
  [ {L_COLOUR_SWATCH} ]
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 67c58e5d3..68484355e 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1167,6 +1167,7 @@ function get_schema_struct() 'group_sig_chars' => array('UINT', 0), 'group_receive_pm' => array('BOOL', 0), 'group_message_limit' => array('UINT', 0), + 'group_max_recipients' => array('UINT', 0), 'group_legend' => array('BOOL', 1), ), 'PRIMARY_KEY' => 'group_id', diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index ffe534a93..9630d1119 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -613,6 +613,7 @@ function get_schema_struct() 'group_sig_chars' => array('UINT', 0), 'group_receive_pm' => array('BOOL', 0), 'group_message_limit' => array('UINT', 0), + 'group_max_recipients' => array('UINT', 0), 'group_legend' => array('BOOL', 1), ), 'PRIMARY_KEY' => 'group_id', diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index f20479f78..b2961dfb2 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -126,6 +126,7 @@ class acp_board 'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'validate' => 'int', 'type' => 'select', 'method' => 'full_folder_select', 'explain' => true), 'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), + 'pm_max_recipients' => array('lang' => 'PM_MAX_RECIPIENTS', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true), 'legend2' => 'GENERAL_OPTIONS', 'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 6cf56a81d..279fb7f56 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -302,6 +302,7 @@ class acp_groups 'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0, 'legend' => isset($_REQUEST['group_legend']) ? 1 : 0, 'message_limit' => request_var('group_message_limit', 0), + 'max_recipients' => request_var('group_max_recipients', 0), 'founder_manage' => 0, ); @@ -394,7 +395,7 @@ class acp_groups // were made. $group_attributes = array(); - $test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'legend', 'message_limit', 'founder_manage'); + $test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'legend', 'message_limit', 'max_recipients', 'founder_manage'); foreach ($test_variables as $test) { if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test])) @@ -554,6 +555,7 @@ class acp_groups 'GROUP_FOUNDER_MANAGE' => (isset($group_row['group_founder_manage']) && $group_row['group_founder_manage']) ? ' checked="checked"' : '', 'GROUP_LEGEND' => (isset($group_row['group_legend']) && $group_row['group_legend']) ? ' checked="checked"' : '', 'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0, + 'GROUP_MAX_RECIPIENTS' => (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0, 'GROUP_COLOUR' => (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '', diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 981ffa7b1..04df75909 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -183,17 +183,40 @@ class acp_main trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } - $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 = $db->sql_query($sql); + // Resync post counts + $start = 0; - while ($row = $db->sql_fetchrow($result)) + do { - $db->sql_query('UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['user_id']}"); + $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); } - $db->sql_freeresult($result); + while ($start); add_log('admin', 'LOG_RESYNC_POSTCOUNTS'); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index ee4fa3f80..a39638bbf 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -314,8 +314,6 @@ function user_delete($mode, $user_id, $post_username = false) return false; } - $db->sql_transaction('begin'); - // Before we begin, we will remove the reports the user issued. $sql = 'SELECT r.post_id, p.topic_id FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p @@ -384,6 +382,8 @@ function user_delete($mode, $user_id, $post_username = false) { case 'retain': + $db->sql_transaction('begin'); + if ($post_username === false) { $post_username = $user->lang['GUEST']; @@ -431,6 +431,9 @@ function user_delete($mode, $user_id, $post_username = false) $db->sql_query($sql); } } + + $db->sql_transaction('commit'); + break; case 'remove': @@ -484,6 +487,8 @@ function user_delete($mode, $user_id, $post_username = false) break; } + $db->sql_transaction('begin'); + $table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, FORUMS_TRACK_TABLE, PROFILE_FIELDS_DATA_TABLE, MODERATOR_CACHE_TABLE, DRAFTS_TABLE, BOOKMARKS_TABLE); foreach ($table_ary as $table) @@ -552,6 +557,8 @@ function user_delete($mode, $user_id, $post_username = false) $db->sql_query($sql); } + $db->sql_transaction('commit'); + // Reset newest user info if appropriate if ($config['newest_user_id'] == $user_id) { @@ -564,8 +571,6 @@ function user_delete($mode, $user_id, $post_username = false) set_config('num_users', $config['num_users'] - 1, true); } - $db->sql_transaction('commit'); - return false; } @@ -2274,12 +2279,13 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow 'group_receive_pm' => 'int', 'group_legend' => 'int', 'group_message_limit' => 'int', + 'group_max_recipients' => 'int', 'group_founder_manage' => 'int', ); // Those are group-only attributes - $group_only_ary = array('group_receive_pm', 'group_legend', 'group_message_limit', 'group_founder_manage'); + $group_only_ary = array('group_receive_pm', 'group_legend', 'group_message_limit', 'group_max_recipients', 'group_founder_manage'); // Check data. Limit group name length. if (!utf8_strlen($name) || utf8_strlen($name) > 60) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index d9c5dbb75..3ada0539f 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -958,11 +958,11 @@ function disapprove_post($post_id_list, $id, $mode) $lang_reasons[$post_data['user_lang']] = $user->lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang]; // Only load up the language pack if the language is different to the current one - if ($post_data['user_lang'] != $user->lang_name && file_exists($phpbb_root_path . '/language/' . $post_data['user_lang'] . '/mcp.' . $phpEx)) + if ($post_data['user_lang'] != $user->lang_name && file_exists(PHPBB_ROOT_PATH . '/language/' . $post_data['user_lang'] . '/mcp.' . PHP_EXT)) { // Load up the language pack $lang = array(); - @include($phpbb_root_path . '/language/' . $post_data['user_lang'] . '/mcp.' . $phpEx); + @include(PHPBB_ROOT_PATH . '/language/' . $post_data['user_lang'] . '/mcp.' . PHP_EXT); // If we find the reason in this language pack use it if (isset($lang['report_reasons']['DESCRIPTION'][$disapprove_reason_lang])) diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 943472e54..212348f0f 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -504,7 +504,8 @@ class ucp_groups 'colour' => request_var('group_colour', ''), 'rank' => request_var('group_rank', 0), 'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0, - 'message_limit' => request_var('group_message_limit', 0) + 'message_limit' => request_var('group_message_limit', 0), + 'max_recipients'=> request_var('group_max_recipients', 0), ); $data['uploadurl'] = request_var('uploadurl', ''); @@ -602,7 +603,7 @@ class ucp_groups // were made. $group_attributes = array(); - $test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height'); + $test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'legend', 'message_limit', 'max_recipients'); foreach ($test_variables as $test) { if ($action == 'add' || (isset($submit_ary[$test]) && $group_row['group_' . $test] != $submit_ary[$test])) @@ -692,6 +693,7 @@ class ucp_groups 'ERROR_MSG' => (sizeof($error)) ? implode('
', $error) : '', 'GROUP_RECEIVE_PM' => (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '', 'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0, + 'GROUP_MAX_RECIPIENTS' => (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0, 'GROUP_DESC' => $group_desc_data['text'], 'S_DESC_BBCODE_CHECKED' => $group_desc_data['allow_bbcode'], diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 5a480e290..405d7a441 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -44,6 +44,11 @@ function compose_pm($id, $mode, $action) // Do NOT use request_var or specialchars here $address_list = isset($_REQUEST['address_list']) ? $_REQUEST['address_list'] : array(); + if (!is_array($address_list)) + { + $address_list = array(); + } + $submit = (isset($_POST['post'])) ? true : false; $preview = (isset($_POST['preview'])) ? true : false; $save = (isset($_POST['save'])) ? true : false; @@ -78,7 +83,8 @@ function compose_pm($id, $mode, $action) // Output PM_TO box if message composing if ($action != 'edit') { - if ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) + // Add groups to PM box + if ($config['allow_mass_pm'] && $auth->acl_get('u_masspm_group')) { $sql = 'SELECT g.group_id, g.group_name, g.group_type FROM ' . GROUPS_TABLE . ' g'; @@ -111,7 +117,7 @@ function compose_pm($id, $mode, $action) $template->assign_vars(array( 'S_SHOW_PM_BOX' => true, 'S_ALLOW_MASS_PM' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? true : false, - 'S_GROUP_OPTIONS' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? $group_options : '', + 'S_GROUP_OPTIONS' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm_group')) ? $group_options : '', 'U_FIND_USERNAME' => append_sid('memberlist', "mode=searchuser&form=postform&field=username_list&select_single=$select_single"), )); } @@ -280,7 +286,24 @@ function compose_pm($id, $mode, $action) if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !sizeof($address_list) && !$refresh && !$submit && !$preview) { - $address_list = array('u' => array($post['author_id'] => 'to')); + if ($action == 'quotepost') + { + $address_list = array('u' => array($post['author_id'] => 'to')); + } + else + { + // We try to include every previously listed member from the TO Header + $address_list = rebuild_header(array('to' => $post['to_address'])); + + // Add the author (if he is already listed then this is no shame (it will be overwritten)) + $address_list['u'][$post['author_id']] = 'to'; + + // Now, make sure the user itself is not listed. ;) + if (isset($address_list['u'][$user->data['user_id']])) + { + unset($address_list['u'][$user->data['user_id']]); + } + } } else if ($action == 'edit' && !sizeof($address_list) && !$refresh && !$submit && !$preview) { @@ -314,7 +337,7 @@ function compose_pm($id, $mode, $action) $check_value = 0; } - if (($to_group_id || isset($address_list['g'])) && (!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm'))) + if (($to_group_id || isset($address_list['g'])) && (!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group'))) { trigger_error('NO_AUTH_GROUP_MESSAGE'); } @@ -379,14 +402,43 @@ function compose_pm($id, $mode, $action) redirect(append_sid('ucp', 'i=pm&mode=view&action=view_message&p=' . $msg_id)); } + // Get maximum number of allowed recipients + $sql = 'SELECT MAX(g.group_max_recipients) as max_recipients + FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug + WHERE ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + AND ug.group_id = g.group_id'; + $result = $db->sql_query($sql); + $max_recipients = (int) $db->sql_fetchfield('max_recipients'); + $db->sql_freeresult($result); + + $max_recipients = (!$max_recipients) ? $config['pm_max_recipients'] : $max_recipients; + + // Damn php and globals - i know, this is horrible + global $refresh, $submit, $preview; + // Handle User/Group adding/removing handle_message_list_actions($address_list, $error, $remove_u, $remove_g, $add_to, $add_bcc); - // Check for too many recipients + // Check mass pm to group permission + if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group')) && !empty($address_list['g'])) + { + $address_list = array(); + $error[] = $user->lang['NO_AUTH_GROUP_MESSAGE']; + } + + // Check mass pm to users permission if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm')) && num_recipients($address_list) > 1) { - $address_list = get_recipient_pos($address_list, 1); - $error[] = $user->lang['TOO_MANY_RECIPIENTS']; + $address_list = get_recipients($address_list, 1); + $error[] = $user->lang('TOO_MANY_RECIPIENTS', 1); + } + + // Check for too many recipients + if (!empty($address_list['u']) && $max_recipients && sizeof($address_list['u']) > $max_recipients) + { + $address_list = get_recipients($address_list, $max_recipients); + $error[] = $user->lang('TOO_MANY_RECIPIENTS', $max_recipients); } // Always check if the submitted attachment data is valid and belongs to the user. @@ -948,6 +1000,7 @@ function compose_pm($id, $mode, $action) 'URL_STATUS' => ($url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['PM']), 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', + 'MAX_RECIPIENTS' => ($config['allow_mass_pm'] && ($auth->acl_get('u_masspm') || $auth->acl_get('u_masspm_group'))) ? $max_recipients : 0, 'S_COMPOSE_PM' => true, 'S_EDIT_POST' => ($action == 'edit'), @@ -1026,14 +1079,33 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove } } + // Add Selected Groups + $group_list = request_var('group_list', array(0)); + + // Build usernames to add + $usernames = (isset($_REQUEST['username'])) ? array(request_var('username', '', true)) : array(); + $username_list = request_var('username_list', '', true); + if ($username_list) + { + $usernames = array_merge($usernames, explode("\n", $username_list)); + } + + // If add to or add bcc not pressed, users could still have usernames listed they want to add... + if (!$add_to && !$add_bcc && (sizeof($group_list) || sizeof($usernames))) + { + $add_to = true; + + global $refresh, $submit, $preview; + + $refresh = $preview = true; + $submit = false; + } + // Add User/Group [TO] if ($add_to || $add_bcc) { $type = ($add_to) ? 'to' : 'bcc'; - // Add Selected Groups - $group_list = request_var('group_list', array(0)); - if (sizeof($group_list)) { foreach ($group_list as $group_id) @@ -1045,14 +1117,6 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove // User ID's to add... $user_id_ary = array(); - // Build usernames to add - $usernames = (isset($_REQUEST['username'])) ? array(request_var('username', '', true)) : array(); - $username_list = request_var('username_list', '', true); - if ($username_list) - { - $usernames = array_merge($usernames, explode("\n", $username_list)); - } - // Reveal the correct user_ids if (sizeof($usernames)) { @@ -1067,7 +1131,7 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove } // Add Friends if specified - $friend_list = (is_array($_REQUEST['add_' . $type])) ? array_map('intval', array_keys($_REQUEST['add_' . $type])) : array(); + $friend_list = (isset($_REQUEST['add_' . $type]) && is_array($_REQUEST['add_' . $type])) ? array_map('intval', array_keys($_REQUEST['add_' . $type])) : array(); $user_id_ary = array_merge($user_id_ary, $friend_list); foreach ($user_id_ary as $user_id) @@ -1143,22 +1207,22 @@ function num_recipients($address_list) } /** -* Get recipient at position 'pos' +* Get number of 'num_recipients' recipients from first position */ -function get_recipient_pos($address_list, $position = 1) +function get_recipients($address_list, $num_recipients = 1) { $recipient = array(); - $count = 1; + $count = 0; foreach ($address_list as $field => $adr_ary) { foreach ($adr_ary as $id => $type) { - if ($count == $position) + if ($count >= $num_recipients) { - $recipient[$field][$id] = $type; break 2; } + $recipient[$field][$id] = $type; $count++; } } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index a6d0c328a..02b593987 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -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_name_clean, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid) VALUES ('GUESTS', 'guests', 3, 0, '', 0, '', '', ''); -INSERT INTO phpbb_groups (group_name, group_name_clean, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid) VALUES ('REGISTERED', 'registered', 3, 0, '', 0, '', '', ''); -INSERT INTO phpbb_groups (group_name, group_name_clean, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid) VALUES ('REGISTERED_COPPA', 'registered_coppa', 3, 0, '', 0, '', '', ''); -INSERT INTO phpbb_groups (group_name, group_name_clean, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid) VALUES ('GLOBAL_MODERATORS', 'global_moderators', 3, 0, '00AA00', 1, '', '', ''); -INSERT INTO phpbb_groups (group_name, group_name_clean, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid) VALUES ('ADMINISTRATORS', 'administrators', 3, 1, 'AA0000', 1, '', '', ''); -INSERT INTO phpbb_groups (group_name, group_name_clean, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid) VALUES ('BOTS', 'bots', 3, 0, '9E8DA7', 0, '', '', ''); +INSERT INTO phpbb_groups (group_name, group_name_clean, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GUESTS', 'guests', 3, 0, '', 0, '', '', '', 5); +INSERT INTO phpbb_groups (group_name, group_name_clean, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED', 'registered', 3, 0, '', 0, '', '', '', 5); +INSERT INTO phpbb_groups (group_name, group_name_clean, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED_COPPA', 'registered_coppa', 3, 0, '', 0, '', '', '', 5); +INSERT INTO phpbb_groups (group_name, group_name_clean, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GLOBAL_MODERATORS', 'global_moderators', 3, 0, '00AA00', 1, '', '', '', 0); +INSERT INTO phpbb_groups (group_name, group_name_clean, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('ADMINISTRATORS', 'administrators', 3, 1, 'AA0000', 1, '', '', '', 0); +INSERT INTO phpbb_groups (group_name, group_name_clean, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('BOTS', '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_%'; diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index e61f04904..77e04e61c 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -113,6 +113,7 @@ $lang = array_merge($lang, array( 'ALLOW_FORWARD_PM' => 'Allow forwarding of private messages', 'ALLOW_IMG_PM' => 'Allow use of [IMG] BBCode tag', 'ALLOW_MASS_PM' => 'Allow sending of private messages to multiple users and groups', + 'ALLOW_MASS_PM_EXPLAIN' => 'Sending to groups can be adjusted per group within the group settings page.', 'ALLOW_PRINT_PM' => 'Allow print view in private messaging', 'ALLOW_QUOTE_PM' => 'Allow quotes in private messages', 'ALLOW_SIG_PM' => 'Allow signature in private messages', @@ -127,6 +128,8 @@ $lang = array_merge($lang, array( 'HOLD_NEW_MESSAGES' => 'Hold new messages', 'PM_EDIT_TIME' => 'Limit editing time', 'PM_EDIT_TIME_EXPLAIN' => 'Limits the time available to edit a private message not already delivered. Setting the value to 0 disables this behaviour.', + 'PM_MAX_RECIPIENTS' => 'Maximum number of allowed recipients', + 'PM_MAX_RECIPIENTS_EXPLAIN' => 'The maximum number of allowed recipients in a private message. If 0 is entered, an unlimited number is allowed. This setting can be adjusted for every group within the group settings page.', )); // Post Settings diff --git a/phpBB/language/en/acp/groups.php b/phpBB/language/en/acp/groups.php index f74110a7d..db6f33454 100644 --- a/phpBB/language/en/acp/groups.php +++ b/phpBB/language/en/acp/groups.php @@ -86,6 +86,8 @@ $lang = array_merge($lang, array( 'GROUP_NAME_TAKEN' => 'The group name you entered is already in use, please select an alternative.', 'GROUP_OPEN' => 'Open', 'GROUP_PENDING' => 'Pending members', + 'GROUP_MAX_RECIPIENTS' => 'Maximum number of allowed recipients per private message', + 'GROUP_MAX_RECIPIENTS_EXPLAIN' => 'The maximum number of allowed recipients in a private message. If 0 is entered, the board-wide setting is used.', 'GROUP_PROMOTE' => 'Promote to group leader', 'GROUP_RANK' => 'Group rank', 'GROUP_RECEIVE_PM' => 'Group able to receive private messages', diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php index 8f090667b..c8ccc0e56 100644 --- a/phpBB/language/en/acp/permissions_phpbb.php +++ b/phpBB/language/en/acp/permissions_phpbb.php @@ -111,7 +111,8 @@ $lang = array_merge($lang, array( 'acl_u_sig' => array('lang' => 'Can use signature', 'cat' => 'post'), 'acl_u_sendpm' => array('lang' => 'Can send private messages', 'cat' => 'pm'), - 'acl_u_masspm' => array('lang' => 'Can send pm to multiple users and groups', 'cat' => 'pm'), + 'acl_u_masspm' => array('lang' => 'Can send messages to multiple users', 'cat' => 'pm'), + 'acl_u_masspm_group'=> array('lang' => 'Can send messages to groups', 'cat' => 'pm'), 'acl_u_readpm' => array('lang' => 'Can read private messages', 'cat' => 'pm'), 'acl_u_pm_edit' => array('lang' => 'Can edit own private messages', 'cat' => 'pm'), 'acl_u_pm_delete' => array('lang' => 'Can remove private messages from own folder', 'cat' => 'pm'), diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 6f262b980..79026af56 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -391,7 +391,7 @@ $lang = array_merge($lang, array( 'TIMEZONE' => 'Timezone', 'TO' => 'To', - 'TOO_MANY_RECIPIENTS' => 'Too many recipients.', + 'TOO_MANY_RECIPIENTS' => 'You tried to send a private message to too many recipients.', 'TOO_MANY_REGISTERS' => 'You have exceeded the maximum number of registration attempts for this session. Please try again later.', 'UCP' => 'User Control Panel', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index c367653d4..361c9921a 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1156,7 +1156,7 @@ switch ($mode) 'RANK_IMG' => $rank_img, 'RANK_IMG_SRC' => $rank_img_src, - 'U_PM' => ($auth->acl_get('u_sendpm') && $auth->acl_get('u_masspm') && $group_row['group_receive_pm'] && $config['allow_privmsg'] && $config['allow_mass_pm']) ? append_sid('ucp', 'i=pm&mode=compose&g=' . $group_id) : '',) + 'U_PM' => ($auth->acl_get('u_sendpm') && $auth->acl_get('u_masspm_group') && $group_row['group_receive_pm'] && $config['allow_privmsg'] && $config['allow_mass_pm']) ? append_sid('ucp', 'i=pm&mode=compose&g=' . $group_id) : '',) ); $sql_select = ', ug.group_leader'; -- 2.11.4.GIT