mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-10 18:54:08 +02:00
- [Feature] New "Newly Registered Users" group for assigning permissions to newly registered users. They will be removed from this group once they reach a defineable amount of posts.
- [Feature] Ability to define if the "Newly Registered Users" group will be assigned as the default group to newly registered users. As a coincidence also Bug #46535 got fixed. Additionally the error message displayed with trigger_error() if accessing the private message tab in the ucp is now displayed inline in addition to a slightly different message for newly registered users to let them know that access permissions may be lifted over time. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9636 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -687,17 +687,18 @@ function database_update_info()
|
||||
CONFIRM_TABLE => array(
|
||||
'attempts' => array('UINT', 0),
|
||||
),
|
||||
USERS_TABLE => array(
|
||||
'user_new' => array('BOOL', 1),
|
||||
),
|
||||
GROUPS_TABLE => array(
|
||||
'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'),
|
||||
),
|
||||
),
|
||||
'add_index' => array(
|
||||
LOG_TABLE => array(
|
||||
'log_time' => array('log_time'),
|
||||
),
|
||||
),
|
||||
'add_columns' => array(
|
||||
GROUPS_TABLE => array(
|
||||
'group_skip_auth' => array('BOOL', 0, 'after' => 'group_founder_manage'),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1115,6 +1116,136 @@ function change_database_data(&$no_updates, $version)
|
||||
|
||||
$_module->remove_cache_file();
|
||||
|
||||
// Add newly_registered group... but check if it already exists (we always supported running the updater on any schema)
|
||||
$sql = 'SELECT group_id
|
||||
FROM ' . GROUPS_TABLE . "
|
||||
WHERE group_name = 'NEWLY_REGISTERED'";
|
||||
$result = $db->sql_query($sql);
|
||||
$group_id = (int) $db->sql_fetchfield('group_id');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$group_id)
|
||||
{
|
||||
$sql = 'INSERT INTO ' . GROUPS_TABLE . " (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, '', '', '', 5)";
|
||||
_sql($sql, $errored, $error_ary);
|
||||
|
||||
$group_id = $db->sql_nextid();
|
||||
}
|
||||
|
||||
// Insert new user role... at the end of the chain
|
||||
$sql = 'SELECT role_id
|
||||
FROM ' . ACL_ROLES_TABLE . "
|
||||
WHERE role_name = 'ROLE_USER_NEW_MEMBER'
|
||||
AND role_type = 'u_'";
|
||||
$result = $db->sql_query($sql);
|
||||
$u_role = (int) $db->sql_fetchfield('role_id');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$u_role)
|
||||
{
|
||||
$sql = 'SELECT MAX(role_order) as max_order_id
|
||||
FROM ' . ACL_ROLES_TABLE . "
|
||||
WHERE role_type = 'u_'";
|
||||
$result = $db->sql_query($sql);
|
||||
$next_order_id = (int) $db->sql_fetchfield('max_order_id');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$next_order_id++;
|
||||
|
||||
$sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NEW_MEMBER', 'ROLE_DESCRIPTION_USER_NEW_MEMBER', 'u_', $next_order_id)";
|
||||
_sql($sql, $errored, $error_ary);
|
||||
$u_role = $db->sql_nextid();
|
||||
|
||||
if (!$errored)
|
||||
{
|
||||
// Now add the correct data to the roles...
|
||||
// The standard role says that new users are not able to send a PM, Mass PM, are not able to PM groups
|
||||
$sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $u_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group')";
|
||||
_sql($sql, $errored, $error_ary);
|
||||
|
||||
// Add user role to group
|
||||
$sql = 'INSERT INTO ' . ACL_GROUPS_TABLE . " (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES ($group_id, 0, 0, $u_role, 0)";
|
||||
_sql($sql, $errored, $error_ary);
|
||||
}
|
||||
}
|
||||
|
||||
// Insert new forum role
|
||||
$sql = 'SELECT role_id
|
||||
FROM ' . ACL_ROLES_TABLE . "
|
||||
WHERE role_name = 'ROLE_FORUM_NEW_MEMBER'
|
||||
AND role_type = 'f_'";
|
||||
$result = $db->sql_query($sql);
|
||||
$f_role = (int) $db->sql_fetchfield('role_id');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (!$f_role)
|
||||
{
|
||||
$sql = 'SELECT MAX(role_order) as max_order_id
|
||||
FROM ' . ACL_ROLES_TABLE . "
|
||||
WHERE role_type = 'f_'";
|
||||
$result = $db->sql_query($sql);
|
||||
$next_order_id = (int) $db->sql_fetchfield('max_order_id');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$next_order_id++;
|
||||
|
||||
$sql = 'INSERT INTO ' . ACL_ROLES_TABLE . " (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', $next_order_id)";
|
||||
_sql($sql, $errored, $error_ary);
|
||||
$f_role = $db->sql_nextid();
|
||||
|
||||
if (!$errored)
|
||||
{
|
||||
$sql = 'INSERT INTO ' . ACL_ROLES_DATA_TABLE . " (role_id, auth_option_id, auth_setting) SELECT $f_role, auth_option_id, 0 FROM " . ACL_OPTIONS_TABLE . " WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove')";
|
||||
_sql($sql, $errored, $error_ary);
|
||||
}
|
||||
}
|
||||
|
||||
// Set every members user_new column to 0 (old users)
|
||||
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_new = 0';
|
||||
_sql($sql, $errored, $error_ary);
|
||||
|
||||
// Newly registered users limit
|
||||
if (!isset($config['new_member_post_limit']))
|
||||
{
|
||||
set_config('new_member_post_limit', (!empty($config['enable_queue_trigger'])) ? $config['queue_trigger_posts'] : 0);
|
||||
}
|
||||
|
||||
if (!isset($config['new_member_group_default']))
|
||||
{
|
||||
set_config('new_member_group_default', 0);
|
||||
}
|
||||
|
||||
// To mimick the old "feature" we will assign the forum role to every forum, regardless of the setting (this makes sure there are no "this does not work!!!! YUO!!!" posts...
|
||||
// Check if the role is already assigned...
|
||||
$sql = 'SELECT forum_id
|
||||
FROM ' . ACL_GROUPS_TABLE . '
|
||||
WHERE group_id = ' . $group_id . '
|
||||
AND auth_role_id = ' . $f_role;
|
||||
$result = $db->sql_query($sql);
|
||||
$is_options = (int) $db->sql_fetchfield('forum_id');
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Not assigned at all... :/
|
||||
if (!$is_options)
|
||||
{
|
||||
// Get postable forums
|
||||
$sql = 'SELECT forum_id
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
WHERE forum_type != ' . FORUM_LINK;
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
_sql('INSERT INTO ' . ACL_GROUPS_TABLE . ' (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (' . $group_id . ', ' . (int) $row['forum_id'] . ', 0, ' . $f_role . ', 0)', $errored, $error_ary);
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// Clear permissions...
|
||||
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
|
||||
$auth_admin = new auth_admin();
|
||||
$auth_admin->acl_clear_prefetch();
|
||||
|
||||
if ($config['allow_avatar_upload'] || $config['allow_avatar_local'] || $config['allow_avatar_remote'])
|
||||
{
|
||||
set_config('allow_avatar', '1');
|
||||
|
@@ -94,7 +94,6 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_package_size
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_pm_icons', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_post_confirm', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_queue_trigger', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_enable', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_limit', '10');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_overall_forums', '1');
|
||||
@@ -194,6 +193,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_name_chars', '
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_pass_chars', '6');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_search_author_chars', '3');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('new_member_post_limit', '3');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('new_member_group_default', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('override_user_style', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pass_complex', 'PASS_TYPE_ANY');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_edit_time', '0');
|
||||
@@ -203,7 +204,6 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_recipients'
|
||||
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');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('queue_trigger_posts', '3');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ranks_path', 'images/ranks');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('referer_validation', '1');
|
||||
@@ -412,6 +412,11 @@ INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order)
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_POLLS', 'ROLE_DESCRIPTION_FORUM_POLLS', 'f_', 6);
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_LIMITED_POLLS', 'ROLE_DESCRIPTION_FORUM_LIMITED_POLLS', 'f_', 4);
|
||||
|
||||
# 23
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_USER_NEW_MEMBER', 'ROLE_DESCRIPTION_USER_NEW_MEMBER', 'u_', 6);
|
||||
|
||||
# 24
|
||||
INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', 10);
|
||||
|
||||
# -- phpbb_styles
|
||||
INSERT INTO phpbb_styles (style_name, style_copyright, style_active, template_id, theme_id, imageset_id) VALUES ('prosilver', '© phpBB Group', 1, 1, 1, 1);
|
||||
@@ -513,6 +518,7 @@ INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_co
|
||||
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);
|
||||
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 ('NEWLY_REGISTERED', 3, 0, '', 0, '', '', '', 5);
|
||||
|
||||
# -- User -> Group
|
||||
INSERT INTO phpbb_user_group (group_id, user_id, user_pending, group_leader) VALUES (1, 1, 0, 0);
|
||||
@@ -594,6 +600,13 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT
|
||||
# Limited Access + Polls (f_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 22, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_sticky', 'f_user_lock', 'f_votechg');
|
||||
|
||||
# New Member (u_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 23, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group');
|
||||
|
||||
# New Member (f_)
|
||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 24, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove');
|
||||
|
||||
|
||||
# Permissions
|
||||
|
||||
# GUESTS - u_download and u_search ability
|
||||
@@ -644,6 +657,12 @@ INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id,
|
||||
# Bots having bot access
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (6, 2, 0, 19, 0);
|
||||
|
||||
# NEW MEMBERS aren't allowed to PM
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (7, 0, 0, 23, 0);
|
||||
|
||||
# NEW MEMBERS on the queue
|
||||
INSERT INTO phpbb_acl_groups (group_id, forum_id, auth_option_id, auth_role_id, auth_setting) VALUES (7, 2, 0, 24, 0);
|
||||
|
||||
|
||||
# -- Demo Topic
|
||||
INSERT INTO phpbb_topics (topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_replies_real, forum_id, topic_status, topic_type, topic_first_post_id, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_subject, topic_last_post_time, topic_last_view_time, poll_title) VALUES ('{L_TOPICS_TOPIC_TITLE}', 2, 972086460, 0, 0, 0, 2, 0, 0, 1, 'Admin', 'AA0000', 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, 972086460, '');
|
||||
|
Reference in New Issue
Block a user