From 95e0340daf8ef9cc5426e4b61a7b292ae57443e6 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 23 Jul 2010 20:30:21 +0200 Subject: [PATCH 1/6] [ticket/9644] Check $mode before calling user_notification() from submit_post() PHPBB3-9644 --- phpBB/includes/functions_posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index f6f90575d4..919412dd67 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -2583,7 +2583,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } // Send Notifications - if ($mode != 'edit' && $mode != 'delete' && $post_approval) + if (($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_approval) { user_notification($mode, $subject, $data['topic_title'], $data['forum_name'], $data['forum_id'], $data['topic_id'], $data['post_id']); } From 889eace41c6221ece47256dde94f8ca99affc4a0 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 22 Aug 2010 20:26:18 +0200 Subject: [PATCH 2/6] [ticket/9785] Allow users to request new passwords when board is disabled. PHPBB3-9785 --- phpBB/ucp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/ucp.php b/phpBB/ucp.php index 994fe064a1..f5a2ec9648 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -22,7 +22,7 @@ require($phpbb_root_path . 'includes/functions_module.' . $phpEx); $id = request_var('i', ''); $mode = request_var('mode', ''); -if ($mode == 'login' || $mode == 'logout' || $mode == 'confirm') +if (in_array($mode, array('login', 'logout', 'confirm', 'sendpassword', 'activate'))) { define('IN_LOGIN', true); } From f1d50057975695137d44f5f4b4c035e70d878657 Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 17 May 2010 22:50:03 +0800 Subject: [PATCH 3/6] [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 --- phpBB/includes/acp/acp_board.php | 1 + phpBB/includes/functions.php | 2 ++ phpBB/language/en/acp/board.php | 1 + phpBB/language/en/search.php | 1 + phpBB/search.php | 14 +++++++++++--- phpBB/styles/prosilver/template/index_body.html | 2 +- .../styles/subsilver2/template/overall_header.html | 2 +- 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 %s is not contained in any post.', 'WORDS_IN_NO_POST' => 'No posts were found because the words %s 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 @@ 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) From b83163634f98de0e76e5332c1e4511dbc1483e56 Mon Sep 17 00:00:00 2001 From: rxu Date: Sat, 21 Aug 2010 01:26:23 +0800 Subject: [PATCH 4/6] [ticket/9613] Fix missing database part for unread posts search load switch. A record for load_unreads_search parameter had to be added to CONFIG_TABLE. PHPBB3-9613 --- phpBB/install/database_update.php | 3 +++ phpBB/install/schemas/schema_data.sql | 1 + 2 files changed, 4 insertions(+) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index fec09f89db..a5457c722f 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1795,6 +1795,9 @@ function change_database_data(&$no_updates, $version) // Sync the forums we have deleted shadow topics from. sync('forum', 'forum_id', $sync_forum_ids, true, true); + // Unread posts search load switch + set_config('load_unreads_search', '1'); + $no_updates = false; break; } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index e815615eef..a25b68ba39 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -168,6 +168,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_online_time', INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_onlinetrack', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_search', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_tplcompile', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_unreads_search', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_user_activity', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_attachments', '3'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_attachments_pm', '1'); From f9764c684ffb147a07cff472c82789b142845481 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 29 Aug 2010 16:50:57 +0200 Subject: [PATCH 5/6] [ticket/9613] Slightly update language strings. PHPBB3-9613 --- phpBB/includes/acp/acp_board.php | 2 +- phpBB/language/en/acp/board.php | 2 +- phpBB/language/en/search.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index ba3d5b58f7..a5e80e1f6d 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -319,7 +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_unreads_search' => array('lang' => 'YES_UNREAD_SEARCH', '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/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 9fb02f629f..77deba6e19 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -375,7 +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', + 'YES_UNREAD_SEARCH' => 'Enable search for unread posts', )); // Auth settings diff --git a/phpBB/language/en/search.php b/phpBB/language/en/search.php index 67b21edba8..d93fe6b56a 100644 --- a/phpBB/language/en/search.php +++ b/phpBB/language/en/search.php @@ -62,7 +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.', + 'NO_SEARCH_UNREADS' => 'Sorry but searching for unread posts has been disabled on this board.', 'WORD_IN_NO_POST' => 'No posts were found because the word %s is not contained in any post.', 'WORDS_IN_NO_POST' => 'No posts were found because the words %s are not contained in any post.', From bef108a5cc1cc80068f7066b5c18c5631b8dbc32 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 11 Sep 2010 21:55:11 +0200 Subject: [PATCH 6/6] [ticket/9609] Change header() calls setting HTTP status to send_status_line(). PHPBB3-9609 --- phpBB/download/file.php | 14 +++++++------- phpBB/includes/functions.php | 7 ++++--- phpBB/includes/session.php | 6 +++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 1f2cee4d95..5f45b88359 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -77,7 +77,7 @@ if (isset($_GET['avatar'])) // '==' is not a bug - . as the first char is as bad as no dot at all if (strpos($filename, '.') == false) { - header('HTTP/1.0 403 Forbidden'); + send_status_line(403, 'Forbidden'); $exit = true; } @@ -91,7 +91,7 @@ if (isset($_GET['avatar'])) if (!$exit && !in_array($ext, array('png', 'gif', 'jpg', 'jpeg'))) { // no way such an avatar could exist. They are not following the rules, stop the show. - header("HTTP/1.0 403 Forbidden"); + send_status_line(403, 'Forbidden'); $exit = true; } @@ -101,7 +101,7 @@ if (isset($_GET['avatar'])) if (!$filename) { // no way such an avatar could exist. They are not following the rules, stop the show. - header("HTTP/1.0 403 Forbidden"); + send_status_line(403, 'Forbidden'); } else { @@ -199,7 +199,7 @@ else $row['forum_id'] = false; if (!$auth->acl_get('u_pm_download')) { - header('HTTP/1.0 403 Forbidden'); + send_status_line(403, 'Forbidden'); trigger_error('SORRY_AUTH_VIEW_ATTACH'); } @@ -222,7 +222,7 @@ else if (!$allowed) { - header('HTTP/1.0 403 Forbidden'); + send_status_line(403, 'Forbidden'); trigger_error('ERROR_NO_ATTACHMENT'); } } @@ -237,7 +237,7 @@ else if (!download_allowed()) { - header('HTTP/1.0 403 Forbidden'); + send_status_line(403, 'Forbidden'); trigger_error($user->lang['LINKAGE_FORBIDDEN']); } @@ -383,7 +383,7 @@ function send_avatar_to_browser($file, $browser) } else { - header('HTTP/1.0 404 Not Found'); + send_status_line(404, 'Not Found'); } } diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index c4ff998e69..91edddf5d2 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3753,7 +3753,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) } // Do not send 200 OK, but service unavailable on errors - header('HTTP/1.1 503 Service Unavailable'); + send_status_line(503, 'Service Unavailable'); garbage_collection(); @@ -4223,7 +4223,8 @@ function phpbb_http_login($param) } else if ($auth_result['status'] == LOGIN_ERROR_ATTEMPTS) { - header('HTTP/1.0 401 Unauthorized'); + send_status_line(401, 'Unauthorized'); + trigger_error('NOT_AUTHORISED'); } } @@ -4235,7 +4236,7 @@ function phpbb_http_login($param) $param['auth_message'] = preg_replace('/[\x80-\xFF]/', '?', $param['auth_message']); header('WWW-Authenticate: Basic realm="' . $param['auth_message'] . '"'); - header('HTTP/1.0 401 Unauthorized'); + send_status_line(401, 'Unauthorized'); trigger_error('NOT_AUTHORISED'); } diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 79023cc7bc..aa2293c630 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -748,7 +748,7 @@ class session if ((int) $row['sessions'] > (int) $config['active_sessions']) { - header('HTTP/1.1 503 Service Unavailable'); + send_status_line(503, 'Service Unavailable'); trigger_error('BOARD_UNAVAILABLE'); } } @@ -1821,7 +1821,7 @@ class user extends session { if ($this->data['is_bot']) { - header('HTTP/1.1 503 Service Unavailable'); + send_status_line(503, 'Service Unavailable'); } $message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE'; @@ -1840,7 +1840,7 @@ class user extends session { if ($this->data['is_bot']) { - header('HTTP/1.1 503 Service Unavailable'); + send_status_line(503, 'Service Unavailable'); } trigger_error('BOARD_UNAVAILABLE'); }