From 830c3f4047d0718ed398c38d4640cc0f1fe77a7f Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 3 Sep 2011 23:50:00 +0300 Subject: [feature/remove-imagesets] Adjustments to php files Removing imagesets. Adjustments to php files PHPBB3-10336 --- phpBB/search.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 4b1527b7e7..1d35dfb062 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -872,10 +872,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'TOPIC_IMG_STYLE' => $folder_img, 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), - 'TOPIC_FOLDER_IMG_SRC' => $user->img($folder_img, $folder_alt, false, '', 'src'), 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], - 'TOPIC_FOLDER_IMG_WIDTH'=> $user->img($folder_img, '', false, '', 'width'), - 'TOPIC_FOLDER_IMG_HEIGHT' => $user->img($folder_img, '', false, '', 'height'), 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', -- cgit v1.2.1 From dcc5ca53778184f0719b9ac0c221688ad03bd57e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 15 Aug 2011 20:00:47 -0400 Subject: [feature/extension-manager] Make search backends loadable from extensions Search backends are now required to be autoloadable. The database updater to 3.1 tries to guess the class name as phpbb_search_ which works for the default backends we ship. PHPBB3-10323 --- phpBB/search.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 1d35dfb062..c6189051a3 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -73,7 +73,7 @@ switch ($search_id) login_box('', $user->lang['LOGIN_EXPLAIN_UNREADSEARCH']); } break; - + // The "new posts" search uses user_lastvisit which is user based, so it should require user to log in. case 'newposts': if ($user->data['user_id'] == ANONYMOUS) @@ -81,7 +81,7 @@ switch ($search_id) login_box('', $user->lang['LOGIN_EXPLAIN_NEWPOSTS']); } break; - + default: // There's nothing to do here for now ;) break; @@ -273,15 +273,12 @@ if ($keywords || $author || $author_id || $search_id || $submit) } // Select which method we'll use to obtain the post_id or topic_id information - $search_type = basename($config['search_type']); + $search_type = $config['search_type']; - if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + if (!class_exists($search_type)) { trigger_error('NO_SUCH_SEARCH_MODULE'); } - - require("{$phpbb_root_path}includes/search/$search_type.$phpEx"); - // We do some additional checks in the module to ensure it can actually be utilised $error = false; $search = new $search_type($error); -- cgit v1.2.1 From 88ae40a4b19360645d5e5a614cc378e7cce4afe3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 14 Sep 2011 00:28:52 +0200 Subject: [ticket/10345] Make use of the plural function in some basic places PHPBB3-10345 --- phpBB/search.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index c6189051a3..6626cd5672 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -136,7 +136,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) { if ((strpos($author, '*') !== false) && (utf8_strlen(str_replace(array('*', '%'), '', $author)) < $config['min_search_author_chars'])) { - trigger_error(sprintf($user->lang['TOO_FEW_AUTHOR_CHARS'], $config['min_search_author_chars'])); + trigger_error($user->lang('TOO_FEW_AUTHOR_CHARS', (int) $config['min_search_author_chars'])); } $sql_where = (strpos($author, '*') !== false) ? ' username_clean ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($author))) : " username_clean = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; @@ -544,11 +544,11 @@ if ($keywords || $author || $author_id || $search_id || $submit) { // limit the number to 1000 for pre-made searches $total_match_count--; - $l_search_matches = sprintf($user->lang['FOUND_MORE_SEARCH_MATCHES'], $total_match_count); + $l_search_matches = $user->lang('FOUND_MORE_SEARCH_MATCHES', (int) $total_match_count); } else { - $l_search_matches = ($total_match_count == 1) ? sprintf($user->lang['FOUND_SEARCH_MATCH'], $total_match_count) : sprintf($user->lang['FOUND_SEARCH_MATCHES'], $total_match_count); + $l_search_matches = $user->lang('FOUND_SEARCH_MATCHES', (int) $total_match_count); } // define some vars for urls -- cgit v1.2.1 From 179662e949967090724c5e14ea4d4d399886a38a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 20 Sep 2011 01:33:33 +0200 Subject: [ticket/10345] Use the plural function in some more places. I added two function avatar_explanation_string() and avatar_error_wrong_size() for easier handling of the "pixels"-languages, as they are used quite often. PHPBB3-10345 --- phpBB/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 6626cd5672..4089397b6e 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -295,7 +295,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) if (!$correct_query || (empty($search->search_query) && !sizeof($author_id_ary) && !$search_id)) { $ignored = (sizeof($search->common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $search->common_words)) . '
' : ''; - trigger_error($ignored . sprintf($user->lang['NO_KEYWORDS'], $search->word_length['min'], $search->word_length['max'])); + trigger_error($ignored . $user->lang('NO_KEYWORDS', $user->lang('CHARACTERS', (int) $search->word_length['min']), $user->lang('CHARACTERS', (int) $search->word_length['max']))); } } -- cgit v1.2.1 From 7a04c9048c110f0bd21ea3e9e869e17b408d640e Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 31 Dec 2011 13:32:52 +0000 Subject: [ticket/9916] Updating header license and removing Version $Id$ PHPBB3-9916 --- phpBB/search.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 4089397b6e..4f30cdc1dd 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -2,9 +2,8 @@ /** * * @package phpBB3 -* @version $Id$ * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -- cgit v1.2.1 From c9733ad7195995a9f28ecbbc8aa3e94a05527114 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 18 Dec 2011 16:28:35 +0800 Subject: [ticket/10532] Fix $start out of range for pre-made searches PHPBB3-10532 --- phpBB/search.php | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 2aa61401cf..07be438ab4 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -471,26 +471,33 @@ if ($keywords || $author || $author_id || $search_id || $submit) if ($search_id) { - if ($sql) + if ($sql || $search_id == 'unreadposts') { - // only return up to 1000 ids (the last one will be removed later) - $result = $db->sql_query_limit($sql, 1001 - $start, $start); + if ($sql) + { + // only return up to 1000 ids (the last one will be removed later) + $result = $db->sql_query_limit($sql, 1001); - while ($row = $db->sql_fetchrow($result)) + while ($row = $db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $db->sql_freeresult($result); + } + else if ($search_id == 'unreadposts') { - $id_ary[] = (int) $row[$field]; + $id_ary = array_keys(get_unread_topics($user->data['user_id'], $sql_where, $sql_sort, 1001)); } - $db->sql_freeresult($result); - $total_match_count = sizeof($id_ary) + $start; - $id_ary = array_slice($id_ary, 0, $per_page); - } - else if ($search_id == 'unreadposts') - { - $id_ary = array_keys(get_unread_topics($user->data['user_id'], $sql_where, $sql_sort, 1001 - $start, $start)); - - $total_match_count = sizeof($id_ary) + $start; - $id_ary = array_slice($id_ary, 0, $per_page); + if ($total_match_count = sizeof($id_ary)) + { + // Make sure $start is set to the last page if it exceeds the amount + if ($start < 0 || $start >= $total_match_count) + { + $start = ($start < 0) ? 0 : floor(($total_match_count - 1) / $per_page) * $per_page; + } + $id_ary = array_slice($id_ary, $start, $per_page); + } } else { -- cgit v1.2.1 From cb7bb31129a38cbdbeb682e869e51b1199b43bfb Mon Sep 17 00:00:00 2001 From: rxu Date: Sat, 14 Jan 2012 15:50:47 +0800 Subject: [ticket/10532] Adjust total match count and limit Set a variable for the limit of total matches count. Adjust total match count to limit to provide proper $start value calculation. Adjust $start value if no matches were found. PHPBB3-10532 --- phpBB/search.php | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 07be438ab4..3956478371 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -469,14 +469,18 @@ if ($keywords || $author || $author_id || $search_id || $submit) $per_page = ($show_results == 'posts') ? $config['posts_per_page'] : $config['topics_per_page']; $total_match_count = 0; + // Set limit for the $total_match_count to reduce server load + $total_matches_limit = 1000; + $found_more_search_matches = false; + if ($search_id) { if ($sql || $search_id == 'unreadposts') { if ($sql) { - // only return up to 1000 ids (the last one will be removed later) - $result = $db->sql_query_limit($sql, 1001); + // Only return up to $total_matches_limit+1 ids (the last one will be removed later) + $result = $db->sql_query_limit($sql, ($total_matches_limit + 1)); while ($row = $db->sql_fetchrow($result)) { @@ -486,11 +490,19 @@ if ($keywords || $author || $author_id || $search_id || $submit) } else if ($search_id == 'unreadposts') { - $id_ary = array_keys(get_unread_topics($user->data['user_id'], $sql_where, $sql_sort, 1001)); + // Only return up to $total_matches_limit+1 ids (the last one will be removed later) + $id_ary = array_keys(get_unread_topics($user->data['user_id'], $sql_where, $sql_sort, ($total_matches_limit + 1))); } if ($total_match_count = sizeof($id_ary)) { + // Limit the number to $total_matches_limit for pre-made searches + if ($total_match_count > $total_matches_limit) + { + $found_more_search_matches = true; + $total_match_count = $total_matches_limit; + } + // Make sure $start is set to the last page if it exceeds the amount if ($start < 0 || $start >= $total_match_count) { @@ -498,6 +510,11 @@ if ($keywords || $author || $author_id || $search_id || $submit) } $id_ary = array_slice($id_ary, $start, $per_page); } + else + { + // Set $start to 0 if no matches were found + $start = 0; + } } else { @@ -550,10 +567,8 @@ if ($keywords || $author || $author_id || $search_id || $submit) $icons = $cache->obtain_icons(); // Output header - if ($search_id && ($total_match_count > 1000)) + if ($found_more_search_matches) { - // limit the number to 1000 for pre-made searches - $total_match_count--; $l_search_matches = sprintf($user->lang['FOUND_MORE_SEARCH_MATCHES'], $total_match_count); } else -- cgit v1.2.1 From 8f3fba885859e00646531632558d75b609ecf813 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 26 Feb 2012 01:58:17 +0100 Subject: [ticket/10532] Put $total_match_count assignment onto its own line. PHPBB3-10532 --- phpBB/search.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 3956478371..87e40832a5 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -494,7 +494,8 @@ if ($keywords || $author || $author_id || $search_id || $submit) $id_ary = array_keys(get_unread_topics($user->data['user_id'], $sql_where, $sql_sort, ($total_matches_limit + 1))); } - if ($total_match_count = sizeof($id_ary)) + $total_match_count = sizeof($id_ary); + if ($total_match_count) { // Limit the number to $total_matches_limit for pre-made searches if ($total_match_count > $total_matches_limit) -- cgit v1.2.1 From 459e8dc09522d8e54ce82182a99ebddf2362a737 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 26 Feb 2012 02:15:39 +0100 Subject: [ticket/10532] Get rid of inline calculation of $start, remove duplicated check PHPBB3-10532 --- phpBB/search.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 87e40832a5..3006c0e5d9 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -505,10 +505,15 @@ if ($keywords || $author || $author_id || $search_id || $submit) } // Make sure $start is set to the last page if it exceeds the amount - if ($start < 0 || $start >= $total_match_count) + if ($start < 0) { - $start = ($start < 0) ? 0 : floor(($total_match_count - 1) / $per_page) * $per_page; + $start = 0; } + else if ($start >= $total_match_count) + { + $start = floor(($total_match_count - 1) / $per_page) * $per_page; + } + $id_ary = array_slice($id_ary, $start, $per_page); } else -- cgit v1.2.1 From 6548a3094f2981a19ff001e67596befab4159ecd Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 26 Feb 2012 02:19:12 +0100 Subject: [ticket/10532] Remove one unnecessary level of if block nesting. PHPBB3-10532 --- phpBB/search.php | 71 +++++++++++++++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 37 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 3006c0e5d9..d89bc79225 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -475,56 +475,53 @@ if ($keywords || $author || $author_id || $search_id || $submit) if ($search_id) { - if ($sql || $search_id == 'unreadposts') + if ($sql) { - if ($sql) - { - // Only return up to $total_matches_limit+1 ids (the last one will be removed later) - $result = $db->sql_query_limit($sql, ($total_matches_limit + 1)); + // Only return up to $total_matches_limit+1 ids (the last one will be removed later) + $result = $db->sql_query_limit($sql, ($total_matches_limit + 1)); - while ($row = $db->sql_fetchrow($result)) - { - $id_ary[] = (int) $row[$field]; - } - $db->sql_freeresult($result); - } - else if ($search_id == 'unreadposts') + while ($row = $db->sql_fetchrow($result)) { - // Only return up to $total_matches_limit+1 ids (the last one will be removed later) - $id_ary = array_keys(get_unread_topics($user->data['user_id'], $sql_where, $sql_sort, ($total_matches_limit + 1))); + $id_ary[] = (int) $row[$field]; } + $db->sql_freeresult($result); + } + else if ($search_id == 'unreadposts') + { + // Only return up to $total_matches_limit+1 ids (the last one will be removed later) + $id_ary = array_keys(get_unread_topics($user->data['user_id'], $sql_where, $sql_sort, ($total_matches_limit + 1))); + } + else + { + $search_id = ''; + } - $total_match_count = sizeof($id_ary); - if ($total_match_count) + $total_match_count = sizeof($id_ary); + if ($total_match_count) + { + // Limit the number to $total_matches_limit for pre-made searches + if ($total_match_count > $total_matches_limit) { - // Limit the number to $total_matches_limit for pre-made searches - if ($total_match_count > $total_matches_limit) - { - $found_more_search_matches = true; - $total_match_count = $total_matches_limit; - } - - // Make sure $start is set to the last page if it exceeds the amount - if ($start < 0) - { - $start = 0; - } - else if ($start >= $total_match_count) - { - $start = floor(($total_match_count - 1) / $per_page) * $per_page; - } - - $id_ary = array_slice($id_ary, $start, $per_page); + $found_more_search_matches = true; + $total_match_count = $total_matches_limit; } - else + + // Make sure $start is set to the last page if it exceeds the amount + if ($start < 0) { - // Set $start to 0 if no matches were found $start = 0; } + else if ($start >= $total_match_count) + { + $start = floor(($total_match_count - 1) / $per_page) * $per_page; + } + + $id_ary = array_slice($id_ary, $start, $per_page); } else { - $search_id = ''; + // Set $start to 0 if no matches were found + $start = 0; } } -- cgit v1.2.1 From 7a061cfc6ea52f86d623e496d7355413739b6254 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 26 Feb 2012 02:29:49 +0100 Subject: [ticket/10532] Remove unnecessary parentheses around calculations of addition. PHPBB3-10532 --- phpBB/search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index d89bc79225..8cb2020630 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -478,7 +478,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) if ($sql) { // Only return up to $total_matches_limit+1 ids (the last one will be removed later) - $result = $db->sql_query_limit($sql, ($total_matches_limit + 1)); + $result = $db->sql_query_limit($sql, $total_matches_limit + 1); while ($row = $db->sql_fetchrow($result)) { @@ -489,7 +489,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) else if ($search_id == 'unreadposts') { // Only return up to $total_matches_limit+1 ids (the last one will be removed later) - $id_ary = array_keys(get_unread_topics($user->data['user_id'], $sql_where, $sql_sort, ($total_matches_limit + 1))); + $id_ary = array_keys(get_unread_topics($user->data['user_id'], $sql_where, $sql_sort, $total_matches_limit + 1)); } else { -- cgit v1.2.1 From 19d76f76dcd19e2bd44fbe7a384533bae4cb1538 Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Sun, 1 Jul 2012 12:45:18 +0530 Subject: [feature/postgresql-fulltext-search] remove phrase search code Unused Code for phrase search removed as pgsql doesnt support it. An added message is displayed if user tries to perform exact phrase search. PHPBB3-9730 --- phpBB/search.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 2b463aec9c..0d13644b02 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -596,6 +596,13 @@ if ($keywords || $author || $author_id || $search_id || $submit) $u_search .= ($search_fields != 'all') ? '&sf=' . $search_fields : ''; $u_search .= ($return_chars != 300) ? '&ch=' . $return_chars : ''; + //check if search backend supports phrase search or not + $l_phrase_search_disabled = ''; + if (strpos(html_entity_decode($keywords), '"') !== false && isset($search->phrase_search)) + { + $l_phrase_search_disabled = $search->phrase_search ? false : true; + } + $template->assign_vars(array( 'SEARCH_TITLE' => $l_search_title, 'SEARCH_MATCHES' => $l_search_matches, @@ -603,6 +610,9 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'IGNORED_WORDS' => (sizeof($search->common_words)) ? implode(' ', $search->common_words) : '', 'PAGINATION' => generate_pagination($u_search, $total_match_count, $per_page, $start), 'PAGE_NUMBER' => on_page($total_match_count, $per_page, $start), + + 'PHRASE_SEARCH_DISABLED' => $l_phrase_search_disabled, + 'TOTAL_MATCHES' => $total_match_count, 'SEARCH_IN_RESULTS' => ($search_id) ? false : true, -- cgit v1.2.1 From bc699f66cf8c4f043f3b62da5e50c3acf198084e Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Tue, 26 Jun 2012 01:27:14 +0530 Subject: [feature/postgresql-fulltext-search] fix formatting adds proper spaces after control keywords and comment symbol PHPBB3-9730 --- phpBB/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 0d13644b02..0187995f75 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -596,7 +596,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $u_search .= ($search_fields != 'all') ? '&sf=' . $search_fields : ''; $u_search .= ($return_chars != 300) ? '&ch=' . $return_chars : ''; - //check if search backend supports phrase search or not + // Check if search backend supports phrase search or not $l_phrase_search_disabled = ''; if (strpos(html_entity_decode($keywords), '"') !== false && isset($search->phrase_search)) { -- cgit v1.2.1 From 7a2d36a25eead0a836b7c79ec675a417a2ff5ea6 Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Thu, 28 Jun 2012 19:07:24 +0530 Subject: [feature/postgresql-fulltext-search] use proper variable name PHPBB3-9730 --- phpBB/search.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 0187995f75..c93dbdfd34 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -597,10 +597,10 @@ if ($keywords || $author || $author_id || $search_id || $submit) $u_search .= ($return_chars != 300) ? '&ch=' . $return_chars : ''; // Check if search backend supports phrase search or not - $l_phrase_search_disabled = ''; + $phrase_search_disabled = ''; if (strpos(html_entity_decode($keywords), '"') !== false && isset($search->phrase_search)) { - $l_phrase_search_disabled = $search->phrase_search ? false : true; + $phrase_search_disabled = $search->phrase_search ? false : true; } $template->assign_vars(array( @@ -611,7 +611,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'PAGINATION' => generate_pagination($u_search, $total_match_count, $per_page, $start), 'PAGE_NUMBER' => on_page($total_match_count, $per_page, $start), - 'PHRASE_SEARCH_DISABLED' => $l_phrase_search_disabled, + 'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled, 'TOTAL_MATCHES' => $total_match_count, 'SEARCH_IN_RESULTS' => ($search_id) ? false : true, -- cgit v1.2.1 From 70a0caee28559bd1bd52b4ecf9d7d33acd732fe2 Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Tue, 3 Jul 2012 03:54:01 +0530 Subject: [feature/postgresql-fulltext-search] supports_phrase_search function function to return the value of the the private property phrase_search PHPBB3-9730 --- phpBB/search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index c93dbdfd34..1123d7c5b9 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -598,9 +598,9 @@ if ($keywords || $author || $author_id || $search_id || $submit) // Check if search backend supports phrase search or not $phrase_search_disabled = ''; - if (strpos(html_entity_decode($keywords), '"') !== false && isset($search->phrase_search)) + if (strpos(html_entity_decode($keywords), '"') !== false && method_exists($search, 'supports_phrase_search')) { - $phrase_search_disabled = $search->phrase_search ? false : true; + $phrase_search_disabled = $search->supports_phrase_search() ? false : true; } $template->assign_vars(array( -- cgit v1.2.1 From 615f32cd712b6c2b63021c5be38dbe3d1247ca0e Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Wed, 20 Jun 2012 11:14:16 +0530 Subject: [ticket/10943] use keywords variable to display in search box $keywords which contains the string as entered by the user should be used to display in search box instead of search_query. PHPBB3-10943 --- phpBB/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 2b463aec9c..e7b47afc2a 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -599,7 +599,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $template->assign_vars(array( 'SEARCH_TITLE' => $l_search_title, 'SEARCH_MATCHES' => $l_search_matches, - 'SEARCH_WORDS' => $search->search_query, + 'SEARCH_WORDS' => $keywords, 'IGNORED_WORDS' => (sizeof($search->common_words)) ? implode(' ', $search->common_words) : '', 'PAGINATION' => generate_pagination($u_search, $total_match_count, $per_page, $start), 'PAGE_NUMBER' => on_page($total_match_count, $per_page, $start), -- cgit v1.2.1 From b98be2f23543a25b74dc8442338d0db4fcc3403b Mon Sep 17 00:00:00 2001 From: Dhruv Goel Date: Fri, 22 Jun 2012 15:16:13 +0530 Subject: [ticket/10943] displays searched query in search result Search backend displays an additional normalized search query just above the ignored words. PHPBB3-10943 --- phpBB/search.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index e7b47afc2a..d53ca1eb60 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -600,6 +600,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'SEARCH_TITLE' => $l_search_title, 'SEARCH_MATCHES' => $l_search_matches, 'SEARCH_WORDS' => $keywords, + 'SEARCHED_QUERY' => $search->search_query, 'IGNORED_WORDS' => (sizeof($search->common_words)) ? implode(' ', $search->common_words) : '', 'PAGINATION' => generate_pagination($u_search, $total_match_count, $per_page, $start), 'PAGE_NUMBER' => on_page($total_match_count, $per_page, $start), -- cgit v1.2.1 From 922147f05a75d5a0e00b34f0102bc014583df984 Mon Sep 17 00:00:00 2001 From: Drae Date: Wed, 4 Jul 2012 23:19:59 +0100 Subject: [ticket/10968] Render pagination within the template Since phpBB 2 pagination has been rendered mostly within the source. This limits just what designers can do with pagination. The current form is also questionable in terms of "best practice". The aim is to move rendering completely to the template via the use of a block element. Enabling S_ template vars also allows for control over specific aspects of the pagination output such as next, previous, active and ellipsis. Related to this - merging the capabilities of the topic_generate_pagination with generate_pagination removes an element of duplication. PHPBB3-10968 --- phpBB/search.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 93cd0c31fd..fefe7f9b0e 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -603,13 +603,14 @@ if ($keywords || $author || $author_id || $search_id || $submit) $phrase_search_disabled = $search->supports_phrase_search() ? false : true; } + generate_pagination($u_search, $total_match_count, $per_page, $start); + $template->assign_vars(array( 'SEARCH_TITLE' => $l_search_title, 'SEARCH_MATCHES' => $l_search_matches, 'SEARCH_WORDS' => $keywords, 'SEARCHED_QUERY' => $search->search_query, 'IGNORED_WORDS' => (sizeof($search->common_words)) ? implode(' ', $search->common_words) : '', - 'PAGINATION' => generate_pagination($u_search, $total_match_count, $per_page, $start), 'PAGE_NUMBER' => on_page($total_match_count, $per_page, $start), 'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled, @@ -899,7 +900,6 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), - 'PAGINATION' => topic_generate_pagination($replies, $view_topic_url), 'TOPIC_TYPE' => $topic_type, 'TOPIC_IMG_STYLE' => $folder_img, @@ -1003,6 +1003,11 @@ if ($keywords || $author || $author_id || $search_id || $submit) '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'] : '') )); + + if ($show_results == 'topics') + { + generate_pagination($view_topic_url, $replies + 1, $config['posts_per_page'], 1, '', true, true, 'searchresults'); + } } if ($topic_id && ($topic_id == $result_topic_id)) -- cgit v1.2.1 From dc71c0629e60acccd39b59538f2e7f5b09b32509 Mon Sep 17 00:00:00 2001 From: Drae Date: Thu, 5 Jul 2012 18:56:14 +0100 Subject: [feature/pagination-as-list] Various fixes and improvements Extracted common template code for prosilver as per subsilver2. Various other fixups and oversight corrections, changed name of the "new" template function and re-introduced existing version. Altered on_page to compensate for removal of some templating vars from pagination routine. PHPBB3-10968 --- phpBB/search.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index fefe7f9b0e..ac2289295c 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -603,7 +603,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $phrase_search_disabled = $search->supports_phrase_search() ? false : true; } - generate_pagination($u_search, $total_match_count, $per_page, $start); + generate_template_pagination($u_search, 'pagination', $total_match_count, $per_page, $start); $template->assign_vars(array( 'SEARCH_TITLE' => $l_search_title, @@ -611,7 +611,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'SEARCH_WORDS' => $keywords, 'SEARCHED_QUERY' => $search->search_query, 'IGNORED_WORDS' => (sizeof($search->common_words)) ? implode(' ', $search->common_words) : '', - 'PAGE_NUMBER' => on_page($total_match_count, $per_page, $start), + 'PAGE_NUMBER' => on_page($u_search, $total_match_count, $per_page, $start), 'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled, @@ -1006,7 +1006,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) if ($show_results == 'topics') { - generate_pagination($view_topic_url, $replies + 1, $config['posts_per_page'], 1, '', true, true, 'searchresults'); + generate_template_pagination($view_topic_url, 'searchresults.pagination', $replies + 1, $config['posts_per_page'], 1, true, true); } } -- cgit v1.2.1 From cf4d6e926dd83d61073ac355cdaf7778a18dcbf8 Mon Sep 17 00:00:00 2001 From: Drae Date: Fri, 6 Jul 2012 14:44:04 +0100 Subject: [feature/pagination-as-list] Rename and deprecate functions Returned and marked deprecated topic_generate_pagination. Rename new function in line with coding guidelines. PHPBB3-10968 --- phpBB/search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index ac2289295c..940eb52153 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -603,7 +603,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $phrase_search_disabled = $search->supports_phrase_search() ? false : true; } - generate_template_pagination($u_search, 'pagination', $total_match_count, $per_page, $start); + phpbb_generate_template_pagination($u_search, 'pagination', $total_match_count, $per_page, $start); $template->assign_vars(array( 'SEARCH_TITLE' => $l_search_title, @@ -1006,7 +1006,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) if ($show_results == 'topics') { - generate_template_pagination($view_topic_url, 'searchresults.pagination', $replies + 1, $config['posts_per_page'], 1, true, true); + phpbb_generate_template_pagination($view_topic_url, 'searchresults.pagination', $replies + 1, $config['posts_per_page'], 1, true, true); } } -- cgit v1.2.1 From 27d8aef528460e87efc90bc4fffc82c0d1fa87d9 Mon Sep 17 00:00:00 2001 From: Drae Date: Sun, 8 Jul 2012 21:07:28 +0100 Subject: [feature/pagination-as-list] Updates for nils comments Re-remove deprecated functions, change on_page to phpbb_on_page, add null returns, remove globals and pass as params. PHPBB3-10968 --- phpBB/search.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 940eb52153..f643ccb137 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -603,7 +603,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $phrase_search_disabled = $search->supports_phrase_search() ? false : true; } - phpbb_generate_template_pagination($u_search, 'pagination', $total_match_count, $per_page, $start); + phpbb_generate_template_pagination($template, $u_search, 'pagination', $total_match_count, $per_page, $start); $template->assign_vars(array( 'SEARCH_TITLE' => $l_search_title, @@ -611,7 +611,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'SEARCH_WORDS' => $keywords, 'SEARCHED_QUERY' => $search->search_query, 'IGNORED_WORDS' => (sizeof($search->common_words)) ? implode(' ', $search->common_words) : '', - 'PAGE_NUMBER' => on_page($u_search, $total_match_count, $per_page, $start), + 'PAGE_NUMBER' => phpbb_on_page($template, $user, $u_search, $total_match_count, $per_page, $start), 'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled, @@ -1006,7 +1006,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) if ($show_results == 'topics') { - phpbb_generate_template_pagination($view_topic_url, 'searchresults.pagination', $replies + 1, $config['posts_per_page'], 1, true, true); + phpbb_generate_template_pagination($template, $view_topic_url, 'searchresults.pagination', $replies + 1, $config['posts_per_page'], 1, true, true); } } -- cgit v1.2.1 From 584d49459d22ebf47239fc97ad8358a5404dacf4 Mon Sep 17 00:00:00 2001 From: Drae Date: Thu, 12 Jul 2012 02:36:00 +0100 Subject: [feature/pagination-as-list] New parameter for name of start var Add a new parameter to hold the name of the start variable. This fulfills ticket PHPBB3-8535. PHPBB3-10968 --- phpBB/search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index f643ccb137..efbf2f4dfe 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -603,7 +603,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $phrase_search_disabled = $search->supports_phrase_search() ? false : true; } - phpbb_generate_template_pagination($template, $u_search, 'pagination', $total_match_count, $per_page, $start); + phpbb_generate_template_pagination($template, $u_search, 'pagination', 'start', $total_match_count, $per_page, $start); $template->assign_vars(array( 'SEARCH_TITLE' => $l_search_title, @@ -1006,7 +1006,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) if ($show_results == 'topics') { - phpbb_generate_template_pagination($template, $view_topic_url, 'searchresults.pagination', $replies + 1, $config['posts_per_page'], 1, true, true); + phpbb_generate_template_pagination($template, $view_topic_url, 'searchresults.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true); } } -- cgit v1.2.1 From 2e218776bbac82841e1ced583c83890be5080af0 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Tue, 24 Jul 2012 12:10:22 +0530 Subject: [ticket/11011] passing global variables Pass global variables to class constructor when making a new object. PHPBB3-11011 --- phpBB/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index efbf2f4dfe..68946e2a95 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -280,7 +280,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } // We do some additional checks in the module to ensure it can actually be utilised $error = false; - $search = new $search_type($error); + $search = new $search_type($error, $phpbb_root_path, $phpEx, $config, $db, $user); if ($error) { -- cgit v1.2.1 From 794d6ec443bd16ad2f7776d1ba2abcf2ce1c5553 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 8 Aug 2012 11:07:47 +0530 Subject: [ticket/11011] pass $auth to search backend constructor $auth global var is passed to search backend constructor, as it is used by sphinx backend. PHPBB3-11011 --- phpBB/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 68946e2a95..190da5247f 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -280,7 +280,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } // We do some additional checks in the module to ensure it can actually be utilised $error = false; - $search = new $search_type($error, $phpbb_root_path, $phpEx, $config, $db, $user); + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user); if ($error) { -- cgit v1.2.1 From 7402328b8177a2080cc269be12aeb84f54d65a22 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 16 Aug 2012 22:35:50 +0530 Subject: [ticket/11051] function instead of accessing property in search Use get_search_query() instead of accessing the search_query property directly as it is now protected. PHPBB3-11051 --- phpBB/search.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 190da5247f..c6c92e68b0 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -291,7 +291,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) if ($keywords) { $correct_query = $search->split_keywords($keywords, $search_terms); - if (!$correct_query || (empty($search->search_query) && !sizeof($author_id_ary) && !$search_id)) + if (!$correct_query || (!$search->get_search_query() && !sizeof($author_id_ary) && !$search_id)) { $ignored = (sizeof($search->common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $search->common_words)) . '
' : ''; trigger_error($ignored . $user->lang('NO_KEYWORDS', $user->lang('CHARACTERS', (int) $search->word_length['min']), $user->lang('CHARACTERS', (int) $search->word_length['max']))); @@ -526,7 +526,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) sort($m_approve_fid_ary); sort($author_id_ary); - if (!empty($search->search_query)) + if ($search->get_search_query()) { $total_match_count = $search->keyword_search($show_results, $search_fields, $search_terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page); } @@ -609,7 +609,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'SEARCH_TITLE' => $l_search_title, 'SEARCH_MATCHES' => $l_search_matches, 'SEARCH_WORDS' => $keywords, - 'SEARCHED_QUERY' => $search->search_query, + 'SEARCHED_QUERY' => $search->get_search_query(), 'IGNORED_WORDS' => (sizeof($search->common_words)) ? implode(' ', $search->common_words) : '', 'PAGE_NUMBER' => phpbb_on_page($template, $user, $u_search, $total_match_count, $per_page, $start), -- cgit v1.2.1 From 9b9dc2fab71ec95c4dc48787dd9950872773cfa7 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 16 Aug 2012 23:16:26 +0530 Subject: [ticket/11051] use get_common_words in search backend Use get_common_words() instead of accessing the common_words property directly as it is now protected. PHPBB3-11051 --- phpBB/search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index c6c92e68b0..fd67b483e8 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -293,7 +293,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) $correct_query = $search->split_keywords($keywords, $search_terms); if (!$correct_query || (!$search->get_search_query() && !sizeof($author_id_ary) && !$search_id)) { - $ignored = (sizeof($search->common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $search->common_words)) . '
' : ''; + $ignored = (sizeof($search->get_common_words())) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $search->get_common_words())) . '
' : ''; trigger_error($ignored . $user->lang('NO_KEYWORDS', $user->lang('CHARACTERS', (int) $search->word_length['min']), $user->lang('CHARACTERS', (int) $search->word_length['max']))); } } @@ -610,7 +610,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'SEARCH_MATCHES' => $l_search_matches, 'SEARCH_WORDS' => $keywords, 'SEARCHED_QUERY' => $search->get_search_query(), - 'IGNORED_WORDS' => (sizeof($search->common_words)) ? implode(' ', $search->common_words) : '', + 'IGNORED_WORDS' => (sizeof($search->get_common_words())) ? implode(' ', $search->get_common_words()) : '', 'PAGE_NUMBER' => phpbb_on_page($template, $user, $u_search, $total_match_count, $per_page, $start), 'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled, -- cgit v1.2.1 From a2e1989b012e3f77a18c2758cd913245ce3c180b Mon Sep 17 00:00:00 2001 From: Dhruv Date: Fri, 17 Aug 2012 00:11:32 +0530 Subject: [ticket/11051] use get_word_length in search backend Use get_word_length() instead od accessing the word_length property directly as it is now protected. PHPBB3-11051 --- phpBB/search.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index fd67b483e8..54f0f225a0 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -294,7 +294,9 @@ if ($keywords || $author || $author_id || $search_id || $submit) if (!$correct_query || (!$search->get_search_query() && !sizeof($author_id_ary) && !$search_id)) { $ignored = (sizeof($search->get_common_words())) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $search->get_common_words())) . '
' : ''; - trigger_error($ignored . $user->lang('NO_KEYWORDS', $user->lang('CHARACTERS', (int) $search->word_length['min']), $user->lang('CHARACTERS', (int) $search->word_length['max']))); + // Function cannot be directly used as associative array for php < 5.4 + $word_length = $search->get_word_length(); + trigger_error($ignored . $user->lang('NO_KEYWORDS', $user->lang('CHARACTERS', (int) $word_length['min']), $user->lang('CHARACTERS', (int) $word_length['max']))); } } -- cgit v1.2.1 From 52b25aaf20f512911a981958e0efa9365eb34489 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 4 Oct 2012 01:51:57 +0530 Subject: [ticket/11051] add get_word_len() in sphinx search get_word_len() for sphinx search backend returns false always and triggers proper error. PHPBB3-11051 --- phpBB/search.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 54f0f225a0..e869c8eebd 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -296,7 +296,14 @@ if ($keywords || $author || $author_id || $search_id || $submit) $ignored = (sizeof($search->get_common_words())) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $search->get_common_words())) . '
' : ''; // Function cannot be directly used as associative array for php < 5.4 $word_length = $search->get_word_length(); - trigger_error($ignored . $user->lang('NO_KEYWORDS', $user->lang('CHARACTERS', (int) $word_length['min']), $user->lang('CHARACTERS', (int) $word_length['max']))); + if ($word_length) + { + trigger_error($ignored . $user->lang('NO_KEYWORDS', $user->lang('CHARACTERS', (int) $word_length['min']), $user->lang('CHARACTERS', (int) $word_length['max']))); + } + else + { + trigger_error($ignored); + } } } -- cgit v1.2.1 From 67939192ae287b958902b382c6dd344c2cb74a74 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 4 Oct 2012 23:17:18 +0530 Subject: [ticket/11051] remove unnecessary comment PHPBB3-11051 --- phpBB/search.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index e869c8eebd..f392e386c7 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -294,7 +294,6 @@ if ($keywords || $author || $author_id || $search_id || $submit) if (!$correct_query || (!$search->get_search_query() && !sizeof($author_id_ary) && !$search_id)) { $ignored = (sizeof($search->get_common_words())) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $search->get_common_words())) . '
' : ''; - // Function cannot be directly used as associative array for php < 5.4 $word_length = $search->get_word_length(); if ($word_length) { -- cgit v1.2.1 From be884b7e290edfaf5db189e6c3cf22024906f159 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Thu, 4 Oct 2012 23:32:50 +0530 Subject: [ticket/11051] add common_words variable PHPBB3-11051 --- phpBB/search.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index f392e386c7..7eda3c4d1d 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -287,13 +287,15 @@ if ($keywords || $author || $author_id || $search_id || $submit) trigger_error($error); } + $common_words = $search->get_common_words(); + // let the search module split up the keywords if ($keywords) { $correct_query = $search->split_keywords($keywords, $search_terms); if (!$correct_query || (!$search->get_search_query() && !sizeof($author_id_ary) && !$search_id)) { - $ignored = (sizeof($search->get_common_words())) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $search->get_common_words())) . '
' : ''; + $ignored = (sizeof($common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $common_words)) . '
' : ''; $word_length = $search->get_word_length(); if ($word_length) { @@ -618,7 +620,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'SEARCH_MATCHES' => $l_search_matches, 'SEARCH_WORDS' => $keywords, 'SEARCHED_QUERY' => $search->get_search_query(), - 'IGNORED_WORDS' => (sizeof($search->get_common_words())) ? implode(' ', $search->get_common_words()) : '', + 'IGNORED_WORDS' => (sizeof($common_words)) ? implode(' ', $common_words) : '', 'PAGE_NUMBER' => phpbb_on_page($template, $user, $u_search, $total_match_count, $per_page, $start), 'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled, -- cgit v1.2.1 From ceb5a40eecbc60577ce0735254a4a189d719302e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 25 Aug 2012 14:53:21 +0200 Subject: [ticket/11023] Fix additional whitespaces that were added by PHPBB3-10968 PHPBB3-11023 --- phpBB/search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 7eda3c4d1d..7d20d8d4a2 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -614,7 +614,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) } phpbb_generate_template_pagination($template, $u_search, 'pagination', 'start', $total_match_count, $per_page, $start); - + $template->assign_vars(array( 'SEARCH_TITLE' => $l_search_title, 'SEARCH_MATCHES' => $l_search_matches, @@ -1013,7 +1013,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) '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'] : '') )); - + if ($show_results == 'topics') { phpbb_generate_template_pagination($template, $view_topic_url, 'searchresults.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true); -- cgit v1.2.1