From 09edf1e1a59f245164a157f60231e8e656961e7e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 11 Jan 2006 21:52:41 +0000 Subject: [PATCH] somehow I knew this had to happen :( (just two very tiny changes to the previous commit) git-svn-id: file:///svn/phpbb/trunk@5443 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/schemas/mysql_schema.sql | 2 +- phpBB/search.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql index eb60923afc..169fc71ad4 100644 --- a/phpBB/install/schemas/mysql_schema.sql +++ b/phpBB/install/schemas/mysql_schema.sql @@ -564,7 +564,7 @@ CREATE TABLE phpbb_reports ( ); # Table: 'phpbb_search_results' -CREATE TABLE new_search_results ( +CREATE TABLE phpbb_search_results ( search_key varchar(32) DEFAULT '' NOT NULL, search_time int(11) DEFAULT '0' NOT NULL, search_keywords mediumtext NOT NULL, diff --git a/phpBB/search.php b/phpBB/search.php index fceab40459..2b2151ba10 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -84,12 +84,12 @@ if ($keywords || $author || $search_id) // Which forums should not be searched? $ex_fid_ary = array_keys($auth->acl_getf('!f_read', true)); + $not_in_fid = (sizeof($ex_fid_ary)) ? 'f.forum_id NOT IN (' . implode(', ', $ex_fid_ary) . ') OR ' : ''; $sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.right_id, f.forum_password, fa.user_id FROM ' . FORUMS_TABLE . ' f LEFT JOIN ' . FORUMS_ACCESS_TABLE . " fa ON (fa.forum_id = f.forum_id AND fa.session_id = '" . $db->sql_escape($user->data['session_id']) . "') - WHERE f.forum_id NOT IN (" . implode(', ', $ex_fid_ary) . ") - OR (f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ') + WHERE $not_in_fid(f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ') ORDER BY f.left_id'; $result = $db->sql_query($sql);