phpBB

Code Changes

File: search.php

  Unmodified   Added   Modified   Removed
Line 125Line 125

$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$pagination = $phpbb_container->get('pagination');


$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$pagination = $phpbb_container->get('pagination');

 

/**
* This event allows you to alter the above parameters, such as keywords and submit
*
* @event core.search_modify_submit_parameters
* @var string keywords The search keywords
* @var string author Specifies the author match, when ANONYMOUS is also a search-match
* @var int author_id ID of the author to search by
* @var string search_id Predefined search type name
* @var bool submit Whether or not the form has been submitted
* @since 3.1.10-RC1
*/
$vars = array(
'keywords',
'author',
'author_id',
'search_id',
'submit',
);
extract($phpbb_dispatcher->trigger_event('core.search_modify_submit_parameters', compact($vars)));


if ($keywords || $author || $author_id || $search_id || $submit)
{


if ($keywords || $author || $author_id || $search_id || $submit)
{

Line 320Line 340
	* @var	array	ex_fid_ary		Array of excluded forum ids
* @var array author_id_ary Array of exclusive author ids
* @var string search_id The id of the search request

	* @var	array	ex_fid_ary		Array of excluded forum ids
* @var array author_id_ary Array of exclusive author ids
* @var string search_id The id of the search request

 
	* @var	array	id_ary			Array of post or topic ids for search result
* @var string show_results 'posts' or 'topics' type of ids

	* @since 3.1.3-RC1

	* @since 3.1.3-RC1

 
	* @changed 3.1.10-RC1 Added id_ary, show_results

	*/
$vars = array(
'keywords',

	*/
$vars = array(
'keywords',

Line 328Line 351
		'ex_fid_ary',
'author_id_ary',
'search_id',

		'ex_fid_ary',
'author_id_ary',
'search_id',

 
		'id_ary',
'show_results',

	);
extract($phpbb_dispatcher->trigger_event('core.search_modify_param_before', compact($vars)));


	);
extract($phpbb_dispatcher->trigger_event('core.search_modify_param_before', compact($vars)));


Line 569Line 594
		$firstpost_only = ($search_fields === 'firstpost' || $search_fields == 'titleonly') ? true : false;
$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);
}

		$firstpost_only = ($search_fields === 'firstpost' || $search_fields == 'titleonly') ? true : false;
$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 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
* @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 = '';



$sql_where = '';


Line 620Line 687
	* @event core.search_modify_url_parameters
* @var string u_search Search URL parameters string
* @var string search_id Predefined search type name

	* @event core.search_modify_url_parameters
* @var string u_search Search URL parameters string
* @var string search_id Predefined search type name

 
	* @var	string	show_results	String indicating the show results mode
* @var string sql_where The SQL WHERE string used by search to get topic data
* @var int total_match_count The total number of search matches

	* @since 3.1.7-RC1

	* @since 3.1.7-RC1

 
	* @changed 3.1.10-RC1 Added show_results, sql_where, total_match_count

	*/
$vars = array(
'u_search',
'search_id',

	*/
$vars = array(
'u_search',
'search_id',

 
		'show_results',
'sql_where',
'total_match_count',

	);
extract($phpbb_dispatcher->trigger_event('core.search_modify_url_parameters', compact($vars)));


	);
extract($phpbb_dispatcher->trigger_event('core.search_modify_url_parameters', compact($vars)));


Line 1249Line 1323
}

// Search forum

}

// Search forum

 
$rowset = array();

$s_forums = '';
$sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.left_id, f.right_id, f.forum_password, f.enable_indexing, fa.user_id
FROM ' . FORUMS_TABLE . ' f

$s_forums = '';
$sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.left_id, f.right_id, f.forum_password, f.enable_indexing, fa.user_id
FROM ' . FORUMS_TABLE . ' f

Line 1256Line 1331
		AND fa.session_id = '" . $db->sql_escape($user->session_id) . "')
ORDER BY f.left_id ASC";
$result = $db->sql_query($sql);

		AND fa.session_id = '" . $db->sql_escape($user->session_id) . "')
ORDER BY f.left_id ASC";
$result = $db->sql_query($sql);

 

while ($row = $db->sql_fetchrow($result))
{
$rowset[(int) $row['forum_id']] = $row;
}
$db->sql_freeresult($result);


$right = $cat_right = $padding_inc = 0;
$padding = $forum_list = $holding = '';
$pad_store = array('0' => '');



$right = $cat_right = $padding_inc = 0;
$padding = $forum_list = $holding = '';
$pad_store = array('0' => '');


while ($row = $db->sql_fetchrow($result))











/**
* Modify the forum select list for advanced search page
*
* @event core.search_modify_forum_select_list
* @var array rowset Array with the forums list data
* @since 3.1.10-RC1
*/
$vars = array('rowset');
extract($phpbb_dispatcher->trigger_event('core.search_modify_forum_select_list', compact($vars)));

foreach ($rowset as $row)

{
if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id']))
{

{
if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id']))
{

Line 1333Line 1424
	$s_forums .= $holding;
}


	$s_forums .= $holding;
}


$db->sql_freeresult($result);

 
unset($pad_store);

unset($pad_store);

 
unset($rowset);


if (!$s_forums)
{


if (!$s_forums)
{