diff options
author | Andreas Fischer <bantu@phpbb.com> | 2011-08-16 18:09:42 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2011-08-16 18:09:42 +0200 |
commit | 7ae11e372710399557617447ae0cb4fd5198de66 (patch) | |
tree | 5f0206bc5649b654b3b82e389fac88b7fef572ee | |
parent | 5fa096aca42688b07300ec4bc946972f1acdd5ed (diff) | |
parent | a91131c55e468811ac6ce4abf637c755b83e0caa (diff) | |
download | forums-7ae11e372710399557617447ae0cb4fd5198de66.tar forums-7ae11e372710399557617447ae0cb4fd5198de66.tar.gz forums-7ae11e372710399557617447ae0cb4fd5198de66.tar.bz2 forums-7ae11e372710399557617447ae0cb4fd5198de66.tar.xz forums-7ae11e372710399557617447ae0cb4fd5198de66.zip |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/9976] Fix link to post when two posts have the same post_time.
-rw-r--r-- | phpBB/viewtopic.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index d9e71e2088..2c5b4e3fc5 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -175,7 +175,7 @@ $sql_array = array( // The FROM-Order is quite important here, else t.* columns can not be correctly bound. if ($post_id) { - $sql_array['SELECT'] .= ', p.post_approved, p.post_time'; + $sql_array['SELECT'] .= ', p.post_approved, p.post_time, p.post_id'; $sql_array['FROM'][POSTS_TABLE] = 'p'; } @@ -278,8 +278,16 @@ if ($post_id) $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']}"); + " . ((!$auth->acl_get('m_approve', $forum_id)) ? 'AND p.post_approved = 1' : ''); + + if ($sort_dir == 'd') + { + $sql .= " AND (p.post_time > {$topic_data['post_time']} OR (p.post_time = {$topic_data['post_time']} AND p.post_id >= {$topic_data['post_id']}))"; + } + else + { + $sql .= " AND (p.post_time < {$topic_data['post_time']} OR (p.post_time = {$topic_data['post_time']} AND p.post_id <= {$topic_data['post_id']}))"; + } $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); |