mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
- 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:
parent
5931f77a3b
commit
dfd0fd39fd
1 changed files with 16 additions and 0 deletions
|
@ -197,6 +197,11 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
|
|||
}
|
||||
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));
|
||||
|
||||
$sql = "SELECT user_id
|
||||
|
@ -264,6 +269,12 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
|
|||
|
||||
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] )
|
||||
{
|
||||
case 'and':
|
||||
|
@ -407,6 +418,11 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
|
|||
//
|
||||
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)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue