diff options
author | Ruslan Uzdenov <rxu@mail.ru> | 2009-07-14 14:46:38 +0000 |
---|---|---|
committer | Ruslan Uzdenov <rxu@mail.ru> | 2009-07-14 14:46:38 +0000 |
commit | 51748b00ed8e6b709f1a7df59570e8ecee6783d5 (patch) | |
tree | 9dd01ff6e3e6dbf949eb84f931a7ff6276b7dfde /phpBB/search.php | |
parent | 5cbf5d4b16a41ea2599cb7f56836d5b963ab4000 (diff) | |
download | forums-51748b00ed8e6b709f1a7df59570e8ecee6783d5.tar forums-51748b00ed8e6b709f1a7df59570e8ecee6783d5.tar.gz forums-51748b00ed8e6b709f1a7df59570e8ecee6783d5.tar.bz2 forums-51748b00ed8e6b709f1a7df59570e8ecee6783d5.tar.xz forums-51748b00ed8e6b709f1a7df59570e8ecee6783d5.zip |
Fix bug #46765 - View unread posts
Authorised by: AcydBurn
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9755 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/search.php')
-rw-r--r-- | phpBB/search.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/phpBB/search.php b/phpBB/search.php index 48c0290d87..61aa16a6fb 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -364,6 +364,39 @@ if ($keywords || $author || $author_id || $search_id || $submit) } break; + case 'unreadposts': + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $l_search_title = $user->lang['SEARCH_UNREAD']; + // force sorting + $show_results = 'topics'; + $sort_key = 't'; + $sort_dir = 'd'; + $sort_by_sql['t'] = 't.topic_last_post_time'; + $sql_sort = 'ORDER BY ' . $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + $s_sort_key = $s_sort_dir = $u_sort_param = $s_limit_days = ''; + + $unread_list = array(); + $unread_list = get_unread_topics_list(); + + if(!empty($unread_list)) + { + $sql = 'SELECT t.topic_id + FROM ' . TOPICS_TABLE . ' t + WHERE ' . $db->sql_in_set('t.topic_id', array_keys($unread_list)) . ' + AND t.topic_moved_id = 0 + ' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . ' + ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " + $sql_sort"; + $field = 'topic_id'; + } + break; + } + // Do nothing if it's cookie based read tracking + // Just do not break and let user to see newposts + case 'newposts': $l_search_title = $user->lang['SEARCH_NEW']; // force sorting |