mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 22:08:54 +00:00
Me, me, me!
- only search unapproved posts/topics in forums where the user got the m_approve permission - resize the search cache when it grows too huge (drop distant pages) - added unread link to search results page - streamlined search results and viewforum html code for displaying topics so we're waiting for David now :) git-svn-id: file:///svn/phpbb/trunk@5607 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
2246c8d600
commit
21f3fbc4be
7 changed files with 141 additions and 22 deletions
|
@ -99,7 +99,7 @@ for(;$postcounter <= $max_post_id; $postcounter += $batchsize)
|
|||
|
||||
$post_id = $rowset[$post_nr]['post_id'];
|
||||
|
||||
$search->index('post', $rowset[$post_nr]['post_id'], $rowset[$post_nr]['post_text'], $rowset[$post_nr]['post_subject']);
|
||||
$search->index('post', $rowset[$post_nr]['post_id'], $rowset[$post_nr]['post_text'], $rowset[$post_nr]['post_subject'], $rowset[$post_nr]['poster_id']);
|
||||
}
|
||||
// $sql = "UNLOCK TABLES";
|
||||
// $result = $db->sql_query($sql);
|
||||
|
|
|
@ -163,7 +163,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 keyword_search($type, &$fields, &$terms, &$sort_by_sql, &$sort_key, &$sort_dir, &$sort_days, &$ex_fid_ary, &$topic_id, &$author_ary, &$id_ary, $start, $per_page)
|
||||
function keyword_search($type, &$fields, &$terms, &$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;
|
||||
|
||||
|
@ -183,6 +183,7 @@ class fulltext_mysql extends search_backend
|
|||
$sort_key,
|
||||
$topic_id,
|
||||
implode(',', $ex_fid_ary),
|
||||
implode(',', $m_approve_fid_ary),
|
||||
implode(',', $author_ary)
|
||||
)));
|
||||
|
||||
|
@ -241,16 +242,30 @@ class fulltext_mysql extends search_backend
|
|||
$sql_match_where = '';
|
||||
}
|
||||
|
||||
if (!sizeof($m_approve_fid_ary))
|
||||
{
|
||||
$m_approve_fid_sql = ' AND p.post_approved = 1';
|
||||
}
|
||||
else if ($m_approve_fid_ary === array(-1))
|
||||
{
|
||||
$m_approve_fid_sql = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$m_approve_fid_sql = ' AND (p.post_approved = 1 OR p.forum_id NOT IN (' . implode(', ', $m_approve_fid_ary) . '))';
|
||||
}
|
||||
|
||||
$sql_select = (!$result_count) ? 'SQL_CALC_FOUND_ROWS ' : '';
|
||||
$sql_select = ($type == 'posts') ? $sql_select . 'p.post_id' : 'DISTINCT ' . $sql_select . 't.topic_id';
|
||||
$sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : '';
|
||||
$field = ($type == 'posts') ? 'p.post_id' : 't.topic_id';
|
||||
$field = ($type == 'posts') ? 'post_id' : 'topic_id';
|
||||
$sql_author = (sizeof($author_ary) == 1) ? ' = ' . $author_ary[0] : 'IN (' . implode(',', $author_ary) . ')';
|
||||
|
||||
$sql_where_options = $sql_sort_join;
|
||||
$sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : '';
|
||||
$sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : '';
|
||||
$sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND p.forum_id NOT IN (' . implode(',', $ex_fid_ary) . ')' : '';
|
||||
$sql_where_options .= $m_approve_fid_sql;
|
||||
$sql_where_options .= (sizeof($author_ary)) ? ' AND p.poster_id ' . $sql_author : '';
|
||||
$sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
||||
$sql_where_options .= $sql_match_where;
|
||||
|
@ -301,7 +316,7 @@ class fulltext_mysql extends search_backend
|
|||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$id_ary[] = ($type == 'topics') ? $row['topic_id'] : $row['post_id'];
|
||||
$id_ary[] = $row[$field];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
|
@ -340,7 +355,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, &$topic_id, &$author_ary, &$id_ary, $start, $per_page)
|
||||
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)
|
||||
{
|
||||
global $config, $db;
|
||||
|
||||
|
@ -360,6 +375,7 @@ class fulltext_mysql extends search_backend
|
|||
$sort_key,
|
||||
$topic_id,
|
||||
implode(',', $ex_fid_ary),
|
||||
implode(',', $m_approve_fid_ary),
|
||||
implode(',', $author_ary)
|
||||
)));
|
||||
|
||||
|
@ -375,7 +391,7 @@ class fulltext_mysql extends search_backend
|
|||
// Create some display specific sql strings
|
||||
$sql_author = 'p.poster_id ' . ((sizeof($author_ary) > 1) ? 'IN (' . implode(',', $author_ary) . ')' : '= ' . $author_ary[0]);
|
||||
$sql_fora = (sizeof($ex_fid_ary)) ? ' AND p.forum_id NOT IN (' . implode(',', $ex_fid_ary) . ')' : '';
|
||||
$sql_topic_id = (sizeof($ex_fid_ary)) ? ' AND p.forum_id NOT IN (' . implode(',', $ex_fid_ary) . ')' : '';
|
||||
$sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
|
||||
$sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
||||
|
||||
// Build sql strings for sorting
|
||||
|
@ -399,6 +415,19 @@ class fulltext_mysql extends search_backend
|
|||
break;
|
||||
}
|
||||
|
||||
if (!sizeof($m_approve_fid_ary))
|
||||
{
|
||||
$m_approve_fid_sql = ' AND p.post_approved = 1';
|
||||
}
|
||||
else if ($m_approve_fid_ary == array(-1))
|
||||
{
|
||||
$m_approve_fid_sql = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$m_approve_fid_sql = ' AND (p.post_approved = 1 OR p.forum_id IN (' . implode($m_approve_fid_ary) . '))';
|
||||
}
|
||||
|
||||
// If the cache was completely empty count the results
|
||||
$calc_results = ($result_count) ? '' : 'SQL_CALC_FOUND_ROWS ';
|
||||
|
||||
|
@ -408,6 +437,8 @@ class fulltext_mysql extends search_backend
|
|||
$sql = "SELECT {$calc_results}p.post_id
|
||||
FROM " . $sql_sort_table . POSTS_TABLE . " p
|
||||
WHERE $sql_author
|
||||
$sql_topic_id
|
||||
$m_approve_fid_sql
|
||||
$sql_fora
|
||||
$sql_sort_join
|
||||
$sql_time
|
||||
|
@ -419,6 +450,8 @@ class fulltext_mysql extends search_backend
|
|||
$sql = "SELECT {$calc_results}t.topic_id
|
||||
FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
||||
WHERE $sql_author
|
||||
$sql_topic_id
|
||||
$m_approve_fid_sql
|
||||
$sql_fora
|
||||
AND t.topic_id = p.topic_id
|
||||
$sql_sort_join
|
||||
|
|
|
@ -179,7 +179,6 @@ class fulltext_phpbb extends search_backend
|
|||
|
||||
if (sizeof($this->ignore_words))
|
||||
{
|
||||
$stopped_words = array_intersect($text, $this->ignore_words);
|
||||
$text = array_diff($text, $this->ignore_words);
|
||||
}
|
||||
|
||||
|
@ -210,7 +209,7 @@ class fulltext_phpbb extends search_backend
|
|||
* @param int $per_page number of ids each page is supposed to contain
|
||||
* @return total number of results
|
||||
*/
|
||||
function keyword_search($type, &$fields, &$terms, &$sort_by_sql, &$sort_key, &$sort_dir, &$sort_days, &$ex_fid_ary, &$topic_id, &$author_ary, &$id_ary, $start, $per_page)
|
||||
function keyword_search($type, &$fields, &$terms, &$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;
|
||||
|
||||
|
@ -230,6 +229,7 @@ class fulltext_phpbb extends search_backend
|
|||
$sort_key,
|
||||
$topic_id,
|
||||
implode(',', $ex_fid_ary),
|
||||
implode(',', $m_approve_fid_ary),
|
||||
implode(',', $author_ary)
|
||||
)));
|
||||
|
||||
|
@ -286,6 +286,19 @@ class fulltext_phpbb extends search_backend
|
|||
$sql_match = '';
|
||||
}
|
||||
|
||||
if (!sizeof($m_approve_fid_ary))
|
||||
{
|
||||
$m_approve_fid_sql = ' AND p.post_approved = 1';
|
||||
}
|
||||
else if ($m_approve_fid_ary === array(-1))
|
||||
{
|
||||
$m_approve_fid_sql = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$m_approve_fid_sql = ' AND (p.post_approved = 1 OR p.forum_id NOT IN (' . implode(', ', $m_approve_fid_ary) . '))';
|
||||
}
|
||||
|
||||
$sql_select = ($type == 'posts') ? 'm.post_id' : 'DISTINCT t.topic_id';
|
||||
$sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : '';
|
||||
$field = ($type == 'posts') ? 'm.post_id' : 't.topic_id';
|
||||
|
@ -295,6 +308,7 @@ class fulltext_phpbb extends search_backend
|
|||
$sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : '';
|
||||
$sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : '';
|
||||
$sql_where_options .= (sizeof($ex_fid_ary)) ? ' AND p.forum_id NOT IN (' . implode(',', $ex_fid_ary) . ')' : '';
|
||||
$sql_where_options .= $m_approve_fid_sql;
|
||||
$sql_where_options .= (sizeof($author_ary)) ? ' AND p.poster_id ' . $sql_author : '';
|
||||
$sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
||||
$sql_where_options .= $sql_match;
|
||||
|
@ -438,7 +452,6 @@ class fulltext_phpbb extends search_backend
|
|||
}
|
||||
$sql_where = ($sql_in) ? $sql_where . (($sql_where) ? ' OR ' : '') . 'w.word_text IN (' . $sql_in . ')' : $sql_where;
|
||||
|
||||
$sql_and = (sizeof($result_ary['AND'])) ? "AND $field IN (" . implode(', ', $result_ary['AND']) . ')' : '';
|
||||
$sql = "SELECT $sql_select
|
||||
FROM $sql_from$sql_sort_table" . POSTS_TABLE . ' p, ' . SEARCH_MATCH_TABLE . ' m, ' . SEARCH_WORD_TABLE . " w
|
||||
WHERE ($sql_where)
|
||||
|
@ -486,7 +499,6 @@ class fulltext_phpbb extends search_backend
|
|||
}
|
||||
$sql_where = ($sql_in) ? $sql_where . (($sql_where) ? ' OR ' : '') . 'w.word_text IN (' . $sql_in . ')' : $sql_where;
|
||||
|
||||
$sql_and = "AND $field IN (" . implode(', ', $id_ary) . ')';
|
||||
$sql = "SELECT $sql_select
|
||||
FROM $sql_from" . POSTS_TABLE . ' p, ' . SEARCH_MATCH_TABLE . ' m, ' . SEARCH_WORD_TABLE . " w
|
||||
WHERE ($sql_where)
|
||||
|
@ -532,7 +544,7 @@ class fulltext_phpbb 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, &$topic_id, &$author_ary, &$id_ary, $start, $per_page)
|
||||
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)
|
||||
{
|
||||
global $config, $db;
|
||||
|
||||
|
@ -552,6 +564,7 @@ class fulltext_phpbb extends search_backend
|
|||
$sort_key,
|
||||
$topic_id,
|
||||
implode(',', $ex_fid_ary),
|
||||
implode(',', $m_approve_fid_ary),
|
||||
implode(',', $author_ary)
|
||||
)));
|
||||
|
||||
|
@ -567,8 +580,8 @@ class fulltext_phpbb extends search_backend
|
|||
// Create some display specific sql strings
|
||||
$sql_author = 'p.poster_id ' . ((sizeof($author_ary) > 1) ? 'IN (' . implode(',', $author_ary) . ')' : '= ' . $author_ary[0]);
|
||||
$sql_fora = (sizeof($ex_fid_ary)) ? ' AND p.forum_id NOT IN (' . implode(',', $ex_fid_ary) . ')' : '';
|
||||
$sql_topic_id = (sizeof($ex_fid_ary)) ? ' AND p.forum_id NOT IN (' . implode(',', $ex_fid_ary) . ')' : '';
|
||||
$sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
||||
$sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : '';
|
||||
|
||||
// Build sql strings for sorting
|
||||
$sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC');
|
||||
|
@ -591,6 +604,19 @@ class fulltext_phpbb extends search_backend
|
|||
break;
|
||||
}
|
||||
|
||||
if (!sizeof($m_approve_fid_ary))
|
||||
{
|
||||
$m_approve_fid_sql = ' AND p.post_approved = 1';
|
||||
}
|
||||
else if ($m_approve_fid_ary == array(-1))
|
||||
{
|
||||
$m_approve_fid_sql = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$m_approve_fid_sql = ' AND (p.post_approved = 1 OR p.forum_id IN (' . implode($m_approve_fid_ary) . '))';
|
||||
}
|
||||
|
||||
// If the cache was completely empty count the results
|
||||
if (!$result_count)
|
||||
{
|
||||
|
@ -599,6 +625,8 @@ class fulltext_phpbb extends search_backend
|
|||
$sql = 'SELECT COUNT(p.post_id) as result_count
|
||||
FROM ' . POSTS_TABLE . " p
|
||||
WHERE $sql_author
|
||||
$sql_topic_id
|
||||
$m_approve_fid_sql
|
||||
$sql_fora
|
||||
$sql_time";
|
||||
}
|
||||
|
@ -607,6 +635,8 @@ class fulltext_phpbb extends search_backend
|
|||
$sql = 'SELECT COUNT(DISTINCT t.topic_id) as result_count
|
||||
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
||||
WHERE $sql_author
|
||||
$sql_topic_id
|
||||
$m_approve_fid_sql
|
||||
$sql_fora
|
||||
AND t.topic_id = p.topic_id
|
||||
$sql_time";
|
||||
|
@ -624,8 +654,10 @@ class fulltext_phpbb extends search_backend
|
|||
if ($type == 'posts')
|
||||
{
|
||||
$sql = 'SELECT p.post_id
|
||||
FROM ' . $sql_sort_table . POSTS_TABLE . " p
|
||||
FROM ' . $sql_sort_table . POSTS_TABLE . ' p' . (($topic_id) ? ', ' . TOPICS_TABLE . ' t' : '') . "
|
||||
WHERE $sql_author
|
||||
$sql_topic_id
|
||||
$m_approve_fid_sql
|
||||
$sql_fora
|
||||
$sql_sort_join
|
||||
$sql_time
|
||||
|
@ -637,6 +669,8 @@ class fulltext_phpbb extends search_backend
|
|||
$sql = 'SELECT t.topic_id
|
||||
FROM ' . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p
|
||||
WHERE $sql_author
|
||||
$sql_topic_id
|
||||
$m_approve_fid_sql
|
||||
$sql_fora
|
||||
AND t.topic_id = p.topic_id
|
||||
$sql_sort_join
|
||||
|
|
|
@ -211,7 +211,7 @@ class search_backend
|
|||
}
|
||||
else
|
||||
{
|
||||
// we use one set of resuts for both sort directions so we have to calculate the indizes
|
||||
// we use one set of results for both sort directions so we have to calculate the indizes
|
||||
// for the reversed array and we also have to reverse the ids themselves
|
||||
if ($store[-2] != $sort_dir)
|
||||
{
|
||||
|
@ -230,6 +230,29 @@ class search_backend
|
|||
if (is_array($store_ids))
|
||||
{
|
||||
$store += $store_ids;
|
||||
|
||||
// if the cache is too big
|
||||
if (sizeof($store) - 2 > 20 * $config['search_block_size'])
|
||||
{
|
||||
// remove everything in front of two blocks in front of the current start index
|
||||
for ($i = 0, $n = $id_range[0] - 2 * $config['search_block_size']; $i < $n; $i++)
|
||||
{
|
||||
if (isset($store[$i]))
|
||||
{
|
||||
unset($store[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
// remove everything after two blocks after the current stop index
|
||||
end($id_range);
|
||||
for ($i = $store[-1] - 1, $n = current($id_range) + 2 * $config['search_block_size']; $i > $n; $i--)
|
||||
{
|
||||
if (isset($store[$i]))
|
||||
{
|
||||
unset($store[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$cache->put('_search_results_' . $search_key, $store, $config['search_store_results']);
|
||||
|
||||
$sql = 'UPDATE ' . SEARCH_TABLE . '
|
||||
|
|
|
@ -126,6 +126,23 @@ if ($keywords || $author || $search_id)
|
|||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// find out in which forums the user is allowed to view approved posts
|
||||
if ($auth->acl_get('m_approve'))
|
||||
{
|
||||
$m_approve_fid_ary = array(-1);
|
||||
$m_approve_fid_sql = '';
|
||||
}
|
||||
else if ($auth->acl_getf_global('m_approve'))
|
||||
{
|
||||
$m_approve_fid_ary = array_diff(array_keys($auth->acl_getf('!m_approve', true)), $ex_fid_ary);
|
||||
$m_approve_fid_sql = ' AND (p.post_approved = 1 OR p.forum_id NOT IN (' . implode(', ', $m_approve_fid_ary) . '))';
|
||||
}
|
||||
else
|
||||
{
|
||||
$m_approve_fid_ary = array();
|
||||
$m_approve_fid_sql = ' AND p.post_approved = 1';
|
||||
}
|
||||
|
||||
if ($reset_search_forum)
|
||||
{
|
||||
$search_forum = array();
|
||||
|
@ -249,6 +266,7 @@ if ($keywords || $author || $search_id)
|
|||
FROM ' . POSTS_TABLE . ' p
|
||||
LEFT JOIN ' . TOPICS_TABLE . " t ON (t.topic_approved = 1 AND p.topic_id = t.topic_id)
|
||||
WHERE p.post_time > $last_post_time
|
||||
$m_approve_fid_sql
|
||||
" . ((sizeof($ex_fid_ary)) ? ' AND p.forum_id NOT IN (' . implode(',', $ex_fid_ary) . ')' : '') . '
|
||||
ORDER BY t.topic_last_post_time DESC';
|
||||
$field = 'topic_id';
|
||||
|
@ -272,6 +290,7 @@ if ($keywords || $author || $search_id)
|
|||
FROM $sort_join" . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t
|
||||
WHERE t.topic_replies = 0
|
||||
AND p.topic_id = t.topic_id
|
||||
$m_approve_fid_sql
|
||||
" . ((sizeof($ex_fid_ary)) ? ' AND p.forum_id NOT IN (' . implode(',', $ex_fid_ary) . ')' : '') . "
|
||||
$sql_sort";
|
||||
$field = 'post_id';
|
||||
|
@ -282,6 +301,7 @@ if ($keywords || $author || $search_id)
|
|||
FROM $sort_join" . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t
|
||||
WHERE t.topic_replies = 0
|
||||
AND p.topic_id = t.topic_id
|
||||
$m_approve_fid_sql
|
||||
" . ((sizeof($ex_fid_ary)) ? ' AND p.forum_id NOT IN (' . implode(',', $ex_fid_ary) . ')' : '') . "
|
||||
$sql_sort";
|
||||
$field = 'topic_id';
|
||||
|
@ -311,6 +331,7 @@ if ($keywords || $author || $search_id)
|
|||
$sql = "SELECT p.post_id
|
||||
FROM $sort_join" . POSTS_TABLE . ' p
|
||||
WHERE p.post_time > ' . $user->data['user_lastvisit'] . "
|
||||
$m_approve_fid_sql
|
||||
" . ((sizeof($ex_fid_ary)) ? ' AND p.forum_id NOT IN (' . implode(',', $ex_fid_ary) . ')' : '') . "
|
||||
$sql_sort";
|
||||
$field = 'post_id';
|
||||
|
@ -321,6 +342,7 @@ if ($keywords || $author || $search_id)
|
|||
FROM $sort_join" . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
|
||||
WHERE p.post_time > ' . $user->data['user_lastvisit'] . "
|
||||
AND t.topic_id = p.topic_id
|
||||
$m_approve_fid_sql
|
||||
" . ((sizeof($ex_fid_ary)) ? ' AND p.forum_id NOT IN (' . implode(',', $ex_fid_ary) . ')' : '') . "
|
||||
$sql_sort";
|
||||
$field = 'topic_id';
|
||||
|
@ -350,11 +372,11 @@ if ($keywords || $author || $search_id)
|
|||
|
||||
if (sizeof($search->split_words))
|
||||
{
|
||||
$total_match_count = $search->keyword_search($show_results, $search_fields, $search_terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $topic_id, $author_id_ary, $id_ary, $start, $per_page);
|
||||
$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, $id_ary, $start, $per_page);
|
||||
}
|
||||
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, $topic_id, $author_id_ary, $id_ary, $start, $per_page);
|
||||
$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);
|
||||
}
|
||||
|
||||
if (!sizeof($id_ary))
|
||||
|
@ -364,6 +386,7 @@ if ($keywords || $author || $search_id)
|
|||
|
||||
$sql_where = (($show_results == 'posts') ? 'p.post_id' : 't.topic_id') . ' IN (' . implode(', ', $id_ary) . ')';
|
||||
$sql_where .= (sizeof($ex_fid_ary)) ? ' AND (f.forum_id NOT IN (' . implode(',', $ex_fid_ary) . ') OR f.forum_id IS NULL)' : '';
|
||||
$sql_where .= ($show_results == 'posts') ? $m_approve_fid_sql : str_replace(array('p.post_approved', 'p.forum_id'), array('t.topic_approved', 't.forum_id'), $m_approve_fid_sql);
|
||||
|
||||
if ($show_results == 'posts')
|
||||
{
|
||||
|
@ -424,9 +447,10 @@ if ($keywords || $author || $search_id)
|
|||
'S_SEARCH_ACTION' => $u_search,
|
||||
'S_SHOW_TOPICS' => ($show_results == 'posts') ? false : true,
|
||||
|
||||
'GOTO_PAGE_IMG' => $user->img('icon_post', 'GOTO_PAGE'),
|
||||
'NEWEST_POST_IMG' => $user->img('icon_post_newest', 'VIEW_NEWEST_POST'),
|
||||
'REPORTED_IMG' => $user->img('icon_reported', 'TOPIC_REPORTED'),
|
||||
'UNAPPROVED_IMG' => $user->img('icon_unapproved', 'TOPIC_UNAPPROVED'),
|
||||
'GOTO_PAGE_IMG' => $user->img('icon_post', 'GOTO_PAGE'),
|
||||
|
||||
'U_SEARCH_WORDS' => "{$phpbb_root_path}search.$phpEx$SID$u_show_results&keywords=$u_hilit" . (($author) ? '&author=' . urlencode($author) : ''))
|
||||
);
|
||||
|
@ -567,6 +591,8 @@ if ($keywords || $author || $search_id)
|
|||
$folder_img = $folder_alt = $topic_type = '';
|
||||
topic_status($row, $replies, (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false, $folder_img, $folder_alt, $topic_type);
|
||||
|
||||
$unread_topic = (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false;
|
||||
|
||||
$tpl_ary = array(
|
||||
'TOPIC_AUTHOR' => topic_topic_author($row),
|
||||
'FIRST_POST_TIME' => $user->format_date($row['topic_time']),
|
||||
|
@ -589,12 +615,14 @@ if ($keywords || $author || $search_id)
|
|||
'S_TOPIC_GLOBAL' => (!$forum_id) ? true : false,
|
||||
'S_TOPIC_TYPE' => $row['topic_type'],
|
||||
'S_USER_POSTED' => (!empty($row['mark_type'])) ? true : false,
|
||||
'S_UNREAD_TOPIC' => $unread_topic,
|
||||
|
||||
'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_gets('m_', $forum_id)) ? true : false,
|
||||
'S_TOPIC_UNAPPROVED' => (!$row['topic_approved'] && $auth->acl_gets('m_approve', $forum_id)) ? true : false,
|
||||
|
||||
'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],
|
||||
'U_LAST_POST_AUTHOR'=> ($row['topic_last_poster_id'] != ANONYMOUS && $row['topic_last_poster_id']) ? "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u={$row['topic_last_poster_id']}" : '',
|
||||
'U_NEWEST_POST' => $view_topic_url . '&view=unread#unread',
|
||||
'U_MCP_REPORT' => "{$phpbb_root_path}mcp.$phpEx?sid={$user->session_id}&mode=reports&t=$result_topic_id",
|
||||
'U_MCP_QUEUE' => "{$phpbb_root_path}mcp.$phpEx?sid={$user->session_id}&i=queue&mode=approve_details&t=$result_topic_id"
|
||||
);
|
||||
|
|
|
@ -36,13 +36,14 @@
|
|||
<!-- ENDIF -->
|
||||
</td>
|
||||
<td class="row1">
|
||||
<!-- IF searchresults.S_UNREAD_TOPIC --><a href="{searchresults.U_NEWEST_POST}">{NEWEST_POST_IMG}</a><!-- ENDIF -->
|
||||
{topicrow.ATTACH_ICON_IMG} <a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a>
|
||||
<!-- IF searchresults.S_TOPIC_UNAPPROVED -->
|
||||
<a href="{topicrow.U_MCP_QUEUE}">{UNAPPROVED_IMG}</a>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF searchresults.S_TOPIC_REPORTED -->
|
||||
<a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a>
|
||||
<!-- ENDIF -->
|
||||
<p class="topictitle"> {topicrow.ATTACH_ICON_IMG} <a href="{searchresults.U_VIEW_TOPIC}">{searchresults.TOPIC_TITLE}</a></p>
|
||||
<!-- IF searchresults.PAGINATION -->
|
||||
<p class="gensmall"> [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}: {searchresults.PAGINATION} ] </p>
|
||||
<!-- ENDIF -->
|
||||
|
|
|
@ -42,8 +42,8 @@
|
|||
<td class="row1" width="25" align="center"><!-- IF topicrow.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}" width="{topicrow.TOPIC_ICON_IMG_WIDTH}" height="{topicrow.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /><!-- ENDIF --></td>
|
||||
<!-- ENDIF -->
|
||||
<td class="row1">
|
||||
<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF -->{topicrow.ATTACH_ICON_IMG}
|
||||
<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
|
||||
<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a><!-- ENDIF -->
|
||||
{topicrow.ATTACH_ICON_IMG} <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
|
||||
<!-- IF topicrow.S_TOPIC_UNAPPROVED -->
|
||||
<a href="{topicrow.U_MCP_QUEUE}">{UNAPPROVED_IMG}</a>
|
||||
<!-- ENDIF -->
|
||||
|
@ -162,8 +162,8 @@
|
|||
<td class="row1" width="25" align="center"><!-- IF topicrow.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}" width="{topicrow.TOPIC_ICON_IMG_WIDTH}" height="{topicrow.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /><!-- ENDIF --></td>
|
||||
<!-- ENDIF -->
|
||||
<td class="row1">
|
||||
<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF -->{topicrow.ATTACH_ICON_IMG}
|
||||
<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></p>
|
||||
<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a><!-- ENDIF -->
|
||||
{topicrow.ATTACH_ICON_IMG} <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
|
||||
<!-- IF topicrow.S_TOPIC_UNAPPROVED -->
|
||||
<a href="{topicrow.U_MCP_QUEUE}">{UNAPPROVED_IMG}</a>
|
||||
<!-- ENDIF -->
|
||||
|
|
Loading…
Add table
Reference in a new issue