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), ENT_COMPAT));
| $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, ENT_COMPAT)) : '';
| $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, ENT_COMPAT)) : '';
| $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 .= ($author_id) ? '&author_id=' . $author_id : ''; $u_search .= ($u_search_forum) ? '&fid%5B%5D=' . $u_search_forum : ''; $u_search .= (!$search_child) ? '&sc=0' : '';
|
Line 1564 | 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, ENT_COMPAT)))
| '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);
|