- try some matching against server intensive searches...

git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@5102 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2005-03-15 18:34:34 +00:00
parent 5931f77a3b
commit dfd0fd39fd

View file

@ -197,6 +197,11 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
} }
else else
{ {
if (preg_match('#^[\*%]+$#', trim($search_author)) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($search_author))))
{
$search_author = '';
}
$search_author = str_replace('*', '%', trim($search_author)); $search_author = str_replace('*', '%', trim($search_author));
$sql = "SELECT user_id $sql = "SELECT user_id
@ -264,6 +269,12 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
for($i = 0; $i < count($split_search); $i++) for($i = 0; $i < count($split_search); $i++)
{ {
if (preg_match('#^[\*%]+$#', trim($split_search[$i])) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($split_search[$i]))))
{
$split_search[$i] = '';
continue;
}
switch ( $split_search[$i] ) switch ( $split_search[$i] )
{ {
case 'and': case 'and':
@ -407,6 +418,11 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
// //
if ( $search_author != '' ) if ( $search_author != '' )
{ {
if (preg_match('#^[\*%]+$#', trim($search_author)) || preg_match('#^[^\*]{1,2}$#', str_replace(array('*', '%'), '', trim($search_author))))
{
$search_author = '';
}
$search_author = str_replace('*', '%', trim(str_replace("\'", "''", $search_author))); $search_author = str_replace('*', '%', trim(str_replace("\'", "''", $search_author)));
} }