mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
This changes the signature of author_search. Search backends will need adjustment. git-svn-id: file:///svn/phpbb/trunk@7930 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
d4fb1870be
commit
e8ae63daf6
4 changed files with 18 additions and 7 deletions
|
@ -269,7 +269,7 @@ p a {
|
||||||
<li>[Fix] Finer error conditions for sending IM messages (Bugs #13681, #13683)</li>
|
<li>[Fix] Finer error conditions for sending IM messages (Bugs #13681, #13683)</li>
|
||||||
<li>[Fix] Add a confirmation for log deletion in the MCP (Bug #13693)</li>
|
<li>[Fix] Add a confirmation for log deletion in the MCP (Bug #13693)</li>
|
||||||
<li>[Fix] Do not erase ranks and avatars when changing default groups (Bugs #13701, #13697)</li>
|
<li>[Fix] Do not erase ranks and avatars when changing default groups (Bugs #13701, #13697)</li>
|
||||||
<li>[Fix] Propagate forum_id in the MCP (Bug #13731)</li>
|
<li>[Fix] Limit author searches to firstpost, if selected (Bug #13579)</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -494,7 +494,7 @@ class fulltext_mysql extends search_backend
|
||||||
* @param int $per_page number of ids each page is supposed to contain
|
* @param int $per_page number of ids each page is supposed to contain
|
||||||
* @return total number of results
|
* @return total number of results
|
||||||
*/
|
*/
|
||||||
function author_search($type, &$sort_by_sql, &$sort_key, &$sort_dir, &$sort_days, &$ex_fid_ary, &$m_approve_fid_ary, &$topic_id, &$author_ary, &$id_ary, $start, $per_page)
|
function author_search($type, $firstpost_only, &$sort_by_sql, &$sort_key, &$sort_dir, &$sort_days, &$ex_fid_ary, &$m_approve_fid_ary, &$topic_id, &$author_ary, &$id_ary, $start, $per_page)
|
||||||
{
|
{
|
||||||
global $config, $db;
|
global $config, $db;
|
||||||
|
|
||||||
|
@ -508,6 +508,7 @@ class fulltext_mysql extends search_backend
|
||||||
$search_key = md5(implode('#', array(
|
$search_key = md5(implode('#', array(
|
||||||
'',
|
'',
|
||||||
$type,
|
$type,
|
||||||
|
($firstpost_only) ? 'firstpost' : '',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
$sort_days,
|
$sort_days,
|
||||||
|
@ -532,6 +533,7 @@ class fulltext_mysql extends search_backend
|
||||||
$sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
|
$sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
|
||||||
$sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
|
$sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
|
||||||
$sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
$sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
||||||
|
$sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : '';
|
||||||
|
|
||||||
// Build sql strings for sorting
|
// Build sql strings for sorting
|
||||||
$sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC');
|
$sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC');
|
||||||
|
@ -574,9 +576,10 @@ class fulltext_mysql extends search_backend
|
||||||
if ($type == 'posts')
|
if ($type == 'posts')
|
||||||
{
|
{
|
||||||
$sql = "SELECT {$calc_results}p.post_id
|
$sql = "SELECT {$calc_results}p.post_id
|
||||||
FROM " . $sql_sort_table . POSTS_TABLE . " p
|
FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . "
|
||||||
WHERE $sql_author
|
WHERE $sql_author
|
||||||
$sql_topic_id
|
$sql_topic_id
|
||||||
|
$sql_firstpost
|
||||||
$m_approve_fid_sql
|
$m_approve_fid_sql
|
||||||
$sql_fora
|
$sql_fora
|
||||||
$sql_sort_join
|
$sql_sort_join
|
||||||
|
@ -590,6 +593,7 @@ class fulltext_mysql extends search_backend
|
||||||
FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
||||||
WHERE $sql_author
|
WHERE $sql_author
|
||||||
$sql_topic_id
|
$sql_topic_id
|
||||||
|
$sql_firstpost
|
||||||
$m_approve_fid_sql
|
$m_approve_fid_sql
|
||||||
$sql_fora
|
$sql_fora
|
||||||
AND t.topic_id = p.topic_id
|
AND t.topic_id = p.topic_id
|
||||||
|
|
|
@ -759,7 +759,7 @@ class fulltext_native extends search_backend
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function author_search($type, &$sort_by_sql, &$sort_key, &$sort_dir, &$sort_days, &$ex_fid_ary, &$m_approve_fid_ary, &$topic_id, &$author_ary, &$id_ary, $start, $per_page)
|
function author_search($type, $firstpost_only, &$sort_by_sql, &$sort_key, &$sort_dir, &$sort_days, &$ex_fid_ary, &$m_approve_fid_ary, &$topic_id, &$author_ary, &$id_ary, $start, $per_page)
|
||||||
{
|
{
|
||||||
global $config, $db;
|
global $config, $db;
|
||||||
|
|
||||||
|
@ -773,6 +773,7 @@ class fulltext_native extends search_backend
|
||||||
$search_key = md5(implode('#', array(
|
$search_key = md5(implode('#', array(
|
||||||
'',
|
'',
|
||||||
$type,
|
$type,
|
||||||
|
($firstpost_only) ? 'firstpost' : '',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
$sort_days,
|
$sort_days,
|
||||||
|
@ -797,6 +798,7 @@ class fulltext_native extends search_backend
|
||||||
$sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
|
$sql_fora = (sizeof($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '';
|
||||||
$sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
$sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
||||||
$sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
|
$sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
|
||||||
|
$sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : '';
|
||||||
|
|
||||||
// Build sql strings for sorting
|
// Build sql strings for sorting
|
||||||
$sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC');
|
$sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC');
|
||||||
|
@ -850,9 +852,10 @@ class fulltext_native extends search_backend
|
||||||
if ($type == 'posts')
|
if ($type == 'posts')
|
||||||
{
|
{
|
||||||
$sql = 'SELECT COUNT(p.post_id) as total_results
|
$sql = 'SELECT COUNT(p.post_id) as total_results
|
||||||
FROM ' . POSTS_TABLE . " p
|
FROM ' . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . "
|
||||||
WHERE $sql_author
|
WHERE $sql_author
|
||||||
$sql_topic_id
|
$sql_topic_id
|
||||||
|
$sql_firstpost
|
||||||
$m_approve_fid_sql
|
$m_approve_fid_sql
|
||||||
$sql_fora
|
$sql_fora
|
||||||
$sql_time";
|
$sql_time";
|
||||||
|
@ -872,6 +875,7 @@ class fulltext_native extends search_backend
|
||||||
$sql .= ' FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
$sql .= ' FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
||||||
WHERE $sql_author
|
WHERE $sql_author
|
||||||
$sql_topic_id
|
$sql_topic_id
|
||||||
|
$sql_firstpost
|
||||||
$m_approve_fid_sql
|
$m_approve_fid_sql
|
||||||
$sql_fora
|
$sql_fora
|
||||||
AND t.topic_id = p.topic_id
|
AND t.topic_id = p.topic_id
|
||||||
|
@ -894,9 +898,10 @@ class fulltext_native extends search_backend
|
||||||
if ($type == 'posts')
|
if ($type == 'posts')
|
||||||
{
|
{
|
||||||
$sql = "SELECT $select
|
$sql = "SELECT $select
|
||||||
FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($topic_id) ? ', ' . TOPICS_TABLE . ' t' : '') . "
|
FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($topic_id || $firstpost_only) ? ', ' . TOPICS_TABLE . ' t' : '') . "
|
||||||
WHERE $sql_author
|
WHERE $sql_author
|
||||||
$sql_topic_id
|
$sql_topic_id
|
||||||
|
$sql_firstpost
|
||||||
$m_approve_fid_sql
|
$m_approve_fid_sql
|
||||||
$sql_fora
|
$sql_fora
|
||||||
$sql_sort_join
|
$sql_sort_join
|
||||||
|
@ -910,6 +915,7 @@ class fulltext_native extends search_backend
|
||||||
FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
||||||
WHERE $sql_author
|
WHERE $sql_author
|
||||||
$sql_topic_id
|
$sql_topic_id
|
||||||
|
$sql_firstpost
|
||||||
$m_approve_fid_sql
|
$m_approve_fid_sql
|
||||||
$sql_fora
|
$sql_fora
|
||||||
AND t.topic_id = p.topic_id
|
AND t.topic_id = p.topic_id
|
||||||
|
|
|
@ -419,7 +419,8 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||||
}
|
}
|
||||||
else if (sizeof($author_id_ary))
|
else if (sizeof($author_id_ary))
|
||||||
{
|
{
|
||||||
$total_match_count = $search->author_search($show_results, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_id_ary, $id_ary, $start, $per_page);
|
$firstpost_only = ($search_fields === 'firstpost') ? 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_fid_ary, $topic_id, $author_id_ary, $id_ary, $start, $per_page);
|
||||||
}
|
}
|
||||||
|
|
||||||
// For some searches we need to print out the "no results" page directly to allow re-sorting/refining the search options.
|
// For some searches we need to print out the "no results" page directly to allow re-sorting/refining the search options.
|
||||||
|
|
Loading…
Add table
Reference in a new issue