diff options
-rw-r--r-- | phpBB/includes/functions_content.php | 30 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_warn.php | 24 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_compose.php | 2 | ||||
-rw-r--r-- | phpBB/language/en/acp/common.php | 1 | ||||
-rw-r--r-- | phpBB/language/en/captcha_qa.php | 2 | ||||
-rw-r--r-- | phpBB/language/en/common.php | 4 | ||||
-rw-r--r-- | phpBB/memberlist.php | 3 | ||||
-rw-r--r-- | phpBB/phpbb/captcha/plugins/qa.php | 34 | ||||
-rw-r--r-- | phpBB/posting.php | 2 | ||||
-rw-r--r-- | phpBB/viewtopic.php | 2 | ||||
-rw-r--r-- | phpBB/web.config | 7 |
11 files changed, 81 insertions, 30 deletions
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 36d7dfc03c..e05fcb0586 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -1036,17 +1036,8 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, unset($new_attachment_data); } - // Sort correctly - if ($config['display_order']) - { - // Ascending sort - krsort($attachments); - } - else - { - // Descending sort - ksort($attachments); - } + // Make sure attachments are properly ordered + ksort($attachments); foreach ($attachments as $attachment) { @@ -1285,8 +1276,6 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, $attachments = $compiled_attachments; unset($compiled_attachments); - $tpl_size = sizeof($attachments); - $unset_tpl = array(); preg_match_all('#<!\-\- ia([0-9]+) \-\->(.*?)<!\-\- ia\1 \-\->#', $message, $matches, PREG_PATTERN_ORDER); @@ -1294,8 +1283,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, $replace = array(); foreach ($matches[0] as $num => $capture) { - // Flip index if we are displaying the reverse way - $index = ($config['display_order']) ? ($tpl_size-($matches[1][$num] + 1)) : $matches[1][$num]; + $index = $matches[1][$num]; $replace['from'][] = $matches[0][$num]; $replace['to'][] = (isset($attachments[$index])) ? $attachments[$index] : sprintf($user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][array_search($index, $matches[1])]); @@ -1310,6 +1298,18 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, $unset_tpl = array_unique($unset_tpl); + // Sort correctly + if ($config['display_order']) + { + // Ascending sort + krsort($attachments); + } + else + { + // Descending sort + ksort($attachments); + } + // Needed to let not display the inlined attachments at the end of the post again foreach ($unset_tpl as $index) { diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index d724b8703b..33c898ffc2 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -530,12 +530,28 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx); - $user_row['user_lang'] = (file_exists($phpbb_root_path . 'language/' . $user_row['user_lang'] . "/mcp.$phpEx")) ? $user_row['user_lang'] : $config['default_lang']; - include($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp.$phpEx"); + // Attempt to translate warning to language of user being warned if user's language differs from issuer's language + if ($user_row['user_lang'] != $user->lang_name) + { + $lang = array(); + + $user_row['user_lang'] = (file_exists($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp." . $phpEx)) ? $user_row['user_lang'] : $config['default_lang']; + include($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp." . $phpEx); + + $warn_pm_subject = $lang['WARNING_PM_SUBJECT']; + $warn_pm_body = sprintf($lang['WARNING_PM_BODY'], $warning); + + unset($lang); + } + else + { + $warn_pm_subject = $user->lang('WARNING_PM_SUBJECT'); + $warn_pm_body = $user->lang('WARNING_PM_BODY', $warning); + } $message_parser = new parse_message(); - $message_parser->message = $user->lang('WARNING_PM_BODY', $warning); + $message_parser->message = $warn_pm_body; $message_parser->parse(true, true, true, false, false, true, true); $pm_data = array( @@ -553,7 +569,7 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) 'address_list' => array('u' => array($user_row['user_id'] => 'to')), ); - submit_pm('post', $user->lang('WARNING_PM_SUBJECT'), $pm_data, false); + submit_pm('post', $warn_pm_subject, $pm_data, false); } add_log('admin', 'LOG_USER_WARNING', $user_row['username']); diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 8b7d42e9c9..aae80b0c06 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -154,7 +154,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) 'S_SHOW_PM_BOX' => true, 'S_ALLOW_MASS_PM' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? true : false, 'S_GROUP_OPTIONS' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm_group')) ? $group_options : '', - 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=postform&field=username_list&select_single=$select_single"), + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=postform&field=username_list&select_single=" . (int) $select_single), )); } diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index fdbc4aebd0..88e60d00a3 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -594,6 +594,7 @@ $lang = array_merge($lang, array( 'LOG_ERROR_JABBER' => '<strong>Jabber error</strong><br />» %s', 'LOG_ERROR_EMAIL' => '<strong>Email error</strong><br />» %s', + 'LOG_ERROR_CAPTCHA' => '<strong>CAPTCHA error</strong><br />» %s', 'LOG_FORUM_ADD' => '<strong>Created new forum</strong><br />» %s', 'LOG_FORUM_COPIED_PERMISSIONS' => '<strong>Copied forum permissions</strong> from %1$s<br />» %2$s', diff --git a/phpBB/language/en/captcha_qa.php b/phpBB/language/en/captcha_qa.php index f764a83f24..28011eb636 100644 --- a/phpBB/language/en/captcha_qa.php +++ b/phpBB/language/en/captcha_qa.php @@ -40,6 +40,7 @@ $lang = array_merge($lang, array( 'CAPTCHA_QA' => 'Q&A', 'CONFIRM_QUESTION_EXPLAIN' => 'This question is a means of preventing automated form submissions by spambots.', 'CONFIRM_QUESTION_WRONG' => 'You have provided an invalid answer to the question.', + 'CONFIRM_QUESTION_MISSING' => 'Questions for the captcha could not be retrieved. Please contact a board administrator.', 'QUESTION_ANSWERS' => 'Answers', 'ANSWERS_EXPLAIN' => 'Please enter valid answers to the question, one per line.', @@ -60,5 +61,4 @@ $lang = array_merge($lang, array( 'QA_ERROR_MSG' => 'Please fill in all fields and enter at least one answer.', 'QA_LAST_QUESTION' => 'You cannot delete all questions while the plugin is active.', - )); diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 47e04d9360..a2cfd958aa 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -673,7 +673,7 @@ $lang = array_merge($lang, array( 'SEARCH_POSTS_BY' => 'Search posts by', 'SEARCH_SELF' => 'Your posts', 'SEARCH_TOPIC' => 'Search this topic…', - 'SEARCH_UNANSWERED' => 'Unanswered posts', + 'SEARCH_UNANSWERED' => 'Unanswered topics', 'SEARCH_UNREAD' => 'Unread posts', 'SEARCH_USER_POSTS' => 'Search user’s posts', 'SECONDS' => 'Seconds', @@ -815,7 +815,7 @@ $lang = array_merge($lang, array( 'USERS' => 'Users', 'USE_PERMISSIONS' => 'Test out user’s permissions', - 'USER_NEW_PERMISSION_DISALLOWED' => 'We are sorry, but you are not authorised to use this feature. You may have just registered here and may need to participate more to be able to use this feature.', + 'USER_NEW_PERMISSION_DISALLOWED' => 'We are sorry, but you are not authorised to use this feature. You may have just registered here and may need to participate more in discussions to be able to use this feature.', 'VARIANT_DATE_SEPARATOR' => ' / ', // Used in date format dropdown, eg: "Today, 13:37 / 01 Jan 2007, 13:37" ... to join a relative date with calendar date 'VIEWED' => 'Viewed', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 7cf39f4eb7..70e834b682 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1277,7 +1277,8 @@ switch ($mode) } $param = call_user_func_array('request_var', $call); - $param = urlencode($key) . '=' . ((is_string($param)) ? urlencode($param) : $param); + // Encode strings, convert everything else to int in order to prevent empty parameters. + $param = urlencode($key) . '=' . ((is_string($param)) ? urlencode($param) : (int) $param); $params[] = $param; if ($key != 'first_char') diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php index 2771369e57..8f2da838c5 100644 --- a/phpBB/phpbb/captcha/plugins/qa.php +++ b/phpBB/phpbb/captcha/plugins/qa.php @@ -100,6 +100,28 @@ class qa $db->sql_freeresult($result); } + // final fallback to any language + if (!sizeof($this->question_ids)) + { + $this->question_lang = ''; + + $sql = 'SELECT q.question_id, q.lang_iso + FROM ' . $this->table_captcha_questions . ' q, ' . $this->table_captcha_answers . ' a + WHERE q.question_id = a.question_id + GROUP BY lang_iso'; + $result = $db->sql_query($sql, 7200); + + while ($row = $db->sql_fetchrow($result)) + { + if (empty($this->question_lang)) + { + $this->question_lang = $row['lang_iso']; + } + $this->question_ids[$row['question_id']] = $row['question_id']; + } + $db->sql_freeresult($result); + } + // okay, if there is a confirm_id, we try to load that confirm's state. If not, we try to find one if (!$this->load_answer() && (!$this->load_confirm_id() || !$this->load_answer())) { @@ -198,10 +220,12 @@ class qa */ function get_template() { - global $template; + global $phpbb_log, $template, $user; - if ($this->is_solved()) + if ($this->is_solved() || empty($this->question_text) || !count($this->question_ids)) { + /** @var \phpbb\log\log_interface $phpbb_log */ + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING'))); return false; } else @@ -364,13 +388,15 @@ class qa */ function validate() { - global $user; + global $phpbb_log, $user; $error = ''; if (!sizeof($this->question_ids)) { - return false; + /** @var \phpbb\log\log_interface $phpbb_log */ + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING'))); + return $user->lang('CONFIRM_QUESTION_MISSING'); } if (!$this->confirm_id) diff --git a/phpBB/posting.php b/phpBB/posting.php index a7df1a018e..263809e998 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -599,7 +599,7 @@ if ($post_data['post_attachment'] && !$submit && !$refresh && !$preview && $mode WHERE post_msg_id = $post_id AND in_message = 0 AND is_orphan = 0 - ORDER BY filetime DESC"; + ORDER BY attach_id DESC"; $result = $db->sql_query($sql); $message_parser->attachment_data = array_merge($message_parser->attachment_data, $db->sql_fetchrowset($result)); $db->sql_freeresult($result); diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index eeb6444ceb..780e43e09b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1479,7 +1479,7 @@ if (sizeof($attach_list)) FROM ' . ATTACHMENTS_TABLE . ' WHERE ' . $db->sql_in_set('post_msg_id', $attach_list) . ' AND in_message = 0 - ORDER BY filetime DESC, post_msg_id ASC'; + ORDER BY attach_id DESC, post_msg_id ASC'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) diff --git a/phpBB/web.config b/phpBB/web.config index 99a1fe6023..c7a1240453 100644 --- a/phpBB/web.config +++ b/phpBB/web.config @@ -1,5 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <configuration> + <configSections> + <sectionGroup name="system.webServer" > + <sectionGroup name="rewrite"> + <section name="rules" overrideModeDefault="Allow" /> + </sectionGroup> + </sectionGroup> + </configSections> <system.webServer> <rewrite> <rules> |