From 508caa9bd49a09bed3f09c31c1e5d78584b388a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Sun, 1 Oct 2017 17:41:08 +0200 Subject: [PATCH 1/4] [ticket/15171] Replace all BBCode templates by default PHPBB3-15171 --- phpBB/includes/acp/acp_styles.php | 22 +++++++++++----------- phpBB/install/schemas/schema_data.sql | 2 +- phpBB/styles/prosilver/style.cfg | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 5b31417b83..7acb635195 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -1355,18 +1355,18 @@ class acp_styles } // Hardcoded template bitfield to add for new templates + $default_bitfield = '1111111111111'; + $bitfield = new bitfield(); - $bitfield->set(0); - $bitfield->set(1); - $bitfield->set(2); - $bitfield->set(3); - $bitfield->set(4); - $bitfield->set(8); - $bitfield->set(9); - $bitfield->set(11); - $bitfield->set(12); - $value = $bitfield->get_base64(); - return $value; + for ($i = 0; $i < strlen($default_bitfield); $i++) + { + if($default_bitfield[$i] == '1') + { + $bitfield->set($i); + } + } + + return $bitfield->get_base64(); } } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index ca0e8bd614..6ddf3d7ad8 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -477,7 +477,7 @@ INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) INSERT INTO phpbb_acl_roles (role_name, role_description, role_type, role_order) VALUES ('ROLE_FORUM_NEW_MEMBER', 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER', 'f_', 10); # -- phpbb_styles -INSERT INTO phpbb_styles (style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES ('prosilver', '© phpBB Limited', 1, 'prosilver', 'kNg=', 0, ''); +INSERT INTO phpbb_styles (style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES ('prosilver', '© phpBB Limited', 1, 'prosilver', '//g=', 0, ''); # -- Forums INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts_approved, forum_posts_unapproved, forum_posts_softdeleted, forum_topics_approved, forum_topics_unapproved, forum_topics_softdeleted, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents) VALUES ('{L_FORUMS_FIRST_CATEGORY}', '', 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 'Admin', 'AA0000', 972086460, '', '', '', '', '', '', '', 0, 0, ''); diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg index 2deceef788..ea4e899109 100644 --- a/phpBB/styles/prosilver/style.cfg +++ b/phpBB/styles/prosilver/style.cfg @@ -25,7 +25,7 @@ style_version = 3.2.1 phpbb_version = 3.2.1 # Defining a different template bitfield -# template_bitfield = lNg= +# template_bitfield = //g= # Parent style # Set value to empty or to this style's name if this style does not have a parent style From 3bfd006e77853d5a84f822269601d41d152fe89b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Mon, 2 Oct 2017 16:01:14 +0200 Subject: [PATCH 2/4] [ticket/15171] Fix texformatter PHPBB3-15171 --- phpBB/phpbb/textformatter/s9e/factory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index d5ad8283d9..15d0a5e3e5 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -78,7 +78,7 @@ class factory implements \phpbb\textformatter\cache_interface 'b' => '[B]{TEXT}[/B]', 'code' => '[CODE lang={IDENTIFIER;optional}]{TEXT}[/CODE]', 'color' => '[COLOR={COLOR}]{TEXT}[/COLOR]', - 'email' => '[EMAIL={EMAIL;useContent} subject={TEXT;optional;postFilter=rawurlencode} body={TEXT;optional;postFilter=rawurlencode}]{TEXT}[/EMAIL]', + 'email' => '[EMAIL={EMAIL;useContent} subject={TEXT1;optional;postFilter=rawurlencode} body={TEXT2;optional;postFilter=rawurlencode}]{TEXT}[/EMAIL]', 'flash' => '[FLASH={NUMBER1},{NUMBER2} width={NUMBER1;postFilter=#flashwidth} height={NUMBER2;postFilter=#flashheight} url={URL;useContent} /]', 'i' => '[I]{TEXT}[/I]', 'img' => '[IMG src={IMAGEURL;useContent}]', From a0ba57dc4f39804cd52f69b6342c1e2f5f1acea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Mon, 2 Oct 2017 16:29:53 +0200 Subject: [PATCH 3/4] [ticket/15171] Fix test PHPBB3-15171 --- phpBB/includes/acp/acp_styles.php | 2 +- tests/functional/posting_test.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 7acb635195..4c390c5f0e 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -1360,7 +1360,7 @@ class acp_styles $bitfield = new bitfield(); for ($i = 0; $i < strlen($default_bitfield); $i++) { - if($default_bitfield[$i] == '1') + if ($default_bitfield[$i] == '1') { $bitfield->set($i); } diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index 8e6328d1d3..764376a945 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -235,7 +235,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case )); $crawler = self::submit($form); $this->assertContains( - 'My signature', + 'My signature', $crawler->filter('#preview .signature')->html() ); } From 4bf0f4a50f34e00fb80299119f98c23ee426dc4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Tue, 31 Oct 2017 14:37:36 +0100 Subject: [PATCH 4/4] [ticket/15171] Add migration PHPBB3-15171 --- .../data/v32x/update_prosilver_bitfield.php | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v32x/update_prosilver_bitfield.php diff --git a/phpBB/phpbb/db/migration/data/v32x/update_prosilver_bitfield.php b/phpBB/phpbb/db/migration/data/v32x/update_prosilver_bitfield.php new file mode 100644 index 0000000000..6e51a01834 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/update_prosilver_bitfield.php @@ -0,0 +1,39 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class update_prosilver_bitfield extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v321', + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_bbcode_bitfield'))), + ); + } + + public function update_bbcode_bitfield() + { + $sql = 'UPDATE ' . STYLES_TABLE . " + SET bbcode_bitfield = '//g=' + WHERE style_path = 'prosilver'"; + $this->sql_query($sql); + } +}