diff options
-rw-r--r-- | phpBB/includes/ucp/ucp_register.php | 14 | ||||
-rw-r--r-- | phpBB/phpbb/textformatter/s9e/bbcode_merger.php | 26 | ||||
-rw-r--r-- | phpBB/posting.php | 12 | ||||
-rw-r--r-- | tests/text_formatter/s9e/bbcode_merger_test.php | 16 | ||||
-rwxr-xr-x | travis/setup-php-extensions.sh | 5 |
5 files changed, 51 insertions, 22 deletions
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 0e673cb692..54e418d58c 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -45,6 +45,11 @@ class ucp_register $change_lang = $request->variable('change_lang', ''); $user_lang = $request->variable('lang', $user->lang_name); + if ($agreed && !check_form_key('ucp_register')) + { + $agreed = false; + } + /** * Add UCP register data before they are assigned to the template or submitted * @@ -67,14 +72,7 @@ class ucp_register ); extract($phpbb_dispatcher->trigger_event('core.ucp_register_requests_after', compact($vars))); - if ($agreed) - { - add_form_key('ucp_register'); - } - else - { - add_form_key('ucp_register_terms'); - } + add_form_key('ucp_register'); if ($change_lang || $user_lang != $config['default_lang']) { diff --git a/phpBB/phpbb/textformatter/s9e/bbcode_merger.php b/phpBB/phpbb/textformatter/s9e/bbcode_merger.php index a05ca3c2b8..264eb93782 100644 --- a/phpBB/phpbb/textformatter/s9e/bbcode_merger.php +++ b/phpBB/phpbb/textformatter/s9e/bbcode_merger.php @@ -50,7 +50,7 @@ class bbcode_merger $with = $this->create_bbcode($with); // Select the appropriate strategy for merging this BBCode - if ($this->is_content_bbcode($without, $with)) + if (!$this->is_optional_bbcode($without, $with) && $this->is_content_bbcode($without, $with)) { $merged = $this->merge_content_bbcode($without, $with); } @@ -107,12 +107,12 @@ class bbcode_merger /** * Test whether the two definitions form a "content"-style BBCode * - * Such BBCodes include the [URL] BBCode, which uses its text content as + * Such BBCodes include the [url] BBCode, which uses its text content as * attribute if none is provided * * @param array $without BBCode definition without an attribute * @param array $with BBCode definition with an attribute - * @return array Merged definition + * @return bool */ protected function is_content_bbcode(array $without, array $with) { @@ -123,6 +123,22 @@ class bbcode_merger } /** + * Test whether the two definitions form BBCode with an optional attribute + * + * @param array $without BBCode definition without an attribute + * @param array $with BBCode definition with an attribute + * @return bool + */ + protected function is_optional_bbcode(array $without, array $with) + { + // Remove the default attribute from the definition + $with['usage'] = preg_replace('(=[^\\]]++)', '', $with['usage']); + + // Test whether both definitions are the same, regardless of case + return strcasecmp($without['usage'], $with['usage']) === 0; + } + + /** * Merge the two BBCode definitions of a "content"-style BBCode * * @param array $without BBCode definition without an attribute @@ -131,7 +147,7 @@ class bbcode_merger */ protected function merge_content_bbcode(array $without, array $with) { - // Convert [X={X}] into [X={X;useContent}] + // Convert [x={X}] into [x={X;useContent}] $usage = preg_replace('(\\})', ';useContent}', $with['usage'], 1); // Use the template from the definition that uses an attribute @@ -143,7 +159,7 @@ class bbcode_merger /** * Merge the two BBCode definitions of a BBCode with an optional argument * - * Such BBCodes include the [QUOTE] BBCode, which takes an optional argument + * Such BBCodes include the [quote] BBCode, which takes an optional argument * but otherwise does not behave differently * * @param array $without BBCode definition without an attribute diff --git a/phpBB/posting.php b/phpBB/posting.php index a0ddb9ff15..59616a2858 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -256,12 +256,6 @@ if ($mode == 'popup') $user->setup(array('posting', 'mcp', 'viewtopic'), $post_data['forum_style']); -if ($config['enable_post_confirm'] && !$user->data['is_registered']) -{ - $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']); - $captcha->init(CONFIRM_POST); -} - // Use post_row values in favor of submitted ones... $forum_id = (!empty($post_data['forum_id'])) ? (int) $post_data['forum_id'] : (int) $forum_id; $topic_id = (!empty($post_data['topic_id'])) ? (int) $post_data['topic_id'] : (int) $topic_id; @@ -427,6 +421,12 @@ if (!$is_authed || !empty($error)) login_box('', $message); } +if ($config['enable_post_confirm'] && !$user->data['is_registered']) +{ + $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']); + $captcha->init(CONFIRM_POST); +} + // Is the user able to post within this forum? if ($post_data['forum_type'] != FORUM_POST && in_array($mode, array('post', 'bump', 'quote', 'reply'))) { diff --git a/tests/text_formatter/s9e/bbcode_merger_test.php b/tests/text_formatter/s9e/bbcode_merger_test.php index 815539056b..5ec0c91971 100644 --- a/tests/text_formatter/s9e/bbcode_merger_test.php +++ b/tests/text_formatter/s9e/bbcode_merger_test.php @@ -275,6 +275,22 @@ class phpbb_textformatter_s9e_bbcode_merger_test extends phpbb_test_case </table> <p> </p>' ], + [ + // https://www.phpbb.com/community/viewtopic.php?f=438&t=2530451 + '[issue]{NUMBER}[/issue]', + '<a href="/default/issues/{NUMBER}"> Issue #{NUMBER}</a>', + + '[issue={SIMPLETEXT}]{NUMBER}[/issue]', + '<a href="/{SIMPLETEXT}/issues/{NUMBER}"> Issue #{NUMBER} ({SIMPLETEXT})</a>', + + '[issue={SIMPLETEXT?}]{NUMBER}[/issue]', + '<a> + <xsl:choose> + <xsl:when test="@issue"><xsl:attribute name="href">/<xsl:value-of select="@issue"/>/issues/<xsl:value-of select="@content"/></xsl:attribute> Issue #<xsl:value-of select="@content"/> (<xsl:value-of select="@issue"/>)</xsl:when> + <xsl:otherwise><xsl:attribute name="href">/default/issues/<xsl:value-of select="@content"/></xsl:attribute> Issue #<xsl:value-of select="@content"/></xsl:otherwise> + </xsl:choose> + </a>' + ], ]; } } diff --git a/travis/setup-php-extensions.sh b/travis/setup-php-extensions.sh index de27965e39..a69468a637 100755 --- a/travis/setup-php-extensions.sh +++ b/travis/setup-php-extensions.sh @@ -48,9 +48,6 @@ then echo 'Enabling APC PHP extension' printf "\n" | pecl install apc echo 'apc.enable_cli=1' >> "$php_ini_file" -else - echo 'Disabling Opcache' - echo 'opcache.enable=0' >> "$php_ini_file" fi # APCu @@ -65,6 +62,8 @@ then fi fi +# Disable xdebug on travis +phpenv config-rm xdebug.ini # redis # Disabled redis for now as it causes travis to fail |