mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-07 16:15:22 +02:00
checked and it works ... or appears to from a 2.0.x install
git-svn-id: file:///svn/phpbb/trunk@2873 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
0d72ddd0ad
commit
4a5f17c131
@ -38,77 +38,71 @@ define('AUTH_ADMIN', 5);
|
|||||||
define('ANONYMOUS', 1);
|
define('ANONYMOUS', 1);
|
||||||
|
|
||||||
$auth_map = array(
|
$auth_map = array(
|
||||||
'auth_view' => 'list',
|
'auth_view' => 'forum_list',
|
||||||
'auth_read' => 'read',
|
'auth_read' => 'forum_read',
|
||||||
'auth_post' => 'post',
|
'auth_post' => 'forum_post',
|
||||||
'auth_reply' => 'reply',
|
'auth_reply' => 'forum_reply',
|
||||||
'auth_edit' => 'edit',
|
'auth_edit' => 'forum_edit',
|
||||||
'auth_delete' => 'delete',
|
'auth_delete' => 'forum_delete',
|
||||||
'auth_pollcreate' => 'poll',
|
'auth_pollcreate' => 'forum_poll',
|
||||||
'auth_vote' => 'vote',
|
'auth_vote' => 'forum_vote',
|
||||||
'auth_announce' => 'announce',
|
'auth_announce' => 'forum_announce',
|
||||||
'auth_sticky' => 'sticky',
|
'auth_sticky' => 'forum_sticky',
|
||||||
'auth_attachments' => 'attach',
|
'auth_attachments' => 'forum_attach',
|
||||||
'auth_download' => 'download',
|
'auth_download' => 'forum_download',
|
||||||
);
|
);
|
||||||
|
|
||||||
$auth_options = array(
|
$auth_options = array(
|
||||||
'forum' => array(
|
'forum_list',
|
||||||
'list',
|
'forum_read',
|
||||||
'read',
|
'forum_post',
|
||||||
'post',
|
'forum_reply',
|
||||||
'reply',
|
'forum_edit',
|
||||||
'edit',
|
'forum_delete',
|
||||||
'delete',
|
'forum_poll',
|
||||||
'poll',
|
'forum_vote',
|
||||||
'vote',
|
'forum_announce',
|
||||||
'announce',
|
'forum_sticky',
|
||||||
'sticky',
|
'forum_attach',
|
||||||
'attach',
|
'forum_download',
|
||||||
'download',
|
'forum_html',
|
||||||
'html',
|
'forum_bbcode',
|
||||||
'bbcode',
|
'forum_smilies',
|
||||||
'smilies',
|
'forum_img',
|
||||||
'img',
|
'forum_flash',
|
||||||
'flash',
|
'forum_sigs',
|
||||||
'sigs',
|
'forum_search',
|
||||||
'search',
|
'forum_email',
|
||||||
'email',
|
'forum_rate',
|
||||||
'rate',
|
'forum_print',
|
||||||
'print',
|
'forum_ignoreflood',
|
||||||
'ignoreflood',
|
'forum_ignorequeue'
|
||||||
'ignorequeue'
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$auth_mod_options = array(
|
$auth_mod_options = array(
|
||||||
'mod' => array(
|
'mod_edit',
|
||||||
'edit',
|
'mod_delete',
|
||||||
'delete',
|
'mod_move',
|
||||||
'move',
|
'mod_lock',
|
||||||
'lock',
|
'mod_split',
|
||||||
'split',
|
'mod_merge',
|
||||||
'merge',
|
'mod_approve',
|
||||||
'approve',
|
'mod_unrate',
|
||||||
'unrate',
|
'mod_auth'
|
||||||
'auth'
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$auth_admin_options = array(
|
$auth_admin_options = array(
|
||||||
'admin' => array(
|
'admin_general',
|
||||||
'general',
|
'admin_user',
|
||||||
'user',
|
'admin_group',
|
||||||
'group',
|
'admin_forum',
|
||||||
'forum',
|
'admin_post',
|
||||||
'post',
|
'admin_ban',
|
||||||
'ban',
|
'admin_auth',
|
||||||
'auth',
|
'admin_email',
|
||||||
'email',
|
'admin_styles',
|
||||||
'styles',
|
'admin_backup',
|
||||||
'backup',
|
'admin_clearlogs'
|
||||||
'clearlogs'
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$new_groups = array(
|
$new_groups = array(
|
||||||
@ -654,16 +648,13 @@ switch ( $this_version )
|
|||||||
$all_options = array_merge($auth_options, array_merge($auth_mod_options, $auth_admin_options));
|
$all_options = array_merge($auth_options, array_merge($auth_mod_options, $auth_admin_options));
|
||||||
$option_ids = array();
|
$option_ids = array();
|
||||||
|
|
||||||
foreach ( $all_options as $type => $option_ary )
|
foreach ( $all_options as $value )
|
||||||
{
|
{
|
||||||
foreach ( $option_ary as $option )
|
$sql = "INSERT INTO " . $table_prefix . "auth_options (auth_value)
|
||||||
{
|
VALUES ('$value')";
|
||||||
$sql = "INSERT INTO " . $table_prefix . "auth_options (auth_type, auth_option)
|
|
||||||
VALUES ('$type', '$option')";
|
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$option_ids[$type][$option] = $db->sql_nextid();
|
$option_ids[$value] = $db->sql_nextid();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $new_groups as $k => $sql )
|
foreach ( $new_groups as $k => $sql )
|
||||||
@ -714,13 +705,13 @@ switch ( $this_version )
|
|||||||
switch ( $forum[$k] )
|
switch ( $forum[$k] )
|
||||||
{
|
{
|
||||||
case AUTH_ALL:
|
case AUTH_ALL:
|
||||||
$group_acl[$guest_id][$forum['forum_id']]['forum'][$v] = ACL_ALLOW;
|
$group_acl[$guest_id][$forum['forum_id']][$v] = ACL_ALLOW;
|
||||||
$group_acl[$reg_inactive_id][$forum['forum_id']]['forum'][$v] = ACL_ALLOW;
|
$group_acl[$reg_inactive_id][$forum['forum_id']][$v] = ACL_ALLOW;
|
||||||
$group_acl[$reg_id][$forum['forum_id']]['forum'][$v] = ACL_ALLOW;
|
$group_acl[$reg_id][$forum['forum_id']][$v] = ACL_ALLOW;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUTH_REG:
|
case AUTH_REG:
|
||||||
$group_acl[$reg_id][$forum['forum_id']]['forum'][$v] = ACL_ALLOW;
|
$group_acl[$reg_id][$forum['forum_id']][$v] = ACL_ALLOW;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUTH_ACL:
|
case AUTH_ACL:
|
||||||
@ -730,7 +721,7 @@ switch ( $this_version )
|
|||||||
{
|
{
|
||||||
if ( !empty($access[$k]) )
|
if ( !empty($access[$k]) )
|
||||||
{
|
{
|
||||||
$group_acl[$access['group_id']][$forum['forum_id']]['forum'][$v] = ACL_ALLOW;
|
$group_acl[$access['group_id']][$forum['forum_id']][$v] = ACL_ALLOW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -741,14 +732,14 @@ switch ( $this_version )
|
|||||||
{
|
{
|
||||||
if ( !empty($access[$k]) )
|
if ( !empty($access[$k]) )
|
||||||
{
|
{
|
||||||
$user_acl[$access['user_id']][$forum['forum_id']]['forum'][$v] = ACL_ALLOW;
|
$user_acl[$access['user_id']][$forum['forum_id']][$v] = ACL_ALLOW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUTH_MOD:
|
case AUTH_MOD:
|
||||||
$group_acl[$super_mod_id][$forum['forum_id']]['forum'][$v] = ACL_ALLOW;
|
$group_acl[$super_mod_id][$forum['forum_id']][$v] = ACL_ALLOW;
|
||||||
|
|
||||||
foreach( $group_access as $forum_id => $access )
|
foreach( $group_access as $forum_id => $access )
|
||||||
{
|
{
|
||||||
@ -756,7 +747,7 @@ switch ( $this_version )
|
|||||||
{
|
{
|
||||||
if ( !empty($access[$k]) )
|
if ( !empty($access[$k]) )
|
||||||
{
|
{
|
||||||
$group_acl[$access['group_id']][$forum['forum_id']]['forum'][$v] = ACL_ALLOW;
|
$group_acl[$access['group_id']][$forum['forum_id']][$v] = ACL_ALLOW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -767,7 +758,7 @@ switch ( $this_version )
|
|||||||
{
|
{
|
||||||
if ( !empty($access[$k]) )
|
if ( !empty($access[$k]) )
|
||||||
{
|
{
|
||||||
$user_acl[$access['user_id']][$forum['forum_id']]['forum'][$v] = ACL_ALLOW;
|
$user_acl[$access['user_id']][$forum['forum_id']][$v] = ACL_ALLOW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -785,17 +776,18 @@ switch ( $this_version )
|
|||||||
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny)
|
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny)
|
||||||
SELECT $admin_id, 0, auth_option_id, " . ACL_ALLOW . "
|
SELECT $admin_id, 0, auth_option_id, " . ACL_ALLOW . "
|
||||||
FROM " . $table_prefix . "auth_options
|
FROM " . $table_prefix . "auth_options
|
||||||
WHERE auth_type LIKE 'admin' AND auth_option NOT LIKE 'clearlogs'";
|
WHERE auth_value LIKE 'admin_%'
|
||||||
|
AND auth_value NOT LIKE 'admin_clearlogs'";
|
||||||
|
|
||||||
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny)
|
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny)
|
||||||
SELECT $admin_id, 0, auth_option_id, " . ACL_PERMIT . "
|
SELECT $admin_id, 0, auth_option_id, " . ACL_PERMIT . "
|
||||||
FROM " . $table_prefix . "auth_options
|
FROM " . $table_prefix . "auth_options
|
||||||
WHERE auth_type LIKE 'forum'";
|
WHERE auth_value LIKE 'forum_%'";
|
||||||
|
|
||||||
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny)
|
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny)
|
||||||
SELECT $admin_id, 0, auth_option_id, " . ACL_PERMIT . "
|
SELECT $admin_id, 0, auth_option_id, " . ACL_PERMIT . "
|
||||||
FROM " . $table_prefix . "auth_options
|
FROM " . $table_prefix . "auth_options
|
||||||
WHERE auth_type LIKE 'mod'";
|
WHERE auth_value LIKE 'mod_%'";
|
||||||
|
|
||||||
//
|
//
|
||||||
// Do Moderators
|
// Do Moderators
|
||||||
@ -807,11 +799,12 @@ switch ( $this_version )
|
|||||||
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_users (user_id, forum_id, auth_option_id, auth_allow_deny)
|
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_users (user_id, forum_id, auth_option_id, auth_allow_deny)
|
||||||
SELECT " . $access['user_id'] . ", $forum_id, auth_option_id, " . ACL_ALLOW . "
|
SELECT " . $access['user_id'] . ", $forum_id, auth_option_id, " . ACL_ALLOW . "
|
||||||
FROM " . $table_prefix . "auth_options
|
FROM " . $table_prefix . "auth_options
|
||||||
WHERE auth_type LIKE 'mod' AND auth_option NOT LIKE 'auth'";
|
WHERE auth_value LIKE 'mod_%'
|
||||||
|
AND auth_value NOT LIKE 'mod_auth'";
|
||||||
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_users (user_id, forum_id, auth_option_id, auth_allow_deny)
|
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_users (user_id, forum_id, auth_option_id, auth_allow_deny)
|
||||||
SELECT " . $access['user_id'] . ", $forum_id, auth_option_id, " . ACL_PERMIT . "
|
SELECT " . $access['user_id'] . ", $forum_id, auth_option_id, " . ACL_PERMIT . "
|
||||||
FROM " . $table_prefix . "auth_options
|
FROM " . $table_prefix . "auth_options
|
||||||
WHERE auth_type LIKE 'forum'";
|
WHERE auth_value LIKE 'forum_%'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -822,11 +815,12 @@ switch ( $this_version )
|
|||||||
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny)
|
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny)
|
||||||
SELECT " . $access['group_id'] . ", $forum_id, auth_option_id, " . ACL_ALLOW . "
|
SELECT " . $access['group_id'] . ", $forum_id, auth_option_id, " . ACL_ALLOW . "
|
||||||
FROM " . $table_prefix . "auth_options
|
FROM " . $table_prefix . "auth_options
|
||||||
WHERE auth_type LIKE 'mod' AND auth_option NOT LIKE 'auth'";
|
WHERE auth_value LIKE 'mod_%'
|
||||||
|
AND auth_value NOT LIKE 'mod_auth'";
|
||||||
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny)
|
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny)
|
||||||
SELECT " . $access['group_id'] . ", $forum_id, auth_option_id, " . ACL_PERMIT . "
|
SELECT " . $access['group_id'] . ", $forum_id, auth_option_id, " . ACL_PERMIT . "
|
||||||
FROM " . $table_prefix . "auth_options
|
FROM " . $table_prefix . "auth_options
|
||||||
WHERE auth_type LIKE 'forum'";
|
WHERE auth_value LIKE 'forum_%'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -837,31 +831,25 @@ switch ( $this_version )
|
|||||||
{
|
{
|
||||||
foreach ( $user_acl_ary as $forum_id => $auth )
|
foreach ( $user_acl_ary as $forum_id => $auth )
|
||||||
{
|
{
|
||||||
foreach ( $auth as $auth_type => $auth_option_ary )
|
foreach ( $auth as $auth_value => $allow )
|
||||||
{
|
{
|
||||||
foreach ( $auth_option_ary as $auth_option => $allow )
|
$auth_option_id = $option_ids[$auth_value];
|
||||||
{
|
|
||||||
$auth_option_id = $option_ids[$auth_type][$auth_option];
|
|
||||||
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_users (user_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($user_id, $forum_id, $auth_option_id, $allow)";
|
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_users (user_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($user_id, $forum_id, $auth_option_id, $allow)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
foreach ( $group_acl as $group_id => $group_acl_ary )
|
foreach ( $group_acl as $group_id => $group_acl_ary )
|
||||||
{
|
{
|
||||||
foreach ( $group_acl_ary as $forum_id => $auth )
|
foreach ( $group_acl_ary as $forum_id => $auth )
|
||||||
{
|
{
|
||||||
foreach ( $auth as $auth_type => $auth_option_ary )
|
foreach ( $auth as $auth_value => $allow )
|
||||||
{
|
{
|
||||||
foreach ( $auth_option_ary as $auth_option => $allow )
|
$auth_option_id = $option_ids[$auth_value];
|
||||||
{
|
|
||||||
$auth_option_id = $option_ids[$auth_type][$auth_option];
|
|
||||||
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($group_id, $forum_id, $auth_option_id, $allow)";
|
$sql_ary[] = "INSERT INTO " . $table_prefix . "auth_groups (group_id, forum_id, auth_option_id, auth_allow_deny) VALUES ($group_id, $forum_id, $auth_option_id, $allow)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
foreach ( $sql_ary as $sql )
|
foreach ( $sql_ary as $sql )
|
||||||
{
|
{
|
||||||
@ -911,7 +899,7 @@ switch ( $this_version )
|
|||||||
$forum_id = $row['forum_id'];
|
$forum_id = $row['forum_id'];
|
||||||
|
|
||||||
$sql_ary[] = "UPDATE " . $table_prefix . "forums
|
$sql_ary[] = "UPDATE " . $table_prefix . "forums
|
||||||
SET forum_last_poster_id = " . ( ( $row['user_id'] ) ? $row['user_id'] : ANONYMOUS ) . ", forum_last_poster_name = '" . $row['post_username'] . "', forum_last_post_time = " . $row['post_time'] . "
|
SET forum_last_poster_id = " . ( ( $row['user_id'] ) ? $row['user_id'] : ANONYMOUS ) . ", forum_last_poster_name = '" . addslashes($row['post_username']) . "', forum_last_post_time = " . $row['post_time'] . "
|
||||||
WHERE forum_id = $forum_id";
|
WHERE forum_id = $forum_id";
|
||||||
|
|
||||||
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
|
$sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time
|
||||||
@ -926,7 +914,7 @@ switch ( $this_version )
|
|||||||
while ( $row2 = $db->sql_fetchrow($result2) )
|
while ( $row2 = $db->sql_fetchrow($result2) )
|
||||||
{
|
{
|
||||||
$sql_ary[] = "UPDATE " . $table_prefix . "topics
|
$sql_ary[] = "UPDATE " . $table_prefix . "topics
|
||||||
SET topic_first_poster_name = '" . $row2['post_username'] . "', topic_last_poster_id = " . ( ( $row2['id2'] ) ? $row2['id2'] : ANONYMOUS ) . ", topic_last_post_time = " . $row2['post_time'] . ", topic_last_poster_name = '" . $row2['post_username2'] . "'
|
SET topic_first_poster_name = '" . addslashes($row2['post_username']) . "', topic_last_poster_id = " . ( ( $row2['id2'] ) ? $row2['id2'] : ANONYMOUS ) . ", topic_last_post_time = " . $row2['post_time'] . ", topic_last_poster_name = '" . addslashes($row2['post_username2']) . "'
|
||||||
WHERE topic_id = " . $row2['topic_id'];
|
WHERE topic_id = " . $row2['topic_id'];
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result2);
|
$db->sql_freeresult($result2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user