From fac6ab1fd4b2509b0cf387231c8a4bba8383efb6 Mon Sep 17 00:00:00 2001 From: Shitiz Garg Date: Tue, 17 Jun 2014 18:23:36 +0530 Subject: [PATCH 1/7] [ticket/12733] Add Twitter custom profile field PHPBB3-12733 --- phpBB/install/schemas/schema_data.sql | 1 + phpBB/language/en/common.php | 1 + phpBB/language/en/memberlist.php | 1 + .../data/v310/profilefield_twitter.php | 60 +++++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 15cd9595c6..83e5f44e33 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -806,6 +806,7 @@ INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_len INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_icq', 'profilefields.type.string', 'phpbb_icq', '20', '3', '15', '', '', '[0-9]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 6, 1, 'SEND_ICQ_MESSAGE', 'https://www.icq.com/people/%s/'); INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_wlm', 'profilefields.type.string', 'phpbb_wlm', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 7, 1, '', ''); INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_yahoo', 'profilefields.type.string', 'phpbb_yahoo', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 8, 1, 'SEND_YIM_MESSAGE', 'http://edit.yahoo.com/config/send_webmesg?.target=%s&.src=pg'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_twitter', 'profilefields.type.string', 'phpbb_twitter', '20', '1', '15', '', '', '[\\w_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 10, 1, 'VIEW_TWITTER_PROFILE', 'http://twitter.com/%s'); # User Notification Options (for first user) INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, ''); diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 9a44337294..360bb73ce7 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -771,6 +771,7 @@ $lang = array_merge($lang, array( 2 => 'Total members %d', ), 'TRACKED_PHP_ERROR' => 'Tracked PHP errors: %s', + 'TWITTER' => 'Twitter', 'UNABLE_GET_IMAGE_SIZE' => 'It was not possible to determine the dimensions of the image. Please verify that the URL you entered is correct.', 'UNABLE_TO_DELIVER_FILE'=> 'Unable to deliver file.', diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php index d900ababd1..d8cc224d6f 100644 --- a/phpBB/language/en/memberlist.php +++ b/phpBB/language/en/memberlist.php @@ -144,4 +144,5 @@ $lang = array_merge($lang, array( 'USERS_PER_PAGE' => 'Users per page', 'VIEWING_PROFILE' => 'Viewing profile - %s', + 'VIEW_TWITTER_PROFILE' => 'View Twitter Profile', )); diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php b/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php new file mode 100644 index 0000000000..f77b9d27e3 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php @@ -0,0 +1,60 @@ + + * @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\v310; + +class profilefield_twitter extends \phpbb\db\migration\profilefield_base_migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_types', + '\phpbb\db\migration\data\v310\profilefield_show_novalue', + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'create_custom_field'))), + ); + } + + protected $profilefield_name = 'phpbb_twitter'; + + protected $profilefield_database_type = array('VCHAR', ''); + + protected $profilefield_data = array( + 'field_name' => 'phpbb_twitter', + 'field_type' => 'profilefields.type.string', + 'field_ident' => 'phpbb_twitter', + 'field_length' => '20', + 'field_minlen' => '1', + 'field_maxlen' => '15', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '[\w_]+', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 1, + 'field_is_contact' => 1, + 'field_contact_desc' => 'VIEW_TWITTER_PROFILE', + 'field_contact_url' => 'http://twitter.com/%s', + ); +} From d7edf31b955d311dda12aa13576227f9f2d1026a Mon Sep 17 00:00:00 2001 From: Shitiz Garg Date: Wed, 18 Jun 2014 00:39:38 +0530 Subject: [PATCH 2/7] [ticket/12733] Update schema.json PHPBB3-12733 --- phpBB/install/schemas/schema.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpBB/install/schemas/schema.json b/phpBB/install/schemas/schema.json index 79f06693a6..5bb33ea528 100644 --- a/phpBB/install/schemas/schema.json +++ b/phpBB/install/schemas/schema.json @@ -2088,6 +2088,10 @@ "UINT", 0 ], + "pf_phpbb_twitter": [ + "VCHAR", + "" + ], "pf_phpbb_interests": [ "MTEXT", "" From 04e43e2087accb56c3afa2e74d7b246194342535 Mon Sep 17 00:00:00 2001 From: Shitiz Garg Date: Wed, 18 Jun 2014 15:38:49 +0530 Subject: [PATCH 3/7] [ticket/12733] Fix spacing for block header in profilefield_twitter.php PHPBB3-12733 --- .../data/v310/profilefield_twitter.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php b/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php index f77b9d27e3..07284df806 100644 --- a/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php @@ -1,15 +1,15 @@ - * @license GNU General Public License, version 2 (GPL-2.0) - * - * For full copyright and license information, please see - * the docs/CREDITS.txt file. - * - */ +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited +* @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\v310; From deae22b85f5313c514b01221e58d7df387edde69 Mon Sep 17 00:00:00 2001 From: Shitiz Garg Date: Wed, 18 Jun 2014 17:56:00 +0530 Subject: [PATCH 4/7] [ticket/12733] Convert spaces to tabs PHPBB3-12733 --- .../data/v310/profilefield_twitter.php | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php b/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php index 07284df806..68d038f609 100644 --- a/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php @@ -15,46 +15,46 @@ namespace phpbb\db\migration\data\v310; class profilefield_twitter extends \phpbb\db\migration\profilefield_base_migration { - static public function depends_on() - { - return array( - '\phpbb\db\migration\data\v310\profilefield_types', - '\phpbb\db\migration\data\v310\profilefield_show_novalue', - ); - } + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\profilefield_types', + '\phpbb\db\migration\data\v310\profilefield_show_novalue', + ); + } - public function update_data() - { - return array( - array('custom', array(array($this, 'create_custom_field'))), - ); - } + public function update_data() + { + return array( + array('custom', array(array($this, 'create_custom_field'))), + ); + } - protected $profilefield_name = 'phpbb_twitter'; + protected $profilefield_name = 'phpbb_twitter'; - protected $profilefield_database_type = array('VCHAR', ''); + protected $profilefield_database_type = array('VCHAR', ''); - protected $profilefield_data = array( - 'field_name' => 'phpbb_twitter', - 'field_type' => 'profilefields.type.string', - 'field_ident' => 'phpbb_twitter', - 'field_length' => '20', - 'field_minlen' => '1', - 'field_maxlen' => '15', - 'field_novalue' => '', - 'field_default_value' => '', - 'field_validation' => '[\w_]+', - 'field_required' => 0, - 'field_show_novalue' => 0, - 'field_show_on_reg' => 0, - 'field_show_on_pm' => 1, - 'field_show_on_vt' => 1, - 'field_show_profile' => 1, - 'field_hide' => 0, - 'field_no_view' => 0, - 'field_active' => 1, - 'field_is_contact' => 1, - 'field_contact_desc' => 'VIEW_TWITTER_PROFILE', - 'field_contact_url' => 'http://twitter.com/%s', - ); + protected $profilefield_data = array( + 'field_name' => 'phpbb_twitter', + 'field_type' => 'profilefields.type.string', + 'field_ident' => 'phpbb_twitter', + 'field_length' => '20', + 'field_minlen' => '1', + 'field_maxlen' => '15', + 'field_novalue' => '', + 'field_default_value' => '', + 'field_validation' => '[\w_]+', + 'field_required' => 0, + 'field_show_novalue' => 0, + 'field_show_on_reg' => 0, + 'field_show_on_pm' => 1, + 'field_show_on_vt' => 1, + 'field_show_profile' => 1, + 'field_hide' => 0, + 'field_no_view' => 0, + 'field_active' => 1, + 'field_is_contact' => 1, + 'field_contact_desc' => 'VIEW_TWITTER_PROFILE', + 'field_contact_url' => 'http://twitter.com/%s', + ); } From a4db81b379c60416578f8bee2712d05474617a8c Mon Sep 17 00:00:00 2001 From: Shitiz Garg Date: Fri, 20 Jun 2014 19:16:33 +0530 Subject: [PATCH 5/7] [ticket/12733] Set field_active to 1 for Twitter PHPBB3-12733 --- phpBB/install/schemas/schema_data.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 83e5f44e33..87c940447a 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -806,7 +806,7 @@ INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_len INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_icq', 'profilefields.type.string', 'phpbb_icq', '20', '3', '15', '', '', '[0-9]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 6, 1, 'SEND_ICQ_MESSAGE', 'https://www.icq.com/people/%s/'); INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_wlm', 'profilefields.type.string', 'phpbb_wlm', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 7, 1, '', ''); INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_yahoo', 'profilefields.type.string', 'phpbb_yahoo', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 8, 1, 'SEND_YIM_MESSAGE', 'http://edit.yahoo.com/config/send_webmesg?.target=%s&.src=pg'); -INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_twitter', 'profilefields.type.string', 'phpbb_twitter', '20', '1', '15', '', '', '[\\w_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 10, 1, 'VIEW_TWITTER_PROFILE', 'http://twitter.com/%s'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_twitter', 'profilefields.type.string', 'phpbb_twitter', '20', '1', '15', '', '', '[\\w_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 10, 1, 'VIEW_TWITTER_PROFILE', 'http://twitter.com/%s'); # User Notification Options (for first user) INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, ''); From abc55dcb40ca761424ebcc394f93bddae55c2a40 Mon Sep 17 00:00:00 2001 From: Shitiz Garg Date: Fri, 20 Jun 2014 21:03:04 +0530 Subject: [PATCH 6/7] [ticket/12733] Values needn't be escaped for schema_data.sql PHPBB3-12733 --- phpBB/install/schemas/schema_data.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 87c940447a..518f547692 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -806,7 +806,7 @@ INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_len INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_icq', 'profilefields.type.string', 'phpbb_icq', '20', '3', '15', '', '', '[0-9]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 6, 1, 'SEND_ICQ_MESSAGE', 'https://www.icq.com/people/%s/'); INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_wlm', 'profilefields.type.string', 'phpbb_wlm', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 7, 1, '', ''); INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_yahoo', 'profilefields.type.string', 'phpbb_yahoo', '40', '5', '255', '', '', '.*', 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 8, 1, 'SEND_YIM_MESSAGE', 'http://edit.yahoo.com/config/send_webmesg?.target=%s&.src=pg'); -INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_twitter', 'profilefields.type.string', 'phpbb_twitter', '20', '1', '15', '', '', '[\\w_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 10, 1, 'VIEW_TWITTER_PROFILE', 'http://twitter.com/%s'); +INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_twitter', 'profilefields.type.string', 'phpbb_twitter', '20', '1', '15', '', '', '[\w_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 10, 1, 'VIEW_TWITTER_PROFILE', 'http://twitter.com/%s'); # User Notification Options (for first user) INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, ''); From cdfcbfc6d0c7c1ea7f1b5c802eaa85887934f829 Mon Sep 17 00:00:00 2001 From: Shitiz Garg Date: Fri, 20 Jun 2014 21:12:02 +0530 Subject: [PATCH 7/7] [ticket/12733] Add functional test for twitter profile field PHPBB3-12733 --- tests/functional/ucp_profile_test.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/functional/ucp_profile_test.php b/tests/functional/ucp_profile_test.php index ea08eece78..5e8e761687 100644 --- a/tests/functional/ucp_profile_test.php +++ b/tests/functional/ucp_profile_test.php @@ -26,6 +26,7 @@ class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case $form = $crawler->selectButton('Submit')->form(array( 'pf_phpbb_location' => 'Bertie“s Empire', + 'pf_phpbb_twitter' => 'phpbb_twitter', )); $crawler = self::submit($form); $this->assertContainsLang('PROFILE_UPDATED', $crawler->filter('#message')->text()); @@ -33,5 +34,6 @@ class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case $crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=profile_info'); $form = $crawler->selectButton('Submit')->form(); $this->assertEquals('Bertie“s Empire', $form->get('pf_phpbb_location')->getValue()); + $this->assertEquals('phpbb_twitter', $form->get('pf_phpbb_twitter')->getValue()); } }