sql_build_query update
This commit is contained in:
@@ -174,63 +174,70 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql_array = array(
|
||||||
$sql = 'SELECT
|
'SELECT' => 't.forum_id,
|
||||||
t.forum_id,
|
t.topic_id,
|
||||||
t.topic_id,
|
t.topic_last_post_id,
|
||||||
t.topic_last_post_id,
|
t.topic_last_post_time,
|
||||||
t.topic_last_post_time,
|
t.topic_time,
|
||||||
t.topic_time,
|
t.topic_title,
|
||||||
t.topic_title,
|
t.topic_attachment,
|
||||||
t.topic_attachment,
|
t.topic_views,
|
||||||
t.topic_views,
|
t.poll_title,
|
||||||
t.poll_title,
|
t.topic_replies,
|
||||||
t.topic_replies,
|
t.topic_poster,
|
||||||
t.topic_poster,
|
u.username,
|
||||||
u.username,
|
u.user_id,
|
||||||
u.user_id,
|
u.user_type,
|
||||||
u.user_type,
|
u.user_colour,
|
||||||
u.user_colour,
|
p.post_id,
|
||||||
p.post_id,
|
p.post_time,
|
||||||
p.post_time,
|
p.post_text,
|
||||||
p.post_text,
|
p.post_attachment,
|
||||||
p.post_attachment,
|
p.enable_smilies,
|
||||||
p.enable_smilies,
|
p.enable_bbcode,
|
||||||
p.enable_bbcode,
|
p.enable_magic_url,
|
||||||
p.enable_magic_url,
|
p.bbcode_bitfield,
|
||||||
p.bbcode_bitfield,
|
p.bbcode_uid,
|
||||||
p.bbcode_uid,
|
f.forum_name',
|
||||||
f.forum_name
|
|
||||||
FROM
|
'FROM' => array(
|
||||||
' . TOPICS_TABLE . ' AS t
|
TOPICS_TABLE => 't',
|
||||||
LEFT JOIN
|
),
|
||||||
' . USERS_TABLE . ' as u
|
|
||||||
ON
|
'LEFT_JOIN' => array(
|
||||||
' . $user_link . '
|
array(
|
||||||
LEFT JOIN
|
'FROM' => array(USERS_TABLE => 'u'),
|
||||||
' . FORUMS_TABLE . ' as f
|
'ON' => $user_link,
|
||||||
ON
|
),
|
||||||
t.forum_id=f.forum_id
|
array(
|
||||||
LEFT JOIN
|
'FROM' => array(FORUMS_TABLE => 'f'),
|
||||||
' . POSTS_TABLE . ' as p
|
'ON' => 't.forum_id=f.forum_id',
|
||||||
ON
|
),
|
||||||
' . $post_link . '
|
array(
|
||||||
WHERE
|
'FROM' => array(POSTS_TABLE => 'p'),
|
||||||
' . $topic_type . '
|
'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;
|
'ORDER_BY' => $topic_order,
|
||||||
|
);
|
||||||
|
|
||||||
|
$sql = $db->sql_build_query('SELECT', $sql_array);
|
||||||
|
|
||||||
if ($number_of_posts <> 0)
|
if ($number_of_posts <> 0)
|
||||||
{
|
{
|
||||||
$result = $db->sql_query_limit($sql, $number_of_posts, $start);
|
$result = $db->sql_query_limit($sql, $number_of_posts, $start);
|
||||||
} else {
|
} else {
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instantiate BBCode if need be
|
// Instantiate BBCode if need be
|
||||||
if ($bbcode_bitfield !== '')
|
if ($bbcode_bitfield !== '')
|
||||||
|
|||||||
Reference in New Issue
Block a user