Various changes and fixes to enable search from username and template updates

git-svn-id: file:///svn/phpbb/trunk@382 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-05-31 11:47:43 +00:00
parent 0a99b25500
commit b653b4dd67
4 changed files with 34 additions and 21 deletions

View file

@ -320,10 +320,11 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
"MSN" => stripslashes($profiledata['user_msnm']), "MSN" => stripslashes($profiledata['user_msnm']),
"L_YAHOO" => stripslashes($l_yahoo), "L_YAHOO" => stripslashes($l_yahoo),
"YIM" => stripslashes($profiledata['user_yim']), "YIM" => stripslashes($profiledata['user_yim']),
"WEBSITE" => "<a href=\"".stripslashes($profiledata['user_website'])."\" target=\"_blank\">".stripslashes($profiledata['user_website'])."</a>", "WEBSITE" => stripslashes($profiledata['user_website']),
"LOCATION" => stripslashes($profiledata['user_from']), "LOCATION" => stripslashes($profiledata['user_from']),
"OCCUPATION" => stripslashes($profiledata['user_occ']), "OCCUPATION" => stripslashes($profiledata['user_occ']),
"INTERESTS" => stripslashes($profiledata['user_interests']), "INTERESTS" => stripslashes($profiledata['user_interests']),
"AVATAR_IMG" => $board_config['avatar_path'] . "/" . stripslashes($profiledata['user_avatar']),
"L_VIEWING_PROFILE" => $l_viewing_profile, "L_VIEWING_PROFILE" => $l_viewing_profile,
"L_USERNAME" => $l_username, "L_USERNAME" => $l_username,
@ -339,6 +340,10 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
"L_LOCATION" => $l_from, "L_LOCATION" => $l_from,
"L_OCCUPATION" => $l_occupation, "L_OCCUPATION" => $l_occupation,
"L_INTERESTS" => $l_interests, "L_INTERESTS" => $l_interests,
"L_AVATAR" => $l_avatar,
"U_SEARCH_USER" => append_sid("search.$phpEx?a=".urlencode($profiledata['username'])."&f=all&b=0&d=DESC&c=100&dosearch=1"),
"U_USER_WEBSITE" => stripslashes($profiledata['user_website']),
"S_PROFILE_ACTION" => append_sid("profile.$phpEx")) "S_PROFILE_ACTION" => append_sid("profile.$phpEx"))
); );

View file

@ -30,7 +30,6 @@
include('extension.inc'); include('extension.inc');
include('common.'.$phpEx); include('common.'.$phpEx);
include('includes/bbcode.'.$phpEx);
$pagetype = "search"; $pagetype = "search";
$page_title = "Search Forums"; $page_title = "Search Forums";
@ -260,7 +259,7 @@ function gensearch_sql($searchstring, $override_all = 0)
} }
} }
$searchstring = "WHERE ($searchstring) AND (pt.post_id = p.post_id) "; $searchstring = "($searchstring)";
$searchdata[0] = $searchstring; $searchdata[0] = $searchstring;
for($i = 0; $i < count($searchforwords); $i++) for($i = 0; $i < count($searchforwords); $i++)
@ -290,11 +289,11 @@ init_userprefs($userdata);
$start = (isset($HTTP_GET_VARS['start'])) ? $HTTP_GET_VARS['start'] : 0; $start = (isset($HTTP_GET_VARS['start'])) ? $HTTP_GET_VARS['start'] : 0;
$querystring = (isset($HTTP_POST_VARS['querystring'])) ? $HTTP_POST_VARS['querystring'] : ( (isset($HTTP_GET_VARS['q'])) ? stripslashes($HTTP_GET_VARS['q']) : "" ); $querystring = (isset($HTTP_POST_VARS['querystring'])) ? $HTTP_POST_VARS['querystring'] : ( (!empty($HTTP_GET_VARS['q'])) ? stripslashes($HTTP_GET_VARS['q']) : "" );
$authorstring = (isset($HTTP_POST_VARS['authorstring'])) ? $HTTP_POST_VARS['authorstring'] : ( (isset($HTTP_GET_VARS['a'])) ? stripslashes($HTTP_GET_VARS['a']) : "" ); $authorstring = (isset($HTTP_POST_VARS['authorstring'])) ? $HTTP_POST_VARS['authorstring'] : ( (!empty($HTTP_GET_VARS['a'])) ? stripslashes($HTTP_GET_VARS['a']) : "" );
$return_chars = ($HTTP_POST_VARS['charsreqd'] != "all") ? $HTTP_POST_VARS['charsreqd'] : -1; $return_chars = ($HTTP_POST_VARS['charsreqd'] != "all") ? $HTTP_POST_VARS['charsreqd'] : -1;
$return_chars = (isset($HTTP_GET_VARS['c'])) ? ( ($HTTP_GET_VARS['c']!= "all") ? $HTTP_GET_VARS['c'] : -1 ) : $return_chars; $return_chars = (isset($HTTP_GET_VARS['c'])) ? ( ($HTTP_GET_VARS['c'] != "all") ? $HTTP_GET_VARS['c'] : -1 ) : $return_chars;
$searchall = ($HTTP_POST_VARS['addterms'] == "all") ? 1 : ( ($HTTP_GET_VARS['m'] == "all") ? 1 : 0 ); $searchall = ($HTTP_POST_VARS['addterms'] == "all") ? 1 : ( ($HTTP_GET_VARS['m'] == "all") ? 1 : 0 );
$searchforum = (isset($HTTP_POST_VARS['searchforum'])) ? $HTTP_POST_VARS['searchforum'] : $HTTP_GET_VARS['f'] ; $searchforum = (isset($HTTP_POST_VARS['searchforum'])) ? $HTTP_POST_VARS['searchforum'] : $HTTP_GET_VARS['f'] ;
$sortby = (isset($HTTP_POST_VARS['sortby'])) ? $HTTP_POST_VARS['sortby'] : $HTTP_GET_VARS['b']; $sortby = (isset($HTTP_POST_VARS['sortby'])) ? $HTTP_POST_VARS['sortby'] : $HTTP_GET_VARS['b'];
@ -325,27 +324,33 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) &&
// searching of private forums // searching of private forums
// //
if($querystring != "") if($querystring != "" || $authorstring != "")
{ {
$search_sql = ""; $search_sql = "";
$searchdata = gensearch_sql(stripslashes($querystring), $searchall); if($querystring != "")
$search_sql = $searchdata[0]; {
$searchdata = gensearch_sql(stripslashes($querystring), $searchall);
$search_sql = $searchdata[0];
}
if($authorstring != "")
{
$search_sql = preg_replace("/\(\)/", "", $search_sql);
$authorstring = stripslashes($authorstring);
$search_sql .= ($searchstring == "") ? "u.username LIKE '%$authorstring%'" : " AND (u.username LIKE '%$authorstring%')";
}
if(!ereg("\([ ]*\)",$search_sql)) if(!ereg("\([ ]*\)",$search_sql))
{ {
if($authorstring != "") $sql .= "WHERE $search_sql
{
$authorstring = stripslashes($authorstring);
$search_sql .= ($querystring == "") ? "WHERE u.username LIKE '%$authorstring%'" : " AND (u.username LIKE '%$authorstring%')";
}
$sql .= $search_sql."
AND (pt.post_id = p.post_id) AND (pt.post_id = p.post_id)
AND (f.forum_id = p.forum_id) AND (f.forum_id = p.forum_id)
AND (p.topic_id = t.topic_id) AND (p.topic_id = t.topic_id)
AND (p.poster_id = u.user_id)"; AND (p.poster_id = u.user_id)";
if($searchforum != "all") if($searchforum != "all")
{
$sql .= " AND (f.forum_id = '$searchforum')"; $sql .= " AND (f.forum_id = '$searchforum')";
}
$sql .= " ORDER BY ".$sortby_sql[$sortby]." $sortby_dir"; $sql .= " ORDER BY ".$sortby_sql[$sortby]." $sortby_dir";
@ -411,7 +416,10 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) &&
$message = preg_replace("/\[.*\]/", "", $message); $message = preg_replace("/\[.*\]/", "", $message);
$message = str_replace("\n", "<br />", $message); $message = str_replace("\n", "<br />", $message);
$message = preg_replace($search_string, $replace_string, $message); if(count($searchdata) > 1)
{
$message = preg_replace($search_string, $replace_string, $message);
}
} }
else else

View file

@ -42,7 +42,7 @@
</tr> </tr>
<tr class="tablebody"> <tr class="tablebody">
<td bgcolor="#DDDDDD"><b>{L_WEBSITE}:</b></td> <td bgcolor="#DDDDDD"><b>{L_WEBSITE}:</b></td>
<td bgcolor="#CCCCCC">{WEBSITE}</td> <td bgcolor="#CCCCCC"><a href="{U_USER_WEBSITE}" target="_wwwuser">{WEBSITE}</a></td>
</tr> </tr>
<tr class="tablebody"> <tr class="tablebody">
<td bgcolor="#DDDDDD"><b>{L_LOCATION}:</b></td> <td bgcolor="#DDDDDD"><b>{L_LOCATION}:</b></td>

View file

@ -12,7 +12,7 @@
</tr> </tr>
<tr> <tr>
<td bgcolor="{T_TD_COLOR1}" width="20%"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}">{L_USERNAME}:</font></td> <td bgcolor="{T_TD_COLOR1}" width="20%"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}">{L_USERNAME}:</font></td>
<td bgcolor="{T_TD_COLOR2}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}"><b>{USERNAME}</b> [<a href="search.{PHPEX}?term=&addterms=any&forum=all&search_username={USERNAME}&sortby=p.post_time&searchboth=both&submit=Search">{L_VIEW_USERS_POSTS}</a>]</font></td> <td bgcolor="{T_TD_COLOR2}" valign="middle"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}"><b>{USERNAME}</b> [<a href="{U_SEARCH_USER}">{L_VIEW_USERS_POSTS}</a>]</font></td>
</tr> </tr>
<tr> <tr>
<td bgcolor="{T_TD_COLOR1}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}">{L_JOINED}:</font></td> <td bgcolor="{T_TD_COLOR1}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}">{L_JOINED}:</font></td>
@ -44,7 +44,7 @@
</tr> </tr>
<tr> <tr>
<td bgcolor="{T_TD_COLOR1}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}">{L_WEBSITE}:</font></td> <td bgcolor="{T_TD_COLOR1}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}">{L_WEBSITE}:</font></td>
<td bgcolor="{T_TD_COLOR2}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}">{WEBSITE}</b></font></td> <td bgcolor="{T_TD_COLOR2}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}"><a href="{U_USER_WEBSITE}" target="_userwww">{WEBSITE}</a></b></font></td>
</tr> </tr>
<tr> <tr>
<td bgcolor="{T_TD_COLOR1}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}">{L_LOCATION}:</font></td> <td bgcolor="{T_TD_COLOR1}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}">{L_LOCATION}:</font></td>