Fix for 'bug' #484650

git-svn-id: file:///svn/phpbb/trunk@1479 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-11-29 13:05:03 +00:00
parent 9f26525a76
commit c45feb1347
2 changed files with 31 additions and 16 deletions

View file

@ -671,7 +671,8 @@ $lang['Sort_Author'] = "Author";
$lang['Sort_Forum'] = "Forum";
$lang['Display_results'] = "Display results as";
$lang['All'] = "All";
$lang['All_available'] = "All available";
$lang['No_searchable_forums'] = "You do not have permissions to search any forum on this site";
$lang['No_search_match'] = "No topics or posts met your search criteria";
$lang['Found_search_match'] = "Search found %d match"; // eg. Search found 1 match

View file

@ -34,10 +34,19 @@ function clean_words_search($entry)
$char_match = array("^", "$", "&", "(", ")", "<", ">", "`", "'", "|", ",", "@", "_", "?", "%", "~", ".", "[", "]", "{", "}", ":", "\\", "/", "=", "#", "\"", ";", "!");
$char_replace = array(" ", " ", " ", " ", " ", " ", " ", " ", "", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ");
$sgml_match = array("&nbsp;", "&szlig;", "&agrave;", "&aacute;", "&acirc;", "&atilde;", "&auml;", "&aring;", "&aelig;", "&ccedil;", "&egrave;", "&eacute;", "&ecirc;", "&euml;", "&igrave;", "&iacute;", "&icirc;", "&iuml;", "&eth;", "&ntilde;", "&ograve;", "&oacute;", "&ocirc;", "&otilde;", "&ouml;", "&oslash;", "&ugrave;", "&uacute;", "&ucirc;", "&uuml;", "&yacute;", "&thorn;", "&yuml;");
$sgml_replace = array(" ", "s", "a", "a", "a", "a", "a", "a", "a", "c", "e", "e", "e", "e", "i", "i", "i", "i", "o", "n", "o", "o", "o", "o", "o", "o", "u", "u", "u", "u", "y", "t", "y");
$accent_match = array("ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ");
$accent_replace = array("s", "a", "a", "a", "a", "a", "a", "a", "c", "e", "e", "e", "e", "i", "i", "i", "i", "o", "n", "o", "o", "o", "o", "o", "o", "u", "u", "u", "u", "y", "t", "y");
$entry = " " . strip_tags(strtolower($entry)) . " ";
$entry = str_replace("+", " and ", $entry);
$entry = str_replace("-", " not ", $entry);
$entry = str_replace($sgml_match, $sgml_match, $entry);
$entry = str_replace($accent_match, $accent_replace, $entry);
$entry = str_replace($char_match, $char_replace, $entry);
$entry = preg_replace("/\b[0-9]+\b/", " ", $entry);
@ -315,8 +324,7 @@ else if( $query_keywords != "" || $query_author != "" || $search_id )
$sql = "SELECT m.post_id
FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m
WHERE w.word_text LIKE '$match_word'
AND m.word_id = w.word_id
ORDER BY m.post_id";
AND m.word_id = w.word_id";
$result = $db->sql_query($sql);
if( !$result )
{
@ -530,8 +538,6 @@ else if( $query_keywords != "" || $query_author != "" || $search_id )
$searchset = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
//
// Clean up search results table
//
@ -1079,8 +1085,7 @@ if(!$result)
$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
$s_forums = "<option value=\"all\">" . $lang['All'] . "</option>";
$s_forums = "";
while($row = $db->sql_fetchrow($result))
{
if( $is_auth_ary[$row['forum_id']]['auth_read'] )
@ -1093,19 +1098,28 @@ while($row = $db->sql_fetchrow($result))
}
}
if( $s_forums != "" )
{
$s_forums = "<option value=\"all\">" . $lang['All_available'] . "</option>" . $s_forums;
//
// Category to search
//
$s_categories = "<option value=\"all\">" . $lang['All'] . "</option>";
while( list($cat_id, $cat_title) = each($list_cat))
$s_categories = "<option value=\"all\">" . $lang['All_available'] . "</option>";
while( list($cat_id, $cat_title) = @each($list_cat))
{
$s_categories .= "<option value=\"$cat_id\">$cat_title</option>";
}
}
else
{
message_die(GENERAL_MESSAGE, $lang['No_searchable_forums']);
}
//
// Number of chars returned
//
$s_characters = "<option value=\"all\">" . $lang['All'] . "</option>";
$s_characters = "<option value=\"all\">" . $lang['All_available'] . "</option>";
$s_characters .= "<option value=\"0\">0</option>";
$s_characters .= "<option value=\"25\">25</option>";
$s_characters .= "<option value=\"50\">50</option>";