mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-05 15:16:16 +02:00
remove the need for filesorting
git-svn-id: file:///svn/phpbb/trunk@8023 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
3f9348bdf8
commit
ea636f16ee
@ -109,13 +109,20 @@ if ($view && !$post_id)
|
|||||||
$sql_condition = ($view == 'next') ? '>' : '<';
|
$sql_condition = ($view == 'next') ? '>' : '<';
|
||||||
$sql_ordering = ($view == 'next') ? 'ASC' : 'DESC';
|
$sql_ordering = ($view == 'next') ? 'ASC' : 'DESC';
|
||||||
|
|
||||||
$sql = 'SELECT t.topic_id, t.forum_id
|
$sql = 'SELECT forum_id, topic_last_post_time
|
||||||
FROM ' . TOPICS_TABLE . ' t
|
FROM ' . TOPICS_TABLE . '
|
||||||
LEFT JOIN ' . TOPICS_TABLE . " t2 ON (t2.topic_id = $topic_id AND t.forum_id = t2.forum_id)
|
WHERE topic_id = ' . $topic_id;
|
||||||
WHERE t.topic_last_post_time $sql_condition t2.topic_last_post_time
|
$result = $db->sql_query($sql);
|
||||||
" . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . "
|
$row = $db->sql_fetchrow($result);
|
||||||
AND t.topic_moved_id = 0
|
$db->sql_freeresult($result);
|
||||||
ORDER BY t.topic_last_post_time $sql_ordering";
|
|
||||||
|
$sql = 'SELECT topic_id, forum_id
|
||||||
|
FROM ' . TOPICS_TABLE . '
|
||||||
|
WHERE forum_id = ' . $row['forum_id'] . "
|
||||||
|
AND topic_moved_id = 0
|
||||||
|
AND topic_last_post_time $sql_condition {$row['topic_last_post_time']}
|
||||||
|
" . (($auth->acl_get('m_approve', $row['forum_id']) && false) ? '' : 'AND topic_approved = 1') . "
|
||||||
|
ORDER BY topic_last_post_time $sql_ordering";
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
$row = $db->sql_fetchrow($result);
|
$row = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user