diff options
author | Henry Sudhof <kellanved@phpbb.com> | 2007-07-23 17:03:37 +0000 |
---|---|---|
committer | Henry Sudhof <kellanved@phpbb.com> | 2007-07-23 17:03:37 +0000 |
commit | e8ae63daf6c693fb02883e33b8f561168507d449 (patch) | |
tree | ceceb147a4c90e4ae9956cc3efa9ee41d71a5d13 /phpBB/includes | |
parent | d4fb1870be8f2aee08b7788b6293bb5691f6c345 (diff) | |
download | forums-e8ae63daf6c693fb02883e33b8f561168507d449.tar forums-e8ae63daf6c693fb02883e33b8f561168507d449.tar.gz forums-e8ae63daf6c693fb02883e33b8f561168507d449.tar.bz2 forums-e8ae63daf6c693fb02883e33b8f561168507d449.tar.xz forums-e8ae63daf6c693fb02883e33b8f561168507d449.zip |
#13579
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
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/search/fulltext_mysql.php | 8 | ||||
-rwxr-xr-x | phpBB/includes/search/fulltext_native.php | 12 |
2 files changed, 15 insertions, 5 deletions
diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index 951ef5b69f..38022a21c4 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -494,7 +494,7 @@ class fulltext_mysql extends search_backend * @param int $per_page number of ids each page is supposed to contain * @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; @@ -508,6 +508,7 @@ class fulltext_mysql extends search_backend $search_key = md5(implode('#', array( '', $type, + ($firstpost_only) ? 'firstpost' : '', '', '', $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_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : ''; $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 $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') { $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 $sql_topic_id + $sql_firstpost $m_approve_fid_sql $sql_fora $sql_sort_join @@ -590,6 +593,7 @@ class fulltext_mysql extends search_backend FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p WHERE $sql_author $sql_topic_id + $sql_firstpost $m_approve_fid_sql $sql_fora AND t.topic_id = p.topic_id diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index 1f375c8f51..9cad77dd7f 100755 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -759,7 +759,7 @@ class fulltext_native extends search_backend * * @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; @@ -773,6 +773,7 @@ class fulltext_native extends search_backend $search_key = md5(implode('#', array( '', $type, + ($firstpost_only) ? 'firstpost' : '', '', '', $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_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; $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 $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') { $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 $sql_topic_id + $sql_firstpost $m_approve_fid_sql $sql_fora $sql_time"; @@ -872,6 +875,7 @@ class fulltext_native extends search_backend $sql .= ' FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p WHERE $sql_author $sql_topic_id + $sql_firstpost $m_approve_fid_sql $sql_fora AND t.topic_id = p.topic_id @@ -894,9 +898,10 @@ class fulltext_native extends search_backend if ($type == 'posts') { $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 $sql_topic_id + $sql_firstpost $m_approve_fid_sql $sql_fora $sql_sort_join @@ -910,6 +915,7 @@ class fulltext_native extends search_backend FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p WHERE $sql_author $sql_topic_id + $sql_firstpost $m_approve_fid_sql $sql_fora AND t.topic_id = p.topic_id |