From eb227977d27839bb0e2f1826084e00b667659e25 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Mon, 1 Jun 2015 02:24:48 +0200 Subject: [PATCH 1/3] [ticket/13906] Fixed old signatures in post preview PHPBB3-13906 --- phpBB/posting.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 1c7b756fc2..5b0e3d1da6 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1487,14 +1487,11 @@ if (!sizeof($error) && $preview) // Signature if ($post_data['enable_sig'] && $config['allow_sig'] && $preview_signature && $auth->acl_get('f_sigs', $forum_id)) { - $parse_sig = new parse_message($preview_signature); - $parse_sig->bbcode_uid = $preview_signature_uid; - $parse_sig->bbcode_bitfield = $preview_signature_bitfield; + $flags = ($config['allow_sig_bbcode']) ? OPTION_FLAG_BBCODE : 0; + $flags |= ($config['allow_sig_links']) ? OPTION_FLAG_LINKS : 0; + $flags |= ($config['allow_sig_smilies']) ? OPTION_FLAG_SMILIES : 0; - // Not sure about parameters for bbcode/smilies/urls... in signatures - $parse_sig->format_display($config['allow_sig_bbcode'], $config['allow_sig_links'], $config['allow_sig_smilies']); - $preview_signature = $parse_sig->message; - unset($parse_sig); + $preview_signature = generate_text_for_display($preview_signature, $preview_signature_uid, $preview_signature_bitfield, $flags, false); } else { From d37c995f4be23ca058cec59c44c92ab54015b11d Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Tue, 2 Jun 2015 12:37:36 +0200 Subject: [PATCH 2/3] [ticket/13906] Added test PHPBB3-13906 --- tests/functional/posting_test.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index 49f0c1d749..c107b78384 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -180,4 +180,26 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case $crawler = self::submit($form); $this->assertEquals($text, $crawler->filter('#message')->text()); } + + public function test_ticket_13906() + { + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_sig = '[b:2u8sdcwb]My signature[/b:2u8sdcwb]', + user_sig_bbcode_uid = '2u8sdcwb', + user_sig_bbcode_bitfield = 'QA==' + WHERE user_id = 2"; + $this->get_db()->sql_query($sql); + + $this->login(); + $crawler = self::request('GET', 'posting.php?mode=post&f=2'); + $form = $crawler->selectButton('Preview')->form(array( + 'subject' => 'Test subject', + 'message' => 'My post', + )); + $crawler = self::submit($form); + $this->assertContains( + 'My signature', + $crawler->filter('#preview .signature')->html() + ); + } } From 78eeb210e78429d867347ecb7c0eedf707005632 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Tue, 2 Jun 2015 22:46:14 +0200 Subject: [PATCH 3/3] [ticket/13906] Renamed test PHPBB3-13906 --- tests/functional/posting_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index c107b78384..ccfeb10deb 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -181,7 +181,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case $this->assertEquals($text, $crawler->filter('#message')->text()); } - public function test_ticket_13906() + public function test_old_signature_in_preview() { $sql = 'UPDATE ' . USERS_TABLE . " SET user_sig = '[b:2u8sdcwb]My signature[/b:2u8sdcwb]',