mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-24 04:08:51 +00:00
Merge branch 'ticket/rxu/9851' into develop-olympus
* ticket/rxu/9851: [ticket/9851] "Search new posts" should require login.
This commit is contained in:
commit
2c25a4bbb2
2 changed files with 35 additions and 22 deletions
|
@ -54,6 +54,7 @@ $lang = array_merge($lang, array(
|
||||||
|
|
||||||
'LOGIN_EXPLAIN_EGOSEARCH' => 'The board requires you to be registered and logged in to view your own posts.',
|
'LOGIN_EXPLAIN_EGOSEARCH' => 'The board requires you to be registered and logged in to view your own posts.',
|
||||||
'LOGIN_EXPLAIN_UNREADSEARCH'=> 'The board requires you to be registered and logged in to view your unread posts.',
|
'LOGIN_EXPLAIN_UNREADSEARCH'=> 'The board requires you to be registered and logged in to view your unread posts.',
|
||||||
|
'LOGIN_EXPLAIN_NEWPOSTS' => 'The board requires you to be registered and logged in to view new posts since your last visit.',
|
||||||
|
|
||||||
'MAX_NUM_SEARCH_KEYWORDS_REFINE' => 'You specified too many words to search for. Please do not enter more than %1$d words.',
|
'MAX_NUM_SEARCH_KEYWORDS_REFINE' => 'You specified too many words to search for. Please do not enter more than %1$d words.',
|
||||||
|
|
||||||
|
|
|
@ -47,23 +47,22 @@ $sort_dir = request_var('sd', 'd');
|
||||||
$return_chars = request_var('ch', ($topic_id) ? -1 : 300);
|
$return_chars = request_var('ch', ($topic_id) ? -1 : 300);
|
||||||
$search_forum = request_var('fid', array(0));
|
$search_forum = request_var('fid', array(0));
|
||||||
|
|
||||||
// We put login boxes for the case if search_id is egosearch or unreadposts
|
// We put login boxes for the case if search_id is newposts, egosearch or unreadposts
|
||||||
// because a guest should be able to log in even if guests search is not permitted
|
// because a guest should be able to log in even if guests search is not permitted
|
||||||
|
|
||||||
// Egosearch is an author search
|
switch ($search_id)
|
||||||
if ($search_id == 'egosearch')
|
|
||||||
{
|
{
|
||||||
|
// Egosearch is an author search
|
||||||
|
case 'egosearch':
|
||||||
$author_id = $user->data['user_id'];
|
$author_id = $user->data['user_id'];
|
||||||
|
|
||||||
if ($user->data['user_id'] == ANONYMOUS)
|
if ($user->data['user_id'] == ANONYMOUS)
|
||||||
{
|
{
|
||||||
login_box('', $user->lang['LOGIN_EXPLAIN_EGOSEARCH']);
|
login_box('', $user->lang['LOGIN_EXPLAIN_EGOSEARCH']);
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
|
|
||||||
// Search for unread posts needs to be allowed and user to be logged in if topics tracking for guests is disabled
|
// Search for unread posts needs to be allowed and user to be logged in if topics tracking for guests is disabled
|
||||||
if ($search_id == 'unreadposts')
|
case 'unreadposts':
|
||||||
{
|
|
||||||
if (!$config['load_unreads_search'])
|
if (!$config['load_unreads_search'])
|
||||||
{
|
{
|
||||||
$template->assign_var('S_NO_SEARCH', true);
|
$template->assign_var('S_NO_SEARCH', true);
|
||||||
|
@ -73,6 +72,19 @@ if ($search_id == 'unreadposts')
|
||||||
{
|
{
|
||||||
login_box('', $user->lang['LOGIN_EXPLAIN_UNREADSEARCH']);
|
login_box('', $user->lang['LOGIN_EXPLAIN_UNREADSEARCH']);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// The "new posts" search uses user_lastvisit which is user based, so it should require user to log in.
|
||||||
|
case 'newposts':
|
||||||
|
if ($user->data['user_id'] == ANONYMOUS)
|
||||||
|
{
|
||||||
|
login_box('', $user->lang['LOGIN_EXPLAIN_NEWPOSTS']);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// There's nothing to do here for now ;)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is user able to search? Has search been disabled?
|
// Is user able to search? Has search been disabled?
|
||||||
|
|
Loading…
Add table
Reference in a new issue