mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-22 16:40:21 +01:00
Merge branch '3.3.x'
This commit is contained in:
commit
2328063b59
@ -36,6 +36,13 @@
|
||||
<dt><label for="max_num_search_keywords">{L_MAX_NUM_SEARCH_KEYWORDS}{L_COLON}</label><br /><span>{L_MAX_NUM_SEARCH_KEYWORDS_EXPLAIN}</span></dt>
|
||||
<dd><input id="max_num_search_keywords" type="number" min="0" max="9999" name="config[max_num_search_keywords]" value="{MAX_NUM_SEARCH_KEYWORDS}" /></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>
|
||||
<label for="default_search_return_chars">{{ lang('DEFAULT_SEARCH_RETURN_CHARS') ~ lang('COLON') }}</label>
|
||||
<br><span>{{ lang('DEFAULT_SEARCH_RETURN_CHARS_EXPLAIN') }}</span>
|
||||
</dt>
|
||||
<dd><input id="default_search_return_chars" name="config[default_search_return_chars]" type="number" value="{{ DEFAULT_SEARCH_RETURN_CHARS }}" min="0" max="9999"></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="search_store_results">{L_SEARCH_STORE_RESULTS}{L_COLON}</label><br /><span>{L_SEARCH_STORE_RESULTS_EXPLAIN}</span></dt>
|
||||
<dd><input id="search_store_results" type="number" min="0" max="999999" name="config[search_store_results]" value="{SEARCH_STORE_RESULTS}" /> {L_SECONDS}</dd>
|
||||
|
@ -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)
|
||||
|
@ -99,6 +99,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');
|
||||
|
@ -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.',
|
||||
|
@ -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',
|
||||
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v33x;
|
||||
|
||||
class default_search_return_chars extends \phpbb\db\migration\migration
|
||||
{
|
||||
public function effectively_installed()
|
||||
{
|
||||
return $this->config->offsetExists('default_search_return_chars');
|
||||
}
|
||||
|
||||
public static function depends_on()
|
||||
{
|
||||
return [
|
||||
'\phpbb\db\migration\data\v330\v330',
|
||||
];
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return [
|
||||
['config.add', ['default_search_return_chars', 300]],
|
||||
];
|
||||
}
|
||||
}
|
@ -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,16 +1475,27 @@ if (!$s_forums)
|
||||
trigger_error('NO_SEARCH');
|
||||
}
|
||||
|
||||
// Number of chars returned
|
||||
$s_characters = '<option value="-1">' . $user->lang['ALL_AVAILABLE'] . '</option>';
|
||||
$s_characters .= '<option value="0">0</option>';
|
||||
$s_characters .= '<option value="25">25</option>';
|
||||
$s_characters .= '<option value="50">50</option>';
|
||||
/**
|
||||
* Build options for a select list for the number of characters returned.
|
||||
*
|
||||
* If the admin defined amount is not within the predefined range,
|
||||
* and the admin did not set it to unlimited (0), we add that option aswell.
|
||||
*
|
||||
* @deprecated 3.3.1-RC1 Templates should use an numeric input, in favor of a select.
|
||||
*/
|
||||
$s_characters = '<option value="0">' . $language->lang('ALL_AVAILABLE') . '</option>';
|
||||
$i_characters = array_merge([25, 50], range(100, 1000, 100));
|
||||
|
||||
for ($i = 100; $i <= 1000; $i += 100)
|
||||
if ($config['default_search_return_chars'] && !in_array((int) $config['default_search_return_chars'], $i_characters))
|
||||
{
|
||||
$selected = ($i == 300) ? ' selected="selected"' : '';
|
||||
$s_characters .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';
|
||||
$i_characters[] = (int) $config['default_search_return_chars'];
|
||||
sort($i_characters);
|
||||
}
|
||||
|
||||
foreach ($i_characters as $i)
|
||||
{
|
||||
$selected = $i === (int) $config['default_search_return_chars'] ? ' selected="selected"' : '';
|
||||
$s_characters .= sprintf('<option value="%1$s"%2$s>%1$s</option>', $i, $selected);
|
||||
}
|
||||
|
||||
$s_hidden_fields = array('t' => $topic_id);
|
||||
@ -1504,6 +1515,7 @@ 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,
|
||||
|
@ -79,8 +79,11 @@
|
||||
<dd>{S_SELECT_SORT_DAYS}</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label>{L_RETURN_FIRST}{L_COLON}</label></dt>
|
||||
<dd><select name="ch" title="{L_RETURN_FIRST}">{S_CHARACTER_OPTIONS}</select> {L_POST_CHARACTERS}</dd>
|
||||
<dt>
|
||||
<label for="ch">{{ lang('RETURN_FIRST') ~ lang('COLON') }}</label>
|
||||
<br><span>{{ lang('RETURN_FIRST_EXPLAIN') }}</span>
|
||||
</dt>
|
||||
<dd><input id="ch" name="ch" type="number" value="{{ DEFAULT_RETURN_CHARS }}" min="0" max="9999" title="{{ lang('RETURN_FIRST') }}"> {{ lang('POST_CHARACTERS') }}</dd>
|
||||
</dl>
|
||||
<!-- EVENT search_body_search_display_options_append -->
|
||||
</fieldset>
|
||||
|
Loading…
x
Reference in New Issue
Block a user