mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/17129] Update regex and tests for changed input data to youtube cpf
PHPBB3-17129
This commit is contained in:
parent
437839ba72
commit
acaec9f95f
4 changed files with 15 additions and 6 deletions
|
@ -837,7 +837,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_facebook', 'profilefields.type.string', 'phpbb_facebook', '20', '5', '50', '', '', '[\w.]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 9, 1, 'VIEW_FACEBOOK_PROFILE', 'https://facebook.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', 'https://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_skype', 'profilefields.type.string', 'phpbb_skype', '20', '6', '32', '', '', '[a-zA-Z][\w\.,\-_]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 11, 1, 'VIEW_SKYPE_PROFILE', 'skype:%s?userinfo');
|
||||
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_youtube', 'profilefields.type.string', 'phpbb_youtube', '40', '23', '255', '', '', '(@[a-zA-Z0-9_.-]{3,30}|c/[a-zA-Z][\w\.,\-_]+|channel/[a-zA-Z][\w\.,\-_]+)', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 12, 1, 'VIEW_YOUTUBE_CHANNEL', '%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_youtube', 'profilefields.type.string', 'phpbb_youtube', '20', '3', '60', '', '', '(@[a-zA-Z0-9_.-]{3,30}|c/[a-zA-Z][\w\.,\-_]+|(channel|user)/[a-zA-Z][\w\.,\-_]+)', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 12, 1, 'VIEW_YOUTUBE_PROFILE', 'https://youtube.com/%s');
|
||||
|
||||
# User Notification Options (for first user)
|
||||
INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.post', 0, 2, 'notification.method.board');
|
||||
|
|
|
@ -149,5 +149,5 @@ $lang = array_merge($lang, array(
|
|||
'VIEW_FACEBOOK_PROFILE' => 'View Facebook Profile',
|
||||
'VIEW_SKYPE_PROFILE' => 'View Skype Profile',
|
||||
'VIEW_TWITTER_PROFILE' => 'View Twitter Profile',
|
||||
'VIEW_YOUTUBE_CHANNEL' => 'View YouTube Channel',
|
||||
'VIEW_YOUTUBE_PROFILE' => 'View YouTube Profile',
|
||||
));
|
||||
|
|
|
@ -16,11 +16,14 @@ namespace phpbb\db\migration\data\v33x;
|
|||
class profilefields_update extends \phpbb\db\migration\migration
|
||||
{
|
||||
/** @var string YouTube URLs matcher: handle or custom URL or channel URL */
|
||||
protected $youtube_url_matcher = '(@[a-zA-Z0-9_.-]{3,30}|c/[a-zA-Z][\w\.,\-_]+|channel/[a-zA-Z][\w\.,\-_]+)';
|
||||
protected $youtube_url_matcher = '(@[a-zA-Z0-9_.-]{3,30}|c/[a-zA-Z][\w\.,\-_]+|(channel|user)/[a-zA-Z][\w\.,\-_]+)';
|
||||
|
||||
public static function depends_on(): array
|
||||
{
|
||||
return ['\phpbb\db\migration\data\v33x\v3310'];
|
||||
return [
|
||||
'\phpbb\db\migration\data\v33x\v3310',
|
||||
'\phpbb\db\migration\data\v33x\profilefield_youtube_update',
|
||||
];
|
||||
}
|
||||
|
||||
public function update_schema(): array
|
||||
|
@ -76,6 +79,7 @@ class profilefields_update extends \phpbb\db\migration\migration
|
|||
field_maxlen = '60',
|
||||
field_validation = '$field_validation',
|
||||
field_contact_url = 'https://youtube.com/%s'
|
||||
field_contact_desc = 'VIEW_YOUTUBE_PROFILE'
|
||||
WHERE field_name = 'phpbb_youtube'"
|
||||
);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case
|
|||
public function test_submitting_profile_info()
|
||||
{
|
||||
$this->add_lang('ucp');
|
||||
$this->add_lang('memberlist');
|
||||
$this->login();
|
||||
|
||||
$crawler = self::request('GET', 'ucp.php?i=ucp_profile&mode=profile_info');
|
||||
|
@ -29,7 +30,7 @@ class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case
|
|||
'pf_phpbb_location' => 'Bertie´s Empire',
|
||||
'pf_phpbb_skype' => 'phpbb.skype.account',
|
||||
'pf_phpbb_twitter' => 'phpbb_twitter',
|
||||
'pf_phpbb_youtube' => 'phpbb.youtube',
|
||||
'pf_phpbb_youtube' => 'user/phpbb.youtube',
|
||||
));
|
||||
|
||||
$crawler = self::submit($form);
|
||||
|
@ -42,7 +43,11 @@ class phpbb_functional_ucp_profile_test extends phpbb_functional_test_case
|
|||
$this->assertEquals('Bertie´s Empire', $form->get('pf_phpbb_location')->getValue());
|
||||
$this->assertEquals('phpbb.skype.account', $form->get('pf_phpbb_skype')->getValue());
|
||||
$this->assertEquals('phpbb_twitter', $form->get('pf_phpbb_twitter')->getValue());
|
||||
$this->assertEquals('phpbb.youtube', $form->get('pf_phpbb_youtube')->getValue());
|
||||
$this->assertEquals('user/phpbb.youtube', $form->get('pf_phpbb_youtube')->getValue());
|
||||
|
||||
$crawler = self::request('GET', 'memberlist.php?mode=viewprofile&un=admin');
|
||||
$link = $crawler->selectLink($this->lang('VIEW_YOUTUBE_PROFILE'));
|
||||
$this->assertSame('https://youtube.com/user/phpbb.youtube', $link->attr('href'));
|
||||
}
|
||||
|
||||
public function test_submitting_emoji()
|
||||
|
|
Loading…
Add table
Reference in a new issue