sql_build_query update

This commit is contained in:
Ice
2008-08-09 14:11:01 +00:00
parent 27d9a538bd
commit 618d0cca19

View File

@@ -174,63 +174,70 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
} }
$sql_array = array(
'SELECT' => 't.forum_id,
t.topic_id,
t.topic_last_post_id,
t.topic_last_post_time,
t.topic_time,
t.topic_title,
t.topic_attachment,
t.topic_views,
t.poll_title,
t.topic_replies,
t.topic_poster,
u.username,
u.user_id,
u.user_type,
u.user_colour,
p.post_id,
p.post_time,
p.post_text,
p.post_attachment,
p.enable_smilies,
p.enable_bbcode,
p.enable_magic_url,
p.bbcode_bitfield,
p.bbcode_uid,
f.forum_name',
$sql = 'SELECT 'FROM' => array(
t.forum_id, TOPICS_TABLE => 't',
t.topic_id, ),
t.topic_last_post_id,
t.topic_last_post_time, 'LEFT_JOIN' => array(
t.topic_time, array(
t.topic_title, 'FROM' => array(USERS_TABLE => 'u'),
t.topic_attachment, 'ON' => $user_link,
t.topic_views, ),
t.poll_title, array(
t.topic_replies, 'FROM' => array(FORUMS_TABLE => 'f'),
t.topic_poster, 'ON' => 't.forum_id=f.forum_id',
u.username, ),
u.user_id, array(
u.user_type, 'FROM' => array(POSTS_TABLE => 'p'),
u.user_colour, 'ON' => $post_link,
p.post_id, ),
p.post_time, ),
p.post_text,
p.post_attachment, 'WHERE' => $topic_type . '
p.enable_smilies,
p.enable_bbcode,
p.enable_magic_url,
p.bbcode_bitfield,
p.bbcode_uid,
f.forum_name
FROM
' . TOPICS_TABLE . ' AS t
LEFT JOIN
' . USERS_TABLE . ' as u
ON
' . $user_link . '
LEFT JOIN
' . FORUMS_TABLE . ' as f
ON
t.forum_id=f.forum_id
LEFT JOIN
' . POSTS_TABLE . ' as p
ON
' . $post_link . '
WHERE
' . $topic_type . '
' . $post_time . ' ' . $post_time . '
AND t.topic_status <> 2 AND t.topic_status <> 2
AND t.topic_approved = 1 AND t.topic_approved = 1
AND t.topic_moved_id = 0 AND t.topic_moved_id = 0
' . $str_where .' ' . $str_where,
ORDER BY
' . $topic_order;
if ($number_of_posts <> 0) 'ORDER_BY' => $topic_order,
{ );
$result = $db->sql_query_limit($sql, $number_of_posts, $start);
} else { $sql = $db->sql_build_query('SELECT', $sql_array);
$result = $db->sql_query($sql);
} if ($number_of_posts <> 0)
{
$result = $db->sql_query_limit($sql, $number_of_posts, $start);
} else {
$result = $db->sql_query($sql);
}
// Instantiate BBCode if need be // Instantiate BBCode if need be
if ($bbcode_bitfield !== '') if ($bbcode_bitfield !== '')