diff --git a/phpBB/adm/style/acp_search.html b/phpBB/adm/style/acp_search.html index 99620058dc..7fecc0f691 100644 --- a/phpBB/adm/style/acp_search.html +++ b/phpBB/adm/style/acp_search.html @@ -36,6 +36,13 @@

{L_MAX_NUM_SEARCH_KEYWORDS_EXPLAIN}
+
+
+ +
{{ lang('DEFAULT_SEARCH_RETURN_CHARS_EXPLAIN') }} +
+
+

{L_SEARCH_STORE_RESULTS_EXPLAIN}
{L_SECONDS}
diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 538a28a926..e59e06e1cd 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -62,15 +62,16 @@ class acp_search $search_types = $this->get_search_types(); - $settings = array( - 'search_interval' => 'float', - 'search_anonymous_interval' => 'float', - 'load_search' => 'bool', - 'limit_search_load' => 'float', - 'min_search_author_chars' => 'integer', - 'max_num_search_keywords' => 'integer', - 'search_store_results' => 'integer', - ); + $settings = [ + 'search_interval' => 'float', + 'search_anonymous_interval' => 'float', + 'load_search' => 'bool', + 'limit_search_load' => 'float', + 'min_search_author_chars' => 'integer', + 'max_num_search_keywords' => 'integer', + 'default_search_return_chars' => 'integer', + 'search_store_results' => 'integer', + ]; $search = null; $error = false; @@ -219,20 +220,21 @@ class acp_search $this->tpl_name = 'acp_search'; $this->page_title = 'ACP_SEARCH_SETTINGS'; - $template->assign_vars(array( - 'LIMIT_SEARCH_LOAD' => (float) $config['limit_search_load'], - 'MIN_SEARCH_AUTHOR_CHARS' => (int) $config['min_search_author_chars'], - 'SEARCH_INTERVAL' => (float) $config['search_interval'], - 'SEARCH_GUEST_INTERVAL' => (float) $config['search_anonymous_interval'], - 'SEARCH_STORE_RESULTS' => (int) $config['search_store_results'], - 'MAX_NUM_SEARCH_KEYWORDS' => (int) $config['max_num_search_keywords'], + $template->assign_vars([ + 'DEFAULT_SEARCH_RETURN_CHARS' => (int) $config['default_search_return_chars'], + 'LIMIT_SEARCH_LOAD' => (float) $config['limit_search_load'], + 'MIN_SEARCH_AUTHOR_CHARS' => (int) $config['min_search_author_chars'], + 'SEARCH_INTERVAL' => (float) $config['search_interval'], + 'SEARCH_GUEST_INTERVAL' => (float) $config['search_anonymous_interval'], + 'SEARCH_STORE_RESULTS' => (int) $config['search_store_results'], + 'MAX_NUM_SEARCH_KEYWORDS' => (int) $config['max_num_search_keywords'], 'S_SEARCH_TYPES' => $search_options, 'S_YES_SEARCH' => (bool) $config['load_search'], 'S_SETTINGS' => true, - 'U_ACTION' => $this->u_action . '&hash=' . generate_link_hash('acp_search')) - ); + 'U_ACTION' => $this->u_action . '&hash=' . generate_link_hash('acp_search'), + ]); } function index($id, $mode) diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index ef61bb4daf..3e70231873 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -100,6 +100,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_subje INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_order', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('edit_time', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('extension_force_unstable', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_search_return_chars', '300'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('delete_time', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_check_mx', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable', '1'); diff --git a/phpBB/language/en/acp/search.php b/phpBB/language/en/acp/search.php index 443dbb7fb7..a79c67fd8e 100644 --- a/phpBB/language/en/acp/search.php +++ b/phpBB/language/en/acp/search.php @@ -49,6 +49,8 @@ $lang = array_merge($lang, array( 'CONTINUE_INDEXING_EXPLAIN' => 'An indexing process has been started. In order to access the search index page you will have to complete it or cancel it.', 'CREATE_INDEX' => 'Create index', + 'DEFAULT_SEARCH_RETURN_CHARS' => 'Default number of returned characters', + 'DEFAULT_SEARCH_RETURN_CHARS_EXPLAIN' => 'The default number of characters that will be returned while searching. A value of 0 will return the entire post.', 'DELETE_INDEX' => 'Delete index', 'DELETING_INDEX_IN_PROGRESS' => 'Deleting the index in progress', 'DELETING_INDEX_IN_PROGRESS_EXPLAIN' => 'The search backend is currently cleaning its index. This can take a few minutes.', diff --git a/phpBB/language/en/search.php b/phpBB/language/en/search.php index 13e5bf7a97..f89107ed1b 100644 --- a/phpBB/language/en/search.php +++ b/phpBB/language/en/search.php @@ -87,6 +87,7 @@ $lang = array_merge($lang, array( 'RESULT_DAYS' => 'Limit results to previous', 'RESULT_SORT' => 'Sort results by', 'RETURN_FIRST' => 'Return first', + 'RETURN_FIRST_EXPLAIN' => 'Set to 0 to display the entire post.', 'GO_TO_SEARCH_ADV' => 'Go to advanced search', 'SEARCHED_FOR' => 'Search term used', diff --git a/phpBB/search.php b/phpBB/search.php index 5d5e9f5f8a..f1bae7f276 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -47,7 +47,7 @@ $sort_days = $request->variable('st', 0); $sort_key = $request->variable('sk', 't'); $sort_dir = $request->variable('sd', 'd'); -$return_chars = $request->variable('ch', ($topic_id) ? -1 : 300); +$return_chars = $request->variable('ch', $topic_id ? 0 : (int) $config['default_search_return_chars']); $search_forum = $request->variable('fid', array(0)); // We put login boxes for the case if search_id is newposts, egosearch or unreadposts @@ -692,7 +692,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $u_search .= ($u_search_forum) ? '&fid%5B%5D=' . $u_search_forum : ''; $u_search .= (!$search_child) ? '&sc=0' : ''; $u_search .= ($search_fields != 'all') ? '&sf=' . $search_fields : ''; - $u_search .= ($return_chars != 300) ? '&ch=' . $return_chars : ''; + $u_search .= $return_chars !== (int) $config['default_search_return_chars'] ? '&ch=' . $return_chars : ''; /** * Event to add or modify search URL parameters @@ -975,7 +975,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) strip_bbcode($text_only_message, $row['bbcode_uid']); } - if ($return_chars == -1 || utf8_strlen($text_only_message) < ($return_chars + 3)) + if ($return_chars === 0 || utf8_strlen($text_only_message) < ($return_chars + 3)) { $row['display_text_only'] = false; @@ -1475,18 +1475,6 @@ if (!$s_forums) trigger_error('NO_SEARCH'); } -// Number of chars returned -$s_characters = ''; -$s_characters .= ''; -$s_characters .= ''; -$s_characters .= ''; - -for ($i = 100; $i <= 1000; $i += 100) -{ - $selected = ($i == 300) ? ' selected="selected"' : ''; - $s_characters .= ''; -} - $s_hidden_fields = array('t' => $topic_id); if ($_SID) @@ -1504,9 +1492,9 @@ if (!empty($_EXTRA_URL)) } $template->assign_vars(array( + 'DEFAULT_RETURN_CHARS' => (int) $config['default_search_return_chars'], 'S_SEARCH_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", false, true, 0), // We force no ?sid= appending by using 0 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), - 'S_CHARACTER_OPTIONS' => $s_characters, 'S_FORUM_OPTIONS' => $s_forums, 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, diff --git a/phpBB/styles/prosilver/template/search_body.html b/phpBB/styles/prosilver/template/search_body.html index 618e2680ba..2f667a3349 100644 --- a/phpBB/styles/prosilver/template/search_body.html +++ b/phpBB/styles/prosilver/template/search_body.html @@ -79,8 +79,11 @@
{S_SELECT_SORT_DAYS}
-
-
{L_POST_CHARACTERS}
+
+ +
{{ lang('RETURN_FIRST_EXPLAIN') }} +
+
{{ lang('POST_CHARACTERS') }}