aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrxu <rxu@mail.ru>2010-05-17 22:50:03 +0800
committerAndreas Fischer <bantu@phpbb.com>2010-08-29 16:09:09 +0200
commitf1d50057975695137d44f5f4b4c035e70d878657 (patch)
tree2976dd4bc9f52434a71175ce321ae1c4ac54edc9
parentdbe8fb6488005c3295f839c7302a56f1de872426 (diff)
downloadforums-f1d50057975695137d44f5f4b4c035e70d878657.tar
forums-f1d50057975695137d44f5f4b4c035e70d878657.tar.gz
forums-f1d50057975695137d44f5f4b4c035e70d878657.tar.bz2
forums-f1d50057975695137d44f5f4b4c035e70d878657.tar.xz
forums-f1d50057975695137d44f5f4b4c035e70d878657.zip
[ticket/9613] Implement a load switch for unread posts search feature.
Since unread posts search can produce a high server load in certain circumstances, we implement a switch for ACP "Load settings" to have an option to disable this type of search. PHPBB3-9613
-rw-r--r--phpBB/includes/acp/acp_board.php1
-rw-r--r--phpBB/includes/functions.php2
-rw-r--r--phpBB/language/en/acp/board.php1
-rw-r--r--phpBB/language/en/search.php1
-rw-r--r--phpBB/search.php14
-rw-r--r--phpBB/styles/prosilver/template/index_body.html2
-rw-r--r--phpBB/styles/subsilver2/template/overall_header.html2
7 files changed, 18 insertions, 5 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 927e72010e..ba3d5b58f7 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -319,6 +319,7 @@ class acp_board
'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'load_unreads_search' => array('lang' => 'YES_UNREADS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index c4ff998e69..efa835574d 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -4465,6 +4465,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'S_ENABLE_FEEDS_TOPICS_ACTIVE' => ($config['feed_topics_active']) ? true : false,
'S_ENABLE_FEEDS_NEWS' => ($s_feed_news) ? true : false,
+ 'S_LOAD_UNREADS' => ($config['load_unreads_search']) ? true : false,
+
'T_THEME_PATH' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme',
'T_TEMPLATE_PATH' => "{$web_path}styles/" . $user->theme['template_path'] . '/template',
'T_SUPER_TEMPLATE_PATH' => (isset($user->theme['template_inherit_path']) && $user->theme['template_inherit_path']) ? "{$web_path}styles/" . $user->theme['template_inherit_path'] . '/template' : "{$web_path}styles/" . $user->theme['template_path'] . '/template',
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index ac0ddf1b73..9fb02f629f 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -375,6 +375,7 @@ $lang = array_merge($lang, array(
'YES_POST_MARKING_EXPLAIN' => 'Indicates whether user has posted to a topic.',
'YES_READ_MARKING' => 'Enable server-side topic marking',
'YES_READ_MARKING_EXPLAIN' => 'Stores read/unread status information in the database rather than a cookie.',
+ 'YES_UNREADS' => 'Enable search of unread posts',
));
// Auth settings
diff --git a/phpBB/language/en/search.php b/phpBB/language/en/search.php
index be92391a4e..67b21edba8 100644
--- a/phpBB/language/en/search.php
+++ b/phpBB/language/en/search.php
@@ -62,6 +62,7 @@ $lang = array_merge($lang, array(
'NO_SEARCH' => 'Sorry but you are not permitted to use the search system.',
'NO_SEARCH_RESULTS' => 'No suitable matches were found.',
'NO_SEARCH_TIME' => 'Sorry but you cannot use search at this time. Please try again in a few minutes.',
+ 'NO_SEARCH_UNREADS' => 'Sorry but search for unread posts is not permitted.',
'WORD_IN_NO_POST' => 'No posts were found because the word <strong>%s</strong> is not contained in any post.',
'WORDS_IN_NO_POST' => 'No posts were found because the words <strong>%s</strong> are not contained in any post.',
diff --git a/phpBB/search.php b/phpBB/search.php
index 1e1e42d01f..9952f5c744 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -61,10 +61,18 @@ if ($search_id == 'egosearch')
}
}
-// Search for unread posts needs user to be logged in if topics tracking for guests is disabled
-if ($search_id == 'unreadposts' && !$config['load_anon_lastread'] && !$user->data['is_registered'])
+// 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')
{
- login_box('', $user->lang['LOGIN_EXPLAIN_UNREADSEARCH']);
+ if (!$config['load_unreads_search'])
+ {
+ $template->assign_var('S_NO_SEARCH', true);
+ trigger_error('NO_SEARCH_UNREADS');
+ }
+ else if (!$config['load_anon_lastread'] && !$user->data['is_registered'])
+ {
+ login_box('', $user->lang['LOGIN_EXPLAIN_UNREADSEARCH']);
+ }
}
// Is user able to search? Has search been disabled?
diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html
index 17790eb78a..af2077141c 100644
--- a/phpBB/styles/prosilver/template/index_body.html
+++ b/phpBB/styles/prosilver/template/index_body.html
@@ -6,7 +6,7 @@
<!-- IF S_DISPLAY_SEARCH or (S_USER_LOGGED_IN and not S_IS_BOT) -->
<ul class="linklist">
<!-- IF S_DISPLAY_SEARCH -->
- <li><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a><!-- IF S_USER_LOGGED_IN --> &bull; <a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a> &bull; <a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a><!-- ENDIF --> &bull; <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></li>
+ <li><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a><!-- IF S_USER_LOGGED_IN --><!-- IF S_LOAD_UNREADS --> &bull; <a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a><!-- ENDIF --> &bull; <a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a><!-- ENDIF --> &bull; <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></li>
<!-- ENDIF -->
<!-- IF not S_IS_BOT and U_MARK_FORUMS --><li class="rightside"><a href="{U_MARK_FORUMS}" accesskey="m">{L_MARK_FORUMS_READ}</a></li><!-- ENDIF -->
</ul>
diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html
index 963f5160dd..37691d4f1c 100644
--- a/phpBB/styles/subsilver2/template/overall_header.html
+++ b/phpBB/styles/subsilver2/template/overall_header.html
@@ -202,7 +202,7 @@ function marklist(id, name, state)
<p class="searchbar">
<span style="float: {S_CONTENT_FLOW_BEGIN};"><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a> | <a href="{U_SEARCH_ACTIVE_TOPICS}">{L_SEARCH_ACTIVE_TOPICS}</a></span>
<!-- IF S_USER_LOGGED_IN -->
- <span style="float: {S_CONTENT_FLOW_END};"><a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a> | <a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a> | <a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a></span>
+ <span style="float: {S_CONTENT_FLOW_END};"><!-- IF S_LOAD_UNREADS --><a href="{U_SEARCH_UNREAD}">{L_SEARCH_UNREAD}</a> | <!-- ENDIF --><a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a> | <a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a></span>
<!-- ENDIF -->
</p>
<!-- ENDIF -->