phpBB

Code Changes

File: search.php

  Unmodified   Added   Modified   Removed
Line 47Line 47
$sort_key		= $request->variable('sk', 't');
$sort_dir = $request->variable('sd', 'd');


$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

$search_forum	= $request->variable('fid', array(0));

// We put login boxes for the case if search_id is newposts, egosearch or unreadposts

Line 692Line 692
	$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 .= ($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


/**
* Event to add or modify search URL parameters

Line 975Line 975
					strip_bbcode($text_only_message, $row['bbcode_uid']);
}


					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;


				{
$row['display_text_only'] = false;


Line 1475Line 1475
	trigger_error('NO_SEARCH');
}


	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));

if ($config['default_search_return_chars'] && !in_array((int) $config['default_search_return_chars'], $i_characters))
{
$i_characters[] = (int) $config['default_search_return_chars'];
sort($i_characters);
}





for ($i = 100; $i <= 1000; $i += 100)

foreach ($i_characters as $i)

{

{

	$selected = ($i == 300) ? ' selected="selected"' : '';
$s_characters .= '<option value="' . $i . '"' . $selected . '>' . $i . '</option>';

	$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);

}

$s_hidden_fields = array('t' => $topic_id);

Line 1504Line 1515
}

$template->assign_vars(array(

}

$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_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,