From 083371e30d954d060f0df40f31b3122ca0d97215 Mon Sep 17 00:00:00 2001 From: Ice Date: Mon, 21 Apr 2008 15:01:03 +0000 Subject: [PATCH] Better than multi table query. --- root/portal/includes/functions.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/root/portal/includes/functions.php b/root/portal/includes/functions.php index fb13e971..3f4d861d 100644 --- a/root/portal/includes/functions.php +++ b/root/portal/includes/functions.php @@ -100,8 +100,9 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le return array(); } - foreach( $disallow_access as $acc_id ) + foreach( $disallow_access as $acc_id) { + $acc_id = (int) $acc_id; $str_where .= "t.forum_id = $acc_id OR "; if( $type == 'announcements' && $global_f < 1 && $acc_id > 0 ) { @@ -113,6 +114,7 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le { foreach( $disallow_access as $acc_id ) { + $acc_id = (int) $acc_id; $str_where .= "t.forum_id <> $acc_id AND "; } } @@ -151,13 +153,13 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le if( $type == 'announcements' && $global_f < 1 ) { $sql = 'SELECT - f.forum_id - FROM ' . FORUMS_TABLE . ' f, ' . TOPICS_TABLE . ' t + forum_id + FROM ' . FORUMS_TABLE . ' WHERE - f.forum_type = ' . FORUM_POST . ' - ' . $str_where . ' + forum_type = ' . FORUM_POST . ' + ' . str_replace('t.', '', $str_where) . ' ORDER BY - f.forum_id'; + forum_id'; $result = $db->sql_query_limit($sql, 1); if ($db->sql_affectedrows() > 0)