|
From: Paul S. O. <ps...@us...> - 2001-12-20 01:25:03
|
Update of /cvsroot/phpbb/phpBB2
In directory usw-pr-cvs1:/tmp/cvs-serv27404
Modified Files:
search.php
Log Message:
Fix bug #495250 and various other issues
Index: search.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/search.php,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -r1.49 -r1.50
*** search.php 2001/12/20 00:39:22 1.49
--- search.php 2001/12/20 01:25:00 1.50
***************
*** 159,166 ****
{
$return_chars = ( isset($HTTP_POST_VARS['charsreqd']) ) ? intval($HTTP_POST_VARS['charsreqd']) : intval($HTTP_GET_VARS['charsreqd']);
- if( $return_chars == "all" )
- {
- $return_chars = -1;
- }
}
else
--- 159,162 ----
***************
*** 175,179 ****
else
{
! $search_cat = "all";
}
--- 171,175 ----
else
{
! $search_cat = -1;
}
***************
*** 184,188 ****
else
{
! $search_forum = "all";
}
--- 180,184 ----
else
{
! $search_forum = -1;
}
***************
*** 216,220 ****
if(!empty($HTTP_POST_VARS['resultdays']) )
{
! $search_time = time() - ( $HTTP_POST_VARS['resultdays'] * 86400 );
}
else
--- 212,216 ----
if(!empty($HTTP_POST_VARS['resultdays']) )
{
! $search_time = time() - ( intval($HTTP_POST_VARS['resultdays']) * 86400 );
}
else
***************
*** 223,227 ****
}
! $start = ( isset($HTTP_GET_VARS['start']) ) ? $HTTP_GET_VARS['start'] : 0;
//
--- 219,223 ----
}
! $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
//
***************
*** 277,280 ****
--- 273,280 ----
message_die(GENERAL_MESSAGE, $lang['No_search_match']);
}
+
+ $show_results = "topics";
+ $sortby = 0;
+ $sortby_dir = "DESC";
}
else if( $search_id == "egosearch" )
***************
*** 284,287 ****
--- 284,291 ----
WHERE poster_id = " . $userdata['user_id'] . "
ORDER BY post_time DESC";
+
+ $show_results = "topics";
+ $sortby = 0;
+ $sortby_dir = "DESC";
}
else
***************
*** 316,319 ****
--- 320,324 ----
ORDER BY post_time DESC";
}
+
$result = $db->sql_query($sql);
if( !$result )
***************
*** 336,360 ****
if( $sql_post_id_in != "" )
{
! $sql = "SELECT topic_id
! FROM " . POSTS_TABLE . "
! WHERE post_id IN ($sql_post_id_in)
! GROUP BY topic_id";
! $result = $db->sql_query($sql);
! if( !$result )
{
! message_die(GENERAL_ERROR, "Couldn't matched posts", "", __LINE__, __FILE__, $sql);
! }
! $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
--- 341,384 ----
if( $sql_post_id_in != "" )
{
! if( $show_results == "posts" )
{
! $search_sql .= "p.post_id IN ($sql_post_id_in)";
! if( $search_time )
{
! $search_sql .= " AND p.post_time >= $search_time ";
}
}
+ else
+ {
+ $search_time_sql = "";
+ if( $search_time )
+ {
+ $search_time_sql = "AND post_time >= $search_time";
+ }
! $sql = "SELECT topic_id
! FROM " . POSTS_TABLE . "
! WHERE post_id IN ($sql_post_id_in)
! $search_time_sql
! GROUP BY topic_id";
! $result = $db->sql_query($sql);
! if( !$result )
! {
! message_die(GENERAL_ERROR, "Couldn't matched posts", "", __LINE__, __FILE__, $sql);
! }
!
! $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
***************
*** 362,370 ****
message_die(GENERAL_MESSAGE, $lang['No_search_match']);
}
-
- $show_results = "topics";
- $sortby = 0;
- $sortby_dir = "DESC";
-
}
else if( $search_id == "unanswered" )
--- 386,389 ----
***************
*** 550,576 ****
$search_sql .= "t.topic_id IN ($sql_post_id_in) ";
- /*
- if( $query_author == "" )
- {
- $search_sql .= "t.topic_id IN (
- SELECT topic_id
- FROM " . POSTS_TABLE . "
- WHERE post_id IN ($sql_post_id_in)
- $search_time_sql
- GROUP BY topic_id )";
- }
- else
- {
- $search_sql .= "t.topic_id IN (
- SELECT p.topic_id
- FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
- WHERE p.post_id IN ($sql_post_id_in)
- AND u.username LIKE '$query_author'
- AND p.poster_id = u.user_id
- $search_time_sql
- GROUP BY p.topic_id )";
- }
- */
-
}
}
--- 569,572 ----
***************
*** 605,609 ****
//
$auth_sql = "";
! if( $search_forum != "all" )
{
$is_auth = auth(AUTH_READ, $search_forum, $userdata);
--- 601,605 ----
//
$auth_sql = "";
! if( $search_forum != -1 )
{
$is_auth = auth(AUTH_READ, $search_forum, $userdata);
***************
*** 622,626 ****
$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
! if( $search_cat != "all" )
{
$auth_sql = "f.cat_id = $search_cat";
--- 618,622 ----
$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
! if( $search_cat != -1 )
{
$auth_sql = "f.cat_id = $search_cat";
***************
*** 908,912 ****
if( $showresults == "posts" )
{
! if( $return_chars )
{
$bbcode_uid = $searchset[$i]['bbcode_uid'];
--- 904,908 ----
if( $showresults == "posts" )
{
! if( isset($return_chars) )
{
$bbcode_uid = $searchset[$i]['bbcode_uid'];
***************
*** 1240,1244 ****
ORDER BY c.cat_id, f.forum_order";
$result = $db->sql_query($sql);
! if(!$result)
{
message_die(GENERAL_ERROR, "Couldn't obtain forum_name/forum_id", "", __LINE__, __FILE__, $sql);
--- 1236,1240 ----
ORDER BY c.cat_id, f.forum_order";
$result = $db->sql_query($sql);
! if( !$result )
{
message_die(GENERAL_ERROR, "Couldn't obtain forum_name/forum_id", "", __LINE__, __FILE__, $sql);
***************
*** 1248,1252 ****
$s_forums = "";
! while($row = $db->sql_fetchrow($result))
{
if( $is_auth_ary[$row['forum_id']]['auth_read'] )
--- 1244,1248 ----
$s_forums = "";
! while( $row = $db->sql_fetchrow($result) )
{
if( $is_auth_ary[$row['forum_id']]['auth_read'] )
***************
*** 1262,1271 ****
if( $s_forums != "" )
{
! $s_forums = "<option value=\"all\">" . $lang['All_available'] . "</option>" . $s_forums;
//
// Category to search
//
! $s_categories = "<option value=\"all\">" . $lang['All_available'] . "</option>";
while( list($cat_id, $cat_title) = @each($list_cat))
{
--- 1258,1267 ----
if( $s_forums != "" )
{
! $s_forums = "<option value=\"-1\">" . $lang['All_available'] . "</option>" . $s_forums;
//
// Category to search
//
! $s_categories = "<option value=\"-1\">" . $lang['All_available'] . "</option>";
while( list($cat_id, $cat_title) = @each($list_cat))
{
***************
*** 1281,1285 ****
// Number of chars returned
//
! $s_characters = "<option value=\"all\">" . $lang['All_available'] . "</option>";
$s_characters .= "<option value=\"0\">0</option>";
$s_characters .= "<option value=\"25\">25</option>";
--- 1277,1281 ----
// Number of chars returned
//
! $s_characters = "<option value=\"-1\">" . $lang['All_available'] . "</option>";
$s_characters .= "<option value=\"0\">0</option>";
$s_characters .= "<option value=\"25\">25</option>";
***************
*** 1288,1292 ****
for($i = 100; $i < 1100 ; $i += 100)
{
! $selected = ($i == 200) ? "selected=\"selected\"" : "";
$s_characters .= "<option value=\"$i\"$selected>$i</option>";
}
--- 1284,1288 ----
for($i = 100; $i < 1100 ; $i += 100)
{
! $selected = ( $i == 200 ) ? "selected=\"selected\"" : "";
$s_characters .= "<option value=\"$i\"$selected>$i</option>";
}
***************
*** 1310,1314 ****
for($i = 0; $i < count($previous_days); $i++)
{
! $selected = ($topic_days == $previous_days[$i]) ? " selected=\"selected\"" : "";
$s_time .= "<option value=\"" . $previous_days[$i] . "\"$selected>" . $previous_days_text[$i] . "</option>";
}
--- 1306,1310 ----
for($i = 0; $i < count($previous_days); $i++)
{
! $selected = ( $topic_days == $previous_days[$i] ) ? " selected=\"selected\"" : "";
$s_time .= "<option value=\"" . $previous_days[$i] . "\"$selected>" . $previous_days_text[$i] . "</option>";
}
|