|
From: Paul S. O. <ps...@us...> - 2001-12-29 16:48:32
|
Update of /cvsroot/phpbb/phpBB2
In directory usw-pr-cvs1:/tmp/cvs-serv12812
Modified Files:
search.php
Log Message:
Fix bug #496943
Index: search.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/search.php,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -r1.51 -r1.52
*** search.php 2001/12/21 15:51:31 1.51
--- search.php 2001/12/29 16:48:30 1.52
***************
*** 558,572 ****
}
! $sql_post_id_in = "";
! while( $row = $db->sql_fetchrow($result) )
{
! if( $sql_post_id_in != "" )
{
! $sql_post_id_in .= ", ";
}
- $sql_post_id_in .= $row['topic_id'];
- }
! $search_sql .= "t.topic_id IN ($sql_post_id_in) ";
}
}
--- 558,579 ----
}
! if( $db->sql_numrows($result) )
{
! $sql_post_id_in = "";
! while( $row = $db->sql_fetchrow($result) )
{
! if( $sql_post_id_in != "" )
! {
! $sql_post_id_in .= ", ";
! }
! $sql_post_id_in .= $row['topic_id'];
}
! $search_sql .= "t.topic_id IN ($sql_post_id_in) ";
! }
! else
! {
! message_die(GENERAL_MESSAGE, $lang['No_search_match']);
! }
}
}
***************
*** 580,588 ****
// Define common SQL
//
! $sql_fields = ( $show_results == "posts") ? "pt.post_text, pt.bbcode_uid, pt.post_subject, p.post_id, p.post_time, p.post_username, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_time, t.topic_views, t.topic_replies, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid" : "f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_time, t.topic_views, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username" ;
! $sql_from = ( $show_results == "posts") ? FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt" : FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2";
! $sql_where = ( $show_results == "posts") ? "pt.post_id = p.post_id AND f.forum_id = p.forum_id AND p.topic_id = t.topic_id AND p.poster_id = u.user_id" : "f.forum_id = t.forum_id AND u.user_id = t.topic_poster AND p.post_id = t.topic_last_post_id AND u2.user_id = p.poster_id";
//
--- 587,595 ----
// Define common SQL
//
! $sql_fields = ( $show_results == "posts" ) ? "pt.post_text, pt.bbcode_uid, pt.post_subject, p.post_id, p.post_time, p.post_username, p.enable_bbcode, p.enable_html, p.enable_smilies, p.enable_sig, f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_time, t.topic_views, t.topic_replies, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid" : "f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_time, t.topic_views, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username" ;
! $sql_from = ( $show_results == "posts" ) ? FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt" : FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2";
! $sql_where = ( $show_results == "posts" ) ? "pt.post_id = p.post_id AND f.forum_id = p.forum_id AND p.topic_id = t.topic_id AND p.poster_id = u.user_id" : "f.forum_id = t.forum_id AND u.user_id = t.topic_poster AND p.post_id = t.topic_last_post_id AND u2.user_id = p.poster_id";
//
***************
*** 773,777 ****
if( $show_results == "posts" )
{
! $sql = "SELECT pt.post_text, pt.bbcode_uid, pt.post_subject, p.*, f.forum_name, t.*, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid
FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt
WHERE p.post_id IN ($search_results)
--- 780,784 ----
if( $show_results == "posts" )
{
! $sql = "SELECT pt.post_text, pt.bbcode_uid, pt.post_subject, p.*, f.forum_id, f.forum_name, t.*, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid
FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt
WHERE p.post_id IN ($search_results)
|