1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-04-21 00:02:18 +02:00

Some changes to the way we filter short search terms since it seemed to not completely work on some configurations

I've moved the minimum number of characters to a config variable as well to save hard-coding it several times and allow configuration for those who want it
There will not be an option to change this via the ACP, you can always do so via the database if you want to


git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@5942 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Graham Eames 2006-05-20 14:01:48 +00:00
parent a44002aefe
commit 1cee6fcf41
6 changed files with 15 additions and 4 deletions

View File

@ -75,6 +75,8 @@ p,ul,td {font-size:10pt;}
<li>[Fix] Redirect to list if cancelling deletion of ranks, smilies or word censors</li>
<li>[Fix] Missing error message if an inactive user tried to login (Bug #1598)</li>
<li>[Fix] Do not alter post counts when just removing a poll (Bug #1602)</li>
<li>[Fix] Correct error in removal of old session keys</li>
<li>[Fix] Changed filtering of short search terms</li>
<li>[Sec] Improved filtering on language selection (also addresses a number of bug reports related to missing languages)</li>
<li>[Change] Backported more efficient highlighting code from Olympus</li>
</ul>

View File

@ -52,6 +52,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('sendmail_fix','0')
INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_flood_interval','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_min_chars','3');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_login_attempts', '5');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('login_reset_time', '30');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0');

View File

@ -45,6 +45,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('sendmail_fix','0')
INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_flood_interval','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_min_chars','3');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_login_attempts', '5');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('login_reset_time', '30');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0');

View File

@ -46,6 +46,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('sendmail_fix','0')
INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation','0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_flood_interval','15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_min_chars','3');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_login_attempts', '5');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('login_reset_time', '30');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('board_email_form','0');

View File

@ -1092,6 +1092,12 @@ switch ($row['config_value'])
VALUES ('rand_seed', '0')";
_sql($sql, $errored, $error_ary);
case '.0.20':
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
VALUES ('search_min_chars', '3')";
_sql($sql, $errored, $error_ary);
// We reset those having autologin enabled and forcing the re-assignment of a session id
// since there have been changes to the way these are handled from previous versions
$sql = 'DELETE FROM ' . SESSIONS_TABLE;
@ -1103,7 +1109,7 @@ switch ($row['config_value'])
break;
default:
echo " No updates where required</b></p>\n";
echo " No updates were required</b></p>\n";
break;
}

View File

@ -218,7 +218,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
{
$search_author = str_replace('*', '%', trim($search_author));
if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < 3 ) )
if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < $board_config['search_min_chars'] ) )
{
$search_author = '';
}
@ -290,7 +290,7 @@ 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]))))
if ( strlen(str_replace(array('*', '%'), '', trim($split_search[$i]))) < $board_config['search_min_chars'] )
{
$split_search[$i] = '';
continue;
@ -441,7 +441,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
{
$search_author = str_replace('*', '%', trim($search_author));
if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < 3 ) )
if( ( strpos($search_author, '%') !== false ) && ( strlen(str_replace('%', '', $search_author)) < $board_config['search_min_chars'] ) )
{
$search_author = '';
}