From 4eecc95a42d8493b80a4b1a7684c84b3ffe488c3 Mon Sep 17 00:00:00 2001 From: Erwan Nader Date: Sun, 24 Jul 2016 17:46:23 +0200 Subject: [PATCH 1/4] [ticket/14592] [PHP] core.search_backend_search_after PHPBB3-14592 --- phpBB/search.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/phpBB/search.php b/phpBB/search.php index a0380590c1..bffbd47996 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -575,6 +575,48 @@ if ($keywords || $author || $author_id || $search_id || $submit) $total_match_count = $search->author_search($show_results, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page); } + /** + * Event to search otherwise than by keywords or author + * + * @event core.search_backend_search_after + * @var string $show_results 'posts' or 'topics' type of ids + * @var string $search_fields The data fields to search in + * @var string $search_terms Is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) + * @var array $sort_by_sql Array of SQL sorting instructions + * @var string $sort_key The sort key + * @var string $sort_dir The sort direction + * @var string $sort_days Limit the age of results + * @var array $ex_fid_ary Array of excluded forum ids + * @var string $m_approve_posts_fid_sql Specifies which types of posts the user can view in which forums + * @var int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @var array $author_id_ary Array of exclusive author ids + * @var string $sql_author_match Specifies the author match, when ANONYMOUS is also a search-match + * @var array $id_ary Array of post or topic ids for search result + * @var int $start The starting id of the results + * @var int $per_page Number of ids each page is supposed to contain + * @var int $total_match_count The total number of search matches + * @since 3.1.10-RC1 + */ + $vars = array( + 'show_results', + 'search_fields', + 'search_terms', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sort_days', + 'ex_fid_ary', + 'm_approve_posts_fid_sql', + 'topic_id', + 'author_id_ary', + 'sql_author_match', + 'id_ary', + 'start', + 'per_page', + 'total_match_count' + ); + extract($phpbb_dispatcher->trigger_event('core.search_backend_search_after', compact($vars))); + $sql_where = ''; if (sizeof($id_ary)) From 5b501e594c03a6e7d35be28b8b28a3b87df4e1e6 Mon Sep 17 00:00:00 2001 From: Erwan Nader Date: Sun, 24 Jul 2016 18:10:45 +0200 Subject: [PATCH 2/4] [ticket/14592] Fixed syntax errors from unit tests PHPBB3-14592 --- phpBB/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/search.php b/phpBB/search.php index bffbd47996..6335adbaf2 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -613,7 +613,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'id_ary', 'start', 'per_page', - 'total_match_count' + 'total_match_count', ); extract($phpbb_dispatcher->trigger_event('core.search_backend_search_after', compact($vars))); From e7289fa019f57ee6b57c984a7752e934bc7f7c3f Mon Sep 17 00:00:00 2001 From: Erwan Nader Date: Sun, 24 Jul 2016 18:25:20 +0200 Subject: [PATCH 3/4] [ticket/14592] Fixed docblock from unit tests PHPBB3-14592 --- phpBB/search.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/phpBB/search.php b/phpBB/search.php index 6335adbaf2..8dccc7f14b 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -579,22 +579,22 @@ if ($keywords || $author || $author_id || $search_id || $submit) * Event to search otherwise than by keywords or author * * @event core.search_backend_search_after - * @var string $show_results 'posts' or 'topics' type of ids - * @var string $search_fields The data fields to search in - * @var string $search_terms Is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) - * @var array $sort_by_sql Array of SQL sorting instructions - * @var string $sort_key The sort key - * @var string $sort_dir The sort direction - * @var string $sort_days Limit the age of results - * @var array $ex_fid_ary Array of excluded forum ids - * @var string $m_approve_posts_fid_sql Specifies which types of posts the user can view in which forums - * @var int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched - * @var array $author_id_ary Array of exclusive author ids - * @var string $sql_author_match Specifies the author match, when ANONYMOUS is also a search-match - * @var array $id_ary Array of post or topic ids for search result - * @var int $start The starting id of the results - * @var int $per_page Number of ids each page is supposed to contain - * @var int $total_match_count The total number of search matches + * @var string show_results 'posts' or 'topics' type of ids + * @var string search_fields The data fields to search in + * @var string search_terms Is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) + * @var array sort_by_sql Array of SQL sorting instructions + * @var string sort_key The sort key + * @var string sort_dir The sort direction + * @var string sort_days Limit the age of results + * @var array ex_fid_ary Array of excluded forum ids + * @var string m_approve_posts_fid_sql Specifies which types of posts the user can view in which forums + * @var int topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @var array author_id_ary Array of exclusive author ids + * @var string sql_author_match Specifies the author match, when ANONYMOUS is also a search-match + * @var array id_ary Array of post or topic ids for search result + * @var int start The starting id of the results + * @var int per_page Number of ids each page is supposed to contain + * @var int total_match_count The total number of search matches * @since 3.1.10-RC1 */ $vars = array( From 6b435cbf13487a8871caa7edb82644df98ce16a0 Mon Sep 17 00:00:00 2001 From: Erwan Nader Date: Sun, 18 Sep 2016 19:55:00 +0200 Subject: [PATCH 4/4] [ticket/14592] Fix variable type PHPBB3-14592 --- phpBB/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/search.php b/phpBB/search.php index 8dccc7f14b..8fcd079ebd 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -585,7 +585,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var array sort_by_sql Array of SQL sorting instructions * @var string sort_key The sort key * @var string sort_dir The sort direction - * @var string sort_days Limit the age of results + * @var int sort_days Limit the age of results * @var array ex_fid_ary Array of excluded forum ids * @var string m_approve_posts_fid_sql Specifies which types of posts the user can view in which forums * @var int topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched