diff options
author | Nils Adermann <naderman@naderman.de> | 2006-12-27 00:06:39 +0000 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2006-12-27 00:06:39 +0000 |
commit | b41365fcd41fc185fe197667d2f0bec13f6c30c2 (patch) | |
tree | e7746c0e1e870e82a62bb52f08cdb10977059d56 | |
parent | 677dc5d2e11c3209fcaf798e4b44588a9305328f (diff) | |
download | forums-b41365fcd41fc185fe197667d2f0bec13f6c30c2.tar forums-b41365fcd41fc185fe197667d2f0bec13f6c30c2.tar.gz forums-b41365fcd41fc185fe197667d2f0bec13f6c30c2.tar.bz2 forums-b41365fcd41fc185fe197667d2f0bec13f6c30c2.tar.xz forums-b41365fcd41fc185fe197667d2f0bec13f6c30c2.zip |
- display search type as page title for premade searches [Bug #6508]
- flash enabled on user side by default, so that admins can actually change anything by activating it (still disabled by default)
- properly implemented password complexity check [Bug #6584]
- do not ldap_escape paramaters for the bind function [Bug #6208]
- deleted words in edited post subjects weren't getting there search cache refreshed [Bug #6288]
- made common word threshold configurable [Bug #6168]
- recreated word match table entries after installation, side effect of bug #6060
- option to only allow ASCII usernames
- adjusted search page pagination [Bug #6424]
- correctly calculate unformatted search result extract length
git-svn-id: file:///svn/phpbb/trunk@6814 89ea8834-ac86-4346-8a33-228a782c2dd0
23 files changed, 148 insertions, 52 deletions
diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html index 5c35c95747..efdaf1980a 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -322,15 +322,15 @@ </dl> <dl> <dt><label for="font_weight">{L_BOLD}:</label></dt> - <dd><input id="font_weight" type="radio" class="radio" name="font_weight" value="bold"<!-- IF FONT_WEIGHT eq "bold" --> checked="checked"<!-- ENDIF --> /> {L_YES} <input type="radio" class="radio" name="font_weight" value="normal"<!-- IF FONT_WEIGHT eq "normal" --> checked="checked"<!-- ENDIF --> /> {L_NO} <input type="radio" class="radio" name="font_weight" value=""<!-- IF not FONT_WEIGHT --> checked="checked"<!-- ENDIF --> /> {L_UNSET}</dd> + <dd><input id="font_weight" type="radio" class="radio" name="font_weight" value="bold"<!-- IF FONT_WEIGHT eq "bold" --> checked="checked"<!-- ENDIF --> /> {L_YES} <input type="radio" class="radio" name="font_weight" value="none"<!-- IF FONT_WEIGHT eq "none" --> checked="checked"<!-- ENDIF --> /> {L_NO} <input type="radio" class="radio" name="font_weight" value=""<!-- IF not FONT_WEIGHT --> checked="checked"<!-- ENDIF --> /> {L_UNSET}</dd> </dl> <dl> <dt><label for="font_style">{L_ITALIC}:</label></dt> - <dd><input id="font_style" type="radio" class="radio" name="font_style" value="italic"<!-- IF FONT_STYLE eq "italic" --> checked="checked"<!-- ENDIF --> /> {L_YES} <input type="radio" class="radio" name="font_style" value="normal"<!-- IF FONT_STYLE eq "normal" --> checked="checked"<!-- ENDIF --> /> {L_NO} <input type="radio" class="radio" name="font_style" value=""<!-- IF not FONT_STYLE --> checked="checked"<!-- ENDIF --> /> {L_UNSET}</dd> + <dd><input id="font_style" type="radio" class="radio" name="font_style" value="italic"<!-- IF FONT_STYLE eq "italic" --> checked="checked"<!-- ENDIF --> /> {L_YES} <input type="radio" class="radio" name="font_style" value="none"<!-- IF FONT_STYLE eq "none" --> checked="checked"<!-- ENDIF --> /> {L_NO} <input type="radio" class="radio" name="font_style" value=""<!-- IF not FONT_STYLE --> checked="checked"<!-- ENDIF --> /> {L_UNSET}</dd> </dl> <dl> <dt><label for="text_decoration">{L_UNDERLINE}:</label></dt> - <dd><input id="text_decoration" type="radio" class="radio" name="text_decoration" value="underline"<!-- IF TEXT_DECORATION eq "underline" --> checked="checked"<!-- ENDIF --> /> {L_YES} <input type="radio" class="radio" name="text_decoration" value="normal"<!-- IF TEXT_DECORATION eq "normal" --> checked="checked"<!-- ENDIF --> /> {L_NO} <input type="radio" class="radio" name="text_decoration" value=""<!-- IF not TEXT_DECORATION --> checked="checked"<!-- ENDIF --> /> {L_UNSET}</dd> + <dd><input id="text_decoration" type="radio" class="radio" name="text_decoration" value="underline"<!-- IF TEXT_DECORATION eq "underline" --> checked="checked"<!-- ENDIF --> /> {L_YES} <input type="radio" class="radio" name="text_decoration" value="none"<!-- IF TEXT_DECORATION eq "none" --> checked="checked"<!-- ENDIF --> /> {L_NO} <input type="radio" class="radio" name="text_decoration" value=""<!-- IF not TEXT_DECORATION --> checked="checked"<!-- ENDIF --> /> {L_UNSET}</dd> </dl> <dl> <dt><label for="line_height">{L_LINE_SPACING}</label></dt> diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index f17623da44..7f6ee07d44 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1878,7 +1878,7 @@ function get_schema_struct() 'user_allow_viewonline' => array('BOOL', 1), 'user_allow_viewemail' => array('BOOL', 1), 'user_allow_massemail' => array('BOOL', 1), - 'user_options' => array('UINT:11', 893), + 'user_options' => array('UINT:11', 895), 'user_avatar' => array('VCHAR', ''), 'user_avatar_type' => array('TINT:2', 0), 'user_avatar_width' => array('USINT', 0), diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 9638accc26..7cd50d004e 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -668,7 +668,8 @@ class acp_board { global $user; - $user_char_ary = array('USERNAME_CHARS_ANY' => '.*', 'USERNAME_ALPHA_ONLY' => '[\w]+', 'USERNAME_ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+'); + $user_char_ary = array('USERNAME_CHARS_ANY' => '.*', 'USERNAME_ALPHA_ONLY' => '[a-z]+', 'USERNAME_ALPHA_SPACERS' => '[-\]_+ [a-z]+', 'USERNAME_LETTER_NUM' => '\w+', 'USERNAME_LETTER_NUM_SPACERS' => '[-\]_+ [\w]+', 'USERNAME_ASCII' => '[\x01-\x7F]+'); + $user_char_options = ''; foreach ($user_char_ary as $lang => $value) { @@ -696,12 +697,12 @@ class acp_board { global $user; - $pass_type_ary = array('PASS_TYPE_ANY' => '.*', 'PASS_TYPE_CASE' => '[a-zA-Z]', 'PASS_TYPE_ALPHA' => '[a-zA-Z0-9]', 'PASS_TYPE_SYMBOL' => '[a-zA-Z\W]'); + $pass_type_ary = array('PASS_TYPE_ANY', 'PASS_TYPE_CASE', 'PASS_TYPE_ALPHA', 'PASS_TYPE_SYMBOL'); $pass_char_options = ''; - foreach ($pass_type_ary as $lang => $value) + foreach ($pass_type_ary as $pass_type) { - $selected = ($selected_value == $value) ? ' selected="selected"' : ''; - $pass_char_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>'; + $selected = ($selected_value == $pass_type) ? ' selected="selected"' : ''; + $pass_char_options .= '<option value="' . $pass_type . '"' . $selected . '>' . $user->lang[$pass_type] . '</option>'; } return $pass_char_options; diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 7c0834aa79..82017a5871 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -790,8 +790,7 @@ class acp_users $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); } - $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[a-z]+' => 'USERNAME_ALPHA_ONLY', '[-\]_+ [a-z]+' => 'USERNAME_ALPHA_SPACERS', '\w+' => 'USERNAME_LETTER_NUM', '[-\]_+ [\w]+' => 'USERNAME_LETTER_NUM_SPACERS'); - $pass_char_ary = array('.*' => 'PASS_TYPE_ANY', '[a-zA-Z]' => 'PASS_TYPE_CASE', '[a-zA-Z0-9]' => 'PASS_TYPE_ALPHA', '[a-zA-Z\W]' => 'PASS_TYPE_SYMBOL'); + $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[a-z]+' => 'USERNAME_ALPHA_ONLY', '[-\]_+ [a-z]+' => 'USERNAME_ALPHA_SPACERS', '\w+' => 'USERNAME_LETTER_NUM', '[-\]_+ [\w]+' => 'USERNAME_LETTER_NUM_SPACERS', '[\x01-\x7F]+' => 'USERNAME_ASCII'); if ($user_id == $user->data['user_id']) { @@ -868,7 +867,7 @@ class acp_users $template->assign_vars(array( 'L_NAME_CHARS_EXPLAIN' => sprintf($user->lang[$user_char_ary[str_replace('\\\\', '\\', $config['allow_name_chars'])] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), - 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$pass_char_ary[str_replace('\\\\', '\\', $config['pass_complex'])] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), + 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), 'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, 'S_OVERVIEW' => true, diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php index 365361a364..ff6ff3edd1 100644 --- a/phpBB/includes/auth/auth_ldap.php +++ b/phpBB/includes/auth/auth_ldap.php @@ -36,7 +36,7 @@ function init_ldap() if ($config['ldap_user'] || $config['ldap_password']) { - if (!@ldap_bind($ldap, ldap_escape(htmlspecialchars_decode($config['ldap_user'])), htmlspecialchars_decode($config['ldap_password']))) + if (!@ldap_bind($ldap, htmlspecialchars_decode($config['ldap_user']), htmlspecialchars_decode($config['ldap_password']))) { return $user->lang['LDAP_INCORRECT_USER_PASSWORD']; } diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index aa5c766764..a88e3be9bf 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2389,7 +2389,6 @@ function make_clickable($text, $server_url = false) $magic_url_replace[] = "'\$1<!-- l --><a href=\"\$2/' . preg_replace('/(&|\?)sid=[0-9a-f]{32}/', '\\\\1', '\$3') . '\">' . preg_replace('/(&|\?)sid=[0-9a-f]{32}/', '\\\\1', '\$3') . '</a><!-- l -->'"; // matches a xxxx://aaaaa.bbb.cccc. ... - //$magic_url_match[] = '#(^|[\n\t (])(' . get_preg_expression('url') . ')([[ \t\n\r<"\'\)]|&(?!lt;|quot;))*#ie'; $magic_url_match[] = '#(^|[\n\t (])(' . get_preg_expression('url') . ')#ie'; $magic_url_replace[] = "'\$1<!-- m --><a href=\"\$2\">' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . '</a><!-- m -->'"; diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 0ac9b7b97b..5991243d64 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1219,10 +1219,51 @@ function validate_password($password) return false; } - // We only check for existance of characters - if (!preg_match('#' . str_replace('\\\\', '\\', $config['pass_complex']) . '#i', $password)) + // generic UTF-8 character types supported? + if (version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>='))) { - return 'INVALID_CHARS'; + $upp = '\p{Lu}'; + $low = '\p{Ll}'; + $num = '\p{N}'; + $sym = '[^\p{Lu}\p{Ll}\p{N}]'; + } + else + { + $upp = '[A-Z]'; + $low = '[a-z]'; + $num = '[0-9]'; + $sym = '[^A-Za-z0-9]'; + } + + $chars = array(); + + switch ($config['pass_complex']) + { + case 'PASS_TYPE_CASE': + $chars[] = $low; + $chars[] = $upp; + break; + + case 'PASS_TYPE_ALPHA': + $chars[] = $low; + $chars[] = $upp; + $chars[] = $num; + break; + + case 'PASS_TYPE_SYMBOL': + $chars[] = $low; + $chars[] = $upp; + $chars[] = $num; + $chars[] = $sym; + break; + } + + foreach ($chars as $char) + { + if (!preg_match('#' . $char . '#u', $password)) + { + return 'INVALID_CHARS'; + } } return false; diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index 4ad0f8ae41..cbdef03b88 100755 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -1136,7 +1136,7 @@ class fulltext_native extends search_backend } // destroy cached search results containing any of the words removed or added - $this->destroy_cache(array_unique(array_merge($words['add']['post'], $words['add']['title'], $words['del']['post'], $words['del']['post'])), array($poster_id)); + $this->destroy_cache(array_unique(array_merge($words['add']['post'], $words['add']['title'], $words['del']['post'], $words['del']['title'])), array($poster_id)); unset($unique_add_words); unset($words); @@ -1179,14 +1179,15 @@ class fulltext_native extends search_backend $destroy_cache_words = array(); - // Remove common (> 20% of posts ) words - if ($config['num_posts'] >= 100) + // Remove common words + if ($config['num_posts'] >= 100 && $config['fulltext_native_common_thres']) { + $common_threshold = ((double) $config['fulltext_native_common_thres']) / 100.0; // First, get the IDs of common words $sql = 'SELECT word_id FROM ' . SEARCH_WORDMATCH_TABLE . ' GROUP BY word_id - HAVING COUNT(word_id) > ' . floor($config['num_posts'] * 0.2); + HAVING COUNT(word_id) > ' . floor($config['num_posts'] * $common_threshold); $result = $db->sql_query($sql); $sql_in = array(); @@ -1556,12 +1557,16 @@ class fulltext_native extends search_backend <dt><label for="fulltext_native_max_chars">' . $user->lang['MAX_SEARCH_CHARS'] . ':</label><br /><span>' . $user->lang['MAX_SEARCH_CHARS_EXPLAIN'] . '</span></dt> <dd><input id="fulltext_native_max_chars" type="text" size="3" maxlength="3" name="config[fulltext_native_max_chars]" value="' . (int) $config['fulltext_native_max_chars'] . '" /></dd> </dl> + <dl> + <dt><label for="fulltext_native_common_thres">' . $user->lang['COMMON_WORD_THRESHOLD'] . ':</label><br /><span>' . $user->lang['COMMON_WORD_THRESHOLD_EXPLAIN'] . '</span></dt> + <dd><input id="fulltext_native_common_thres" type="text" size="3" maxlength="3" name="config[fulltext_native_common_thres]" value="' . (int) $config['fulltext_native_common_thres'] . '" /> %</dd> + </dl> '; // These are fields required in the config table return array( 'tpl' => $tpl, - 'config' => array('fulltext_native_load_upd' => 'bool', 'fulltext_native_min_chars' => 'integer:0:255', 'fulltext_native_max_chars' => 'integer:0:255') + 'config' => array('fulltext_native_load_upd' => 'bool', 'fulltext_native_min_chars' => 'integer:0:255', 'fulltext_native_max_chars' => 'integer:0:255', 'fulltext_native_common_thres' => 'double:0:100') ); } } diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 37d44958bc..050eece86e 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -478,10 +478,8 @@ class ucp_register break; } - $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[a-z]+' => 'USERNAME_ALPHA_ONLY', '[-\]_+ [a-z]+' => 'USERNAME_ALPHA_SPACERS', '\w+' => 'USERNAME_LETTER_NUM', '[-\]_+ [\w]+' => 'USERNAME_LETTER_NUM_SPACERS'); - $pass_char_ary = array('.*' => 'PASS_TYPE_ANY', '[a-zA-Z]' => 'PASS_TYPE_CASE', '[a-zA-Z0-9]' => 'PASS_TYPE_ALPHA', '[a-zA-Z\W]' => 'PASS_TYPE_SYMBOL'); + $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[a-z]+' => 'USERNAME_ALPHA_ONLY', '[-\]_+ [a-z]+' => 'USERNAME_ALPHA_SPACERS', '\w+' => 'USERNAME_LETTER_NUM', '[-\]_+ [\w]+' => 'USERNAME_LETTER_NUM_SPACERS', '[\x01-\x7F]+' => 'USERNAME_ASCII'); - // $template->assign_vars(array( 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', 'USERNAME' => $data['username'], @@ -494,7 +492,7 @@ class ucp_register 'L_CONFIRM_EXPLAIN' => sprintf($user->lang['CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'), 'L_REG_COND' => $l_reg_cond, 'L_USERNAME_EXPLAIN' => sprintf($user->lang[$user_char_ary[str_replace('\\\\', '\\', $config['allow_name_chars'])] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), - 'L_PASSWORD_EXPLAIN' => sprintf($user->lang[$pass_char_ary[str_replace('\\\\', '\\', $config['pass_complex'])] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), + 'L_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_TZ_OPTIONS' => tz_select($data['tz']), diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index febd88665f..42c7e101f8 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -320,6 +320,10 @@ $database_update_info = array( 'session_forwarded_for' => array('VCHAR:255', 0), ), ), + 'change_columns' => array( + USERS_TABLE => array( + 'user_options' => array('UINT:11', 895), + ), // Remove the following keys 'drop_keys' => array( ZEBRA_TABLE => array( @@ -558,6 +562,7 @@ if (version_compare($current_version, '3.0.b4', '<=')) set_config('forwarded_for_check', '0'); set_config('ldap_password', ''); set_config('ldap_user', ''); + set_config('fulltext_native_common_thres', '20'); $sql = 'SELECT user_colour FROM ' . USERS_TABLE . ' @@ -580,6 +585,28 @@ if (version_compare($current_version, '3.0.b4', '<=')) break; } + switch ($config['pass_complex']) + { + case '.*': + set_config('pass_complex', 'PASS_TYPE_ANY'); + break; + + case '[a-zA-Z]': + set_config('pass_complex', 'PASS_TYPE_CASE'); + break; + + case '[a-zA-Z0-9]': + set_config('pass_complex', 'PASS_TYPE_ALPHA'); + break; + + case '[a-zA-Z\W]': + set_config('pass_complex', 'PASS_TYPE_SYMBOL'); + break; + } + + $sql = 'UPDATE ' . USERS_TABLE . ' SET user_options = 895 WHERE user_options = 893'; + _sql($sql, $errored, $error_ary); + $no_updates = false; } diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index fe38795ee8..dd3e4af9d2 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -1411,7 +1411,7 @@ CREATE TABLE phpbb_users ( user_allow_viewonline INTEGER DEFAULT 1 NOT NULL, user_allow_viewemail INTEGER DEFAULT 1 NOT NULL, user_allow_massemail INTEGER DEFAULT 1 NOT NULL, - user_options INTEGER DEFAULT 893 NOT NULL, + user_options INTEGER DEFAULT 895 NOT NULL, user_avatar VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL, user_avatar_type INTEGER DEFAULT 0 NOT NULL, user_avatar_width INTEGER DEFAULT 0 NOT NULL, diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 8c00685f68..7f33783072 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -1653,7 +1653,7 @@ CREATE TABLE [phpbb_users] ( [user_allow_viewonline] [int] DEFAULT (1) NOT NULL , [user_allow_viewemail] [int] DEFAULT (1) NOT NULL , [user_allow_massemail] [int] DEFAULT (1) NOT NULL , - [user_options] [int] DEFAULT (893) NOT NULL , + [user_options] [int] DEFAULT (895) NOT NULL , [user_avatar] [varchar] (255) DEFAULT ('') NOT NULL , [user_avatar_type] [int] DEFAULT (0) NOT NULL , [user_avatar_width] [int] DEFAULT (0) NOT NULL , diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index ee3d290c42..7ceacea8b9 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -1013,7 +1013,7 @@ CREATE TABLE phpbb_users ( user_allow_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, user_allow_viewemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, user_allow_massemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_options int(11) UNSIGNED DEFAULT '893' NOT NULL, + user_options int(11) UNSIGNED DEFAULT '895' NOT NULL, user_avatar varchar(255) DEFAULT '' NOT NULL, user_avatar_type tinyint(2) DEFAULT '0' NOT NULL, user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index c203a8a574..a34b478be1 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -1013,7 +1013,7 @@ CREATE TABLE phpbb_users ( user_allow_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, user_allow_viewemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, user_allow_massemail tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, - user_options int(11) UNSIGNED DEFAULT '893' NOT NULL, + user_options int(11) UNSIGNED DEFAULT '895' NOT NULL, user_avatar varchar(255) DEFAULT '' NOT NULL, user_avatar_type tinyint(2) DEFAULT '0' NOT NULL, user_avatar_width smallint(4) UNSIGNED DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index f65d367356..a1d1e129e7 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -1822,7 +1822,7 @@ CREATE TABLE phpbb_users ( user_allow_viewonline number(1) DEFAULT '1' NOT NULL, user_allow_viewemail number(1) DEFAULT '1' NOT NULL, user_allow_massemail number(1) DEFAULT '1' NOT NULL, - user_options number(11) DEFAULT '893' NOT NULL, + user_options number(11) DEFAULT '895' NOT NULL, user_avatar varchar2(255) DEFAULT '' , user_avatar_type number(2) DEFAULT '0' NOT NULL, user_avatar_width number(4) DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index ccd33c4f56..a5a3a4b546 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -1273,7 +1273,7 @@ CREATE TABLE phpbb_users ( user_allow_viewonline INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewonline >= 0), user_allow_viewemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_viewemail >= 0), user_allow_massemail INT2 DEFAULT '1' NOT NULL CHECK (user_allow_massemail >= 0), - user_options INT4 DEFAULT '893' NOT NULL CHECK (user_options >= 0), + user_options INT4 DEFAULT '895' NOT NULL CHECK (user_options >= 0), user_avatar varchar(255) DEFAULT '' NOT NULL, user_avatar_type INT2 DEFAULT '0' NOT NULL, user_avatar_width INT2 DEFAULT '0' NOT NULL CHECK (user_avatar_width >= 0), diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 916a9a12d7..d1bc1ee376 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -90,6 +90,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('forwarded_for_chec INSERT INTO phpbb_config (config_name, config_value) VALUES ('full_folder_action', '2'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_mysql_max_word_len', '254'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_mysql_min_word_len', '4'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_common_thres', '20'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_load_upd', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_max_chars', '14'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('fulltext_native_min_chars', '3'); @@ -164,7 +165,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_name_chars', ' INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_pass_chars', '6'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_search_author_chars', '3'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('override_user_style', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('pass_complex', '.*'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('pass_complex', 'PASS_TYPE_ANY'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_edit_time', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_boxes', '4'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs', '50'); @@ -589,13 +590,20 @@ INSERT INTO phpbb_icons (icons_url, icons_width, icons_height, icons_order, disp # -- wordlist +INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('this', 0); INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('example', 0); INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('post', 0); +INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('your', 0); INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('phpbb', 0); INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('installation', 0); +INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('you', 0); +INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('may', 0); INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('delete', 0); INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('topic', 0); +INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('and', 0); +INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('even', 0); INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('forum', 0); +INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('like', 0); INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('since', 0); INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('everything', 0); INSERT INTO phpbb_search_wordlist (word_text, word_common) VALUES ('seems', 0); @@ -614,8 +622,15 @@ INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES (8, 1, INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES (9, 1, 0); INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES (10, 1, 0); INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES (11, 1, 0); -INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES (12, 1, 1); -INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES (3, 1, 1); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES (12, 1, 0); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES (13, 1, 0); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES (14, 1, 0); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES (15, 1, 0); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES (16, 1, 0); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES (17, 1, 0); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES (18, 1, 0); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES (5, 1, 1); +INSERT INTO phpbb_search_wordmatch (word_id, post_id, title_match) VALUES (19, 1, 1); # -- reasons diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 4d697f3b15..d33f38b35a 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -984,7 +984,7 @@ CREATE TABLE phpbb_users ( user_allow_viewonline INTEGER UNSIGNED NOT NULL DEFAULT '1', user_allow_viewemail INTEGER UNSIGNED NOT NULL DEFAULT '1', user_allow_massemail INTEGER UNSIGNED NOT NULL DEFAULT '1', - user_options INTEGER UNSIGNED NOT NULL DEFAULT '893', + user_options INTEGER UNSIGNED NOT NULL DEFAULT '895', user_avatar varchar(255) NOT NULL DEFAULT '', user_avatar_type tinyint(2) NOT NULL DEFAULT '0', user_avatar_width INTEGER UNSIGNED NOT NULL DEFAULT '0', diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 6270987935..3aee12ad37 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -204,6 +204,7 @@ $lang = array_merge($lang, array( 'REG_LIMIT_EXPLAIN' => 'Number of attempts users can make at the confirmation code before being locked out that session.', 'USERNAME_ALPHA_ONLY' => 'Alphanumeric only', 'USERNAME_ALPHA_SPACERS' => 'Alphanumeric and spacers', + 'USERNAME_ASCII' => 'ASCII (no international unicode)', 'USERNAME_LETTER_NUM' => 'Any letter and number', 'USERNAME_LETTER_NUM_SPACERS' => 'Any letter, number, and spacer', 'USERNAME_CHARS' => 'Limit username chars', diff --git a/phpBB/language/en/acp/search.php b/phpBB/language/en/acp/search.php index 4d6b01cb6c..ffbfc89e10 100644 --- a/phpBB/language/en/acp/search.php +++ b/phpBB/language/en/acp/search.php @@ -34,6 +34,8 @@ $lang = array_merge($lang, array( 'ACP_SEARCH_INDEX_EXPLAIN' => 'Here you can manage the search backend’s indexes. Since you normally use only one backend you should delete all indexes that you do not make use of. After altering some of the search settings (e.g. the number of minimum/maximum chars) it might be worth recreating the index so it reflects those changes.', 'ACP_SEARCH_SETTINGS_EXPLAIN' => 'Here you can define what search backend will be used for indexing posts and performing searches. You can set various options that can influence how much processing these actions require. Some of these settings are the same for all search engine backends.', + 'COMMON_WORD_THRESHOLD' => 'Common word threshold', + 'COMMON_WORD_THRESHOLD_EXPLAIN' => 'Words which are contained in a greater percentage of all posts will be regarded as common. Common words are ignored in search queries. Set to zero to disable. Only takes effect if there are more than 100 posts.', 'CONFIRM_SEARCH_BACKEND' => 'Are you sure you wish to switch to a different search backend? After changing the search backend you will have to create an index for the new search backend. If you don’t plan on switching back to the old search backend you can also delete the old backend’s index in order to free system resources.', 'CONTINUE_DELETING_INDEX' => 'Continue previous index deleting process', 'CONTINUE_DELETING_INDEX_EXPLAIN' => 'An index deleting process has been started. In order to access the search index page again you need to complete it first.', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index b336bca739..f74857091f 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -453,6 +453,7 @@ $lang = array_merge($lang, array( 'UPLOAD_AVATAR_URL_EXPLAIN' => 'Enter the URL of the location containing the image, it will be copied to this site.', 'USERNAME_ALPHA_ONLY_EXPLAIN' => 'Username must be between %1$d and %2$d chars long and use only alphanumeric characters', 'USERNAME_ALPHA_SPACERS_EXPLAIN'=> 'Username must be between %1$d and %2$d chars long and use alphanumeric, space or -+_[] characters.', + 'USERNAME_ASCII_EXPLAIN' => 'Username must be between %1$d and %2$d chars long and use only ASCII characters, so no special symbols', 'USERNAME_LETTER_NUM_EXPLAIN' => 'Username must be between %1$d and %2$d chars long and use only letter or number characters', 'USERNAME_LETTER_NUM_SPACERS_EXPLAIN'=> 'Username must be between %1$d and %2$d chars long and use letter, number, space or -+_[] characters.', 'USERNAME_CHARS_ANY_EXPLAIN' => 'Length must be between %1$d and %2$d characters.', diff --git a/phpBB/search.php b/phpBB/search.php index e86e1bea68..642b54b53e 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -250,13 +250,14 @@ if ($keywords || $author || $author_id || $search_id || $submit) $sort_by_sql = array('a' => 'u.username_clean', 't' => (($show_results == 'posts') ? 'p.post_time' : 't.topic_last_post_time'), 'f' => 'f.forum_id', 'i' => 't.topic_title', 's' => (($show_results == 'posts') ? 'p.post_subject' : 't.topic_title')); // pre-made searches - $sql = $field = ''; + $sql = $field = $l_search_title = ''; if ($search_id) { switch ($search_id) { // Oh holy Bob, bring us some activity... case 'active_topics': + $l_search_title = $user->lang['SEARCH_ACTIVE_TOPICS']; $show_results = 'topics'; $sort_key = 't'; $sort_dir = 'd'; @@ -279,6 +280,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) break; case 'unanswered': + $l_search_title = $user->lang['SEARCH_UNANSWERED']; $show_results = request_var('sr', 'topics'); $show_results = ($show_results == 'posts') ? 'posts' : 'topics'; $sort_by_sql['t'] = ($show_results == 'posts') ? 'p.post_time' : 't.topic_last_post_time'; @@ -331,6 +333,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) break; case 'newposts': + $l_search_title = $user->lang['SEARCH_NEW']; // force sorting $show_results = (request_var('sr', 'topics') == 'posts') ? 'posts' : 'topics'; $sort_key = 't'; @@ -363,6 +366,10 @@ if ($keywords || $author || $author_id || $search_id || $submit) $field = 'topic_id'; } break; + + case 'egosearch': + $l_search_title = $user->lang['SEARCH_SELF']; + break; } } @@ -464,6 +471,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $u_search .= ($return_chars != 200) ? '&ch=' . $return_chars : ''; $template->assign_vars(array( + 'SEARCH_TITLE' => $l_search_title, 'SEARCH_MATCHES' => $l_search_matches, 'SEARCH_WORDS' => preg_replace('#&(\#[0-9]+;)#', '&$1', htmlspecialchars($search->search_query)), 'IGNORED_WORDS' => (sizeof($search->common_words)) ? htmlspecialchars(implode(' ', $search->common_words)) : '', @@ -794,26 +802,23 @@ if ($keywords || $author || $author_id || $search_id || $submit) // Replace naughty words such as farty pants $row['post_subject'] = censor_text($row['post_subject']); - $message = $row['post_text']; - - if ($return_chars != -1 && utf8_strlen($message) >= ($return_chars + 3)) - { - $message = censor_text($message); - - // make list items visible as such - $message = str_replace('[*:' . $row['bbcode_uid'] . ']', '⋅ ', $message); + $message = censor_text($row['post_text']); - // do not display raw bbcode - strip_bbcode($message, $row['bbcode_uid']); + $text_only_message = $message; + // make list items visible as such + $text_only_message = str_replace('[*:' . $row['bbcode_uid'] . ']', '⋅ ', $message); + // no BBCode in text only message + strip_bbcode($text_only_message, $row['bbcode_uid']); + if ($return_chars != -1 && utf8_strlen($text_only_message) >= ($return_chars + 3)) + { // now find context for the searched words - $message = get_context($message, array_filter(explode('|', $hilit), 'strlen'), $return_chars); + $message = get_context($text_only_message, array_filter(explode('|', $hilit), 'strlen'), $return_chars); $message = str_replace("\n", '<br />', $message); } else { - $message = censor_text($message); $message = str_replace("\n", '<br />', $message); // Second parse bbcode here @@ -833,6 +838,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) // Always process smilies after parsing bbcodes $message = smiley_text($message); } + unset($text_only_message); if ($hilit) { @@ -878,7 +884,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } unset($rowset); - page_header($user->lang['SEARCH']); + page_header(($l_search_title) ? $l_search_title : $user->lang['SEARCH']); $template->set_filenames(array( 'body' => 'search_results.html') diff --git a/phpBB/styles/subSilver/template/search_results.html b/phpBB/styles/subSilver/template/search_results.html index ab0764254c..ea880d3642 100644 --- a/phpBB/styles/subSilver/template/search_results.html +++ b/phpBB/styles/subSilver/template/search_results.html @@ -4,7 +4,7 @@ <table width="100%" cellspacing="1"> <tr> - <td colspan="2"><span class="titles">{SEARCH_MATCHES}</span><br /></td> + <td colspan="2"><span class="titles"><!-- IF SEARCH_TITLE -->{SEARCH_TITLE}<!-- ELSE -->{SEARCH_MATCHES}<!-- ENDIF --></span><br /></td> </tr> <tr> <td class="genmed"><!-- IF SEARCH_TOPIC -->{L_SEARCHED_TOPIC}: <a href="{U_SEARCH_TOPIC}"><b>{SEARCH_TOPIC}</b></a><br /><!-- ENDIF --><!-- IF SEARCH_WORDS -->{L_SEARCHED_FOR}: <a href="{U_SEARCH_WORDS}"><b>{SEARCH_WORDS}</b></a><!-- ENDIF --><!-- IF IGNORED_WORDS --> {L_IGNORED_TERMS}: <b>{IGNORED_WORDS}</b><!-- ENDIF --></td> @@ -123,7 +123,8 @@ </form> -<div class="nav" style="float:left"><!-- INCLUDE pagination.html --></div> +<div class="gensmall" style="float:left"><span class="nav">{PAGE_NUMBER}</span> [ {SEARCH_MATCHES} ]</div> +<div class="nav" style="float:right"><!-- INCLUDE pagination.html --></div> <br clear="all" /><br /> |