1
0
mirror of https://github.com/e107inc/e107.git synced 2025-05-03 02:38:06 +02:00

Forum #295 Preparations for thread/topic filtering.

This commit is contained in:
Cameron 2016-05-22 11:58:27 -07:00
parent e15469e806
commit 00c640626d
3 changed files with 19 additions and 4 deletions

View File

@ -74,9 +74,9 @@ class forum_url // plugin-folder + '_url'
*/
$config['forum'] = array(
'regex' => '^forum/(.*)$',
'regex' => '^forum/([^\/]*)/?\??([^\/]*)?$',
'sef' => 'forum/{forum_sef}',
'redirect' => '{e_PLUGIN}forum/forum_viewforum.php?sef=$1',
'redirect' => '{e_PLUGIN}forum/forum_viewforum.php?sef=$1&$2',
'legacy' => '{e_PLUGIN}forum/forum_viewforum.php?id={forum_id}'
);

View File

@ -1818,7 +1818,7 @@ class e107forum
* @param $view
* @return array
*/
function forumGetThreads($forumId, $from, $view)
function forumGetThreads($forumId, $from, $view, $filter = null)
{
$e107 = e107::getInstance();
$sql = e107::getDb();
@ -1830,6 +1830,14 @@ class e107forum
LEFT JOIN `#user` AS u ON t.thread_user = u.user_id
LEFT JOIN `#user` AS lpu ON t.thread_lastuser = lpu.user_id
WHERE t.thread_forum_id = {$forumId}
";
if(!empty($filter))
{
$qry .= " AND ".$filter;
}
$qry .= "
GROUP BY thread_id
ORDER BY
t.thread_sticky DESC,

View File

@ -439,7 +439,14 @@ $stuck = false;
$reg_threads = 0;
$unstuck = false;
$threadList = $forum->forumGetThreads($forumId, $threadFrom, $view);
$threadFilter = null;
if(!empty($_GET['srch']))
{
$threadFilter = "t.thread_name LIKE '%".$tp->filter($_GET['srch'])."%'";
}
$threadList = $forum->forumGetThreads($forumId, $threadFrom, $view, $threadFilter);
$subList = $forum->forumGetSubs(vartrue($forum_id));
$gen = new convert;