diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2011-05-09 02:04:58 -0400 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2011-07-24 04:39:00 -0400 |
commit | 0648923b19e450d44e02426e7a510efb831f78d1 (patch) | |
tree | c53dab132ebc0a4d6f1e871682891be1f891e7a5 /phpBB/viewtopic.php | |
parent | 13ca659f1f992f3cd4f8395366ccd01b951ee96d (diff) | |
download | forums-0648923b19e450d44e02426e7a510efb831f78d1.tar forums-0648923b19e450d44e02426e7a510efb831f78d1.tar.gz forums-0648923b19e450d44e02426e7a510efb831f78d1.tar.bz2 forums-0648923b19e450d44e02426e7a510efb831f78d1.tar.xz forums-0648923b19e450d44e02426e7a510efb831f78d1.zip |
[ticket/10199] Delete a useless join in viewtopic.
PHPBB3-10199
Diffstat (limited to 'phpBB/viewtopic.php')
-rw-r--r-- | phpBB/viewtopic.php | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 2f3a4cf2e4..f1ab30aad3 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -196,7 +196,7 @@ if ($db->sql_layer === 'firebird') // The FROM-Order is quite important here, else t.* columns can not be correctly bound. if ($post_id) { - $sql_array['SELECT'] .= ', p.post_approved'; + $sql_array['SELECT'] .= ', p.post_approved, p.post_time'; $sql_array['FROM'][POSTS_TABLE] = 'p'; } @@ -314,12 +314,11 @@ if ($post_id) } else { - $sql = 'SELECT COUNT(p1.post_id) AS prev_posts - FROM ' . POSTS_TABLE . ' p1, ' . POSTS_TABLE . " p2 - WHERE p1.topic_id = {$topic_data['topic_id']} - AND p2.post_id = {$post_id} - " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p1.post_approved = 1' : '') . ' - AND ' . (($sort_dir == 'd') ? 'p1.post_time >= p2.post_time' : 'p1.post_time <= p2.post_time'); + $sql = 'SELECT COUNT(p.post_id) AS prev_posts + FROM ' . POSTS_TABLE . " p + WHERE p.topic_id = {$topic_data['topic_id']} + " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : '') . ' + AND ' . (($sort_dir == 'd') ? "p.post_time >= {$topic_data['post_time']}" : "p.post_time <= {$topic_data['post_time']}"); $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); |