Line 47 | Line 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 337 | Line 337 |
---|
}
// define some variables needed for retrieving post_id/topic_id information
|
}
// define some variables needed for retrieving post_id/topic_id information
|
$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'));
| $sort_by_sql = [ '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') ];
|
/** * Event to modify the SQL parameters before pre-made searches
| /** * Event to modify the SQL parameters before pre-made searches
|
Line 403 | Line 409 |
---|
$sql_sort = 'ORDER BY ' . $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC');
$sort_join = ($sort_key == 'f') ? FORUMS_TABLE . ' f, ' : '';
|
$sql_sort = 'ORDER BY ' . $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC');
$sort_join = ($sort_key == 'f') ? FORUMS_TABLE . ' f, ' : '';
|
$sql_sort = ($sort_key == 'f') ? ' AND f.forum_id = p.forum_id ' . $sql_sort : $sql_sort;
| $sql_sort = ($sort_key == 'f') ? ' AND f.forum_id = t.forum_id ' . $sql_sort : $sql_sort;
|
if ($sort_days) {
|
if ($sort_days) {
|
$last_post_time = 'AND p.post_time > ' . (time() - ($sort_days * 24 * 3600));
| $last_post_time = 'AND ' . ($show_results == 'posts' ? 'p.post_time' : 't.topic_last_post_time') . ' > ' . (time() - ($sort_days * 24 * 3600));
|
} else {
| } else {
|
Line 417 | Line 423 |
---|
if ($sort_key == 'a') { $sort_join = USERS_TABLE . ' u, ';
|
if ($sort_key == 'a') { $sort_join = USERS_TABLE . ' u, ';
|
$sql_sort = ' AND u.user_id = p.poster_id ' . $sql_sort;
| $sql_sort = ' AND u.user_id = ' . ($show_results == 'posts' ? 'p.poster_id ' : 't.topic_last_poster_id ') . $sql_sort;
|
} if ($show_results == 'posts') {
| } if ($show_results == 'posts') {
|
Line 433 | Line 439 |
---|
} else {
|
} else {
|
$sql = 'SELECT DISTINCT ' . $sort_by_sql[$sort_key] . ", p.topic_id FROM $sort_join" . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t
| $sql = 'SELECT DISTINCT ' . $sort_by_sql[$sort_key] . ", t.topic_id FROM $sort_join" . TOPICS_TABLE . " t
|
WHERE t.topic_posts_approved = 1 AND t.topic_moved_id = 0
|
WHERE t.topic_posts_approved = 1 AND t.topic_moved_id = 0
|
AND p.topic_id = t.topic_id
| |
$last_post_time AND $m_approve_topics_fid_sql
|
$last_post_time AND $m_approve_topics_fid_sql
|
" . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . "
| " . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . "
|
$sql_sort"; $field = 'topic_id'; }
| $sql_sort"; $field = 'topic_id'; }
|
Line 678 | Line 683 |
---|
$hilit = phpbb_clean_search_string(str_replace(array('+', '-', '|', '(', ')', '"'), ' ', $keywords)); $hilit = str_replace(' ', '|', $hilit);
|
$hilit = phpbb_clean_search_string(str_replace(array('+', '-', '|', '(', ')', '"'), ' ', $keywords)); $hilit = str_replace(' ', '|', $hilit);
|
$u_hilit = urlencode(htmlspecialchars_decode(str_replace('|', ' ', $hilit)));
| $u_hilit = urlencode(html_entity_decode(str_replace('|', ' ', $hilit), ENT_COMPAT));
|
$u_show_results = '&sr=' . $show_results; $u_search_forum = implode('&fid%5B%5D=', $search_forum);
$u_search = append_sid("{$phpbb_root_path}search.$phpEx", $u_sort_param . $u_show_results); $u_search .= ($search_id) ? '&search_id=' . $search_id : '';
|
$u_show_results = '&sr=' . $show_results; $u_search_forum = implode('&fid%5B%5D=', $search_forum);
$u_search = append_sid("{$phpbb_root_path}search.$phpEx", $u_sort_param . $u_show_results); $u_search .= ($search_id) ? '&search_id=' . $search_id : '';
|
$u_search .= ($u_hilit) ? '&keywords=' . urlencode(htmlspecialchars_decode($keywords)) : '';
| $u_search .= ($u_hilit) ? '&keywords=' . urlencode(html_entity_decode($keywords, ENT_COMPAT)) : '';
|
$u_search .= ($search_terms != 'all') ? '&terms=' . $search_terms : ''; $u_search .= ($topic_id) ? '&t=' . $topic_id : '';
|
$u_search .= ($search_terms != 'all') ? '&terms=' . $search_terms : ''; $u_search .= ($topic_id) ? '&t=' . $topic_id : '';
|
$u_search .= ($author) ? '&author=' . urlencode(htmlspecialchars_decode($author)) : '';
| $u_search .= ($author) ? '&author=' . urlencode(html_entity_decode($author, ENT_COMPAT)) : '';
|
$u_search .= ($author_id) ? '&author_id=' . $author_id : ''; $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 .= ($author_id) ? '&author_id=' . $author_id : ''; $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 975 | Line 980 |
---|
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 1076 | Line 1081 |
---|
$topic_title = censor_text($row['topic_title']); $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1;
|
$topic_title = censor_text($row['topic_title']); $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1;
|
$view_topic_url_params = "f=$forum_id&t=$result_topic_id" . (($u_hilit) ? "&hilit=$u_hilit" : '');
| $view_topic_url_params = "t=$result_topic_id" . (($u_hilit) ? "&hilit=$u_hilit" : '');
|
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
$folder_img = $folder_alt = $u_mcp_queue = '';
| $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
$folder_img = $folder_alt = $u_mcp_queue = '';
|
Line 1139 | Line 1144 |
---|
'S_TOPIC_DELETED' => $topic_deleted, 'S_HAS_POLL' => ($row['poll_start']) ? true : false,
|
'S_TOPIC_DELETED' => $topic_deleted, 'S_HAS_POLL' => ($row['poll_start']) ? true : false,
|
'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
| 'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
|
'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread',
| 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread',
|
Line 1214 | Line 1219 |
---|
'U_VIEW_TOPIC' => $view_topic_url, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
|
'U_VIEW_TOPIC' => $view_topic_url, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
|
'U_VIEW_POST' => (!empty($row['post_id'])) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=" . $row['topic_id'] . '&p=' . $row['post_id'] . (($u_hilit) ? '&hilit=' . $u_hilit : '')) . '#p' . $row['post_id'] : '',
| 'U_VIEW_POST' => (!empty($row['post_id'])) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id'] . (($u_hilit) ? '&hilit=' . $u_hilit : '')) . '#p' . $row['post_id'] : '',
|
));
/**
| ));
/**
|
Line 1475 | Line 1480 |
---|
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 1504 | Line 1520 |
---|
}
$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,
|
Line 1552 | Line 1569 |
---|
'KEYWORDS' => $keywords, 'TIME' => $user->format_date($row['search_time']),
|
'KEYWORDS' => $keywords, 'TIME' => $user->format_date($row['search_time']),
|
'U_KEYWORDS' => append_sid("{$phpbb_root_path}search.$phpEx", 'keywords=' . urlencode(htmlspecialchars_decode($keywords)))
| 'U_KEYWORDS' => append_sid("{$phpbb_root_path}search.$phpEx", 'keywords=' . urlencode(html_entity_decode($keywords, ENT_COMPAT)))
|
)); } $db->sql_freeresult($result);
| )); } $db->sql_freeresult($result);
|