diff options
author | David M <davidmj@users.sourceforge.net> | 2007-02-13 23:20:34 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2007-02-13 23:20:34 +0000 |
commit | deadc44c9ca1a1a0e060d036cc7cc58825a1c20f (patch) | |
tree | 1f5c63642ec975106ac6e6dec0c5397ec9bfb676 /phpBB/includes/functions_posting.php | |
parent | c16beb34af123b810cfd8a4a625075fcb59540ef (diff) | |
download | forums-deadc44c9ca1a1a0e060d036cc7cc58825a1c20f.tar forums-deadc44c9ca1a1a0e060d036cc7cc58825a1c20f.tar.gz forums-deadc44c9ca1a1a0e060d036cc7cc58825a1c20f.tar.bz2 forums-deadc44c9ca1a1a0e060d036cc7cc58825a1c20f.tar.xz forums-deadc44c9ca1a1a0e060d036cc7cc58825a1c20f.zip |
-Topic review is fast :D
#7894
git-svn-id: file:///svn/phpbb/trunk@6986 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_posting.php')
-rw-r--r-- | phpBB/includes/functions_posting.php | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index eb03143aa1..4b80464d22 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -863,28 +863,48 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id global $config, $phpbb_root_path, $phpEx; // Go ahead and pull all data for this topic - $sql = 'SELECT u.username, u.user_id, u.user_colour, p.* - FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u + $sql = 'SELECT p.post_id + FROM ' . POSTS_TABLE . ' p' . " WHERE p.topic_id = $topic_id - AND p.poster_id = u.user_id " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . ' ' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . ' ORDER BY p.post_time DESC'; $result = $db->sql_query_limit($sql, $config['posts_per_page']); - if (!$row = $db->sql_fetchrow($result)) + $post_list = array(); + + while ($row = $db->sql_fetchrow($result)) + { + $post_list[] = $row['post_id']; + } + + $db->sql_freeresult($result); + + if (!sizeof($post_list)) { - $db->sql_freeresult($result); return false; } + $sql = $db->sql_build_query('SELECT', array( + 'SELECT' => 'u.username, u.user_id, u.user_colour, p.*', + + 'FROM' => array( + USERS_TABLE => 'u', + POSTS_TABLE => 'p', + ), + + 'WHERE' => $db->sql_in_set('p.post_id', $post_list) . ' + AND u.user_id = p.poster_id' + )); + + $result = $db->sql_query($sql); + $bbcode_bitfield = ''; - do + while ($row = $db->sql_fetchrow($result)) { $rowset[] = $row; $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); } - while ($row = $db->sql_fetchrow($result)); $db->sql_freeresult($result); // Instantiate BBCode class |