mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-05 15:16:16 +02:00
- ignore too short/too long search words [Bug #7438]
git-svn-id: file:///svn/phpbb/trunk@6944 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
b4568af559
commit
eaef76a100
@ -311,9 +311,18 @@ class fulltext_native extends search_backend
|
||||
// else we only need one id
|
||||
else if (($wildcard = strpos($word, '*') !== false) || isset($words[$word]))
|
||||
{
|
||||
|
||||
if ($wildcard)
|
||||
{
|
||||
$this->{$mode . '_ids'}[] = '\'' . $db->sql_escape(str_replace('*', '%', $word)) . '\'';
|
||||
$len = utf8_strlen(str_replace('*', '', $word));
|
||||
if ($len >= $this->word_length['min'] && $len <= $this->word_length['max'])
|
||||
{
|
||||
$this->{$mode . '_ids'}[] = '\'' . $db->sql_escape(str_replace('*', '%', $word)) . '\'';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->common_words[] = $row['word_text'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -325,7 +334,23 @@ class fulltext_native extends search_backend
|
||||
{
|
||||
if (!isset($common_ids[$word]))
|
||||
{
|
||||
trigger_error(sprintf($user->lang['WORD_IN_NO_POST'], $word));
|
||||
$len = utf8_strlen($word);
|
||||
if ($len >= $this->word_length['min'] && $len <= $this->word_length['max'])
|
||||
{
|
||||
trigger_error(sprintf($user->lang['WORD_IN_NO_POST'], $word));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->common_words[] = $word;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$len = utf8_strlen($word);
|
||||
if ($len < $this->word_length['min'] || $len > $this->word_length['max'])
|
||||
{
|
||||
$this->common_words[] = $word;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
}
|
||||
else if ($author)
|
||||
{
|
||||
if ((strpos($author, '*') !== false) && (str_replace(array('*', '%'), '', $author) < $config['min_search_author_chars']))
|
||||
if ((strpos($author, '*') !== false) && (utf8_strlen(str_replace(array('*', '%'), '', $author)) < $config['min_search_author_chars']))
|
||||
{
|
||||
trigger_error(sprintf($user->lang['TOO_FEW_AUTHOR_CHARS'], $config['min_search_author_chars']));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user