From fc32df035889dd74f2cfc1c62bb793d36f333ec2 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 9 Apr 2005 12:26:45 +0000 Subject: - Documentation related changes - added resend activation email dialog - fixed issue in session code - log failed/successful admin re-authentication/login - fixed simple forum dropdown box (used in mcp and posting) git-svn-id: file:///svn/phpbb/trunk@5114 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/index.php | 79 ++++++++++++++++++++++++----------------------------- 1 file changed, 35 insertions(+), 44 deletions(-) (limited to 'phpBB/adm/index.php') diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 46054fa74b..c7fd63253b 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -1,16 +1,15 @@ sql_fetchrow($result)); - if ($messenger->queue) - { - $messenger->queue->save(); - } + $messenger->save_queue(); unset($email_list); @@ -283,7 +279,6 @@ elseif ($pane == 'right') add_log('admin', 'LOG_RESYNC_STATS'); break; - // TODO: Temporary or a useful function? case 'user': if (!$auth->acl_get('a_defaults')) { @@ -291,40 +286,37 @@ elseif ($pane == 'right') } $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']) + if ($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)) + if (!sizeof($forum_ary)) { - $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_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0'); + } + else + { + $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id + FROM ' . POSTS_TABLE . ' + WHERE poster_id <> ' . ANONYMOUS . ' + AND forum_id IN (' . implode(', ', $forum_ary) . ') + GROUP BY poster_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $db->sql_query('UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['poster_id']}"); + } + $db->sql_freeresult($result); } - $db->sql_freeresult($result); - add_log('admin', 'LOG_RESYNC_USER'); + add_log('admin', 'LOG_RESYNC_POSTCOUNTS'); break; case 'date': @@ -333,7 +325,7 @@ elseif ($pane == 'right') trigger_error($user->lang['NO_ADMIN']); } - set_config('board_startdate', time() - 1, true); + set_config('board_startdate', time() - 1); add_log('admin', 'LOG_RESET_DATE'); break; } @@ -537,9 +529,8 @@ elseif ($pane == 'right')   -   +   -- cgit v1.2.1