Merge branch 'develop-olympus' into develop

* develop-olympus:
  [ticket/9609] Change header() calls setting HTTP status to send_status_line().
  [ticket/9613] Slightly update language strings.
  [ticket/9613] Fix missing database part for unread posts search load switch.
  [ticket/9613] Implement a load switch for unread posts search feature.
  [ticket/9785] Allow users to request new passwords when board is disabled.
  [ticket/9644] Check $mode before calling user_notification() from submit_post()
This commit is contained in:
Igor Wiedler 2010-09-16 22:42:32 +02:00
commit e35711ddde
13 changed files with 38 additions and 20 deletions

View file

@ -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');
}
}

View file

@ -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_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),

View file

@ -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');
}
@ -4465,6 +4466,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',

View file

@ -2584,7 +2584,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']);
}

View file

@ -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');
}

View file

@ -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;
}

View file

@ -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');

View file

@ -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_UNREAD_SEARCH' => 'Enable search for unread posts',
));
// Auth settings

View file

@ -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 searching for unread posts has been disabled on this board.',
'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.',

View file

@ -61,11 +61,19 @@ 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')
{
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?
if (!$auth->acl_get('u_search') || !$auth->acl_getf_global('f_search') || !$config['load_search'])

View file

@ -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>

View file

@ -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 -->

View file

@ -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);
}