diff --git a/phpBB/adm/admin_attachments.php b/phpBB/adm/admin_attachments.php index cd90fd7ef0..2797fc29d3 100644 --- a/phpBB/adm/admin_attachments.php +++ b/phpBB/adm/admin_attachments.php @@ -578,8 +578,10 @@ if ($mode == 'attach') acl_get('a_defaults')) + { + trigger_error($user->lang['NO_ADMIN']); + } + + $post_count_ary = $auth->acl_getf('f_postcount'); + + $forum_ary = array(); + foreach ($post_count_ary as $forum_id => $allowed) + { + if ($allowed['f_read'] && $allowed['f_postcount']) + { + $forum_ary[] = $forum_id; + } + } + $post_count_sql = (sizeof($forum_ary)) ? 'AND f.forum_id IN (' . implode(', ', $forum_ary) . ')' : ''; + unset($forum_ary, $post_count_ary); + + $sql = 'SELECT user_id FROM ' . USERS_TABLE . ' + WHERE user_type NOT IN (' . USER_INACTIVE . ')'; + $result = $db->sql_query($sql); + + while ($user_row = $db->sql_fetchrow($result)) + { + $user_id = (int) $user_row['user_id']; + + $sql = 'SELECT COUNT(p.post_id) AS num_posts + FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f + WHERE p.poster_id = ' . $user_id . " + AND f.forum_id = p.forum_id + $post_count_sql"; + $result2 = $db->sql_query($sql); + $num_real_posts = (int) $db->sql_fetchfield('num_posts', 0, $result2); + $db->sql_freeresult($result2); + + $db->sql_query('UPDATE ' . USERS_TABLE . " SET user_posts = $num_real_posts WHERE user_id = $user_id"); + } + $db->sql_freeresult($result); + + add_log('admin', 'LOG_RESYNC_USER'); + break; + case 'date': if (!$auth->acl_get('a_defaults')) { @@ -373,7 +417,7 @@ elseif ($pane == 'right') $dbsize = 0; while ($row = $db->sql_fetchrow($result)) { - if ($row['Type'] != 'MRG_MyISAM') + if ((isset($row['Type']) && $row['Type'] != 'MRG_MyISAM') || (isset($row['Engine']) && $row['Engine'] == 'MyISAM')) { if ($table_prefix != '') { @@ -489,7 +533,9 @@ elseif ($pane == 'right')