mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 05:18:52 +00:00
Merge pull request #4632 from VSEphpbb/ticket/14989
[ticket/14989] Allow more admin-configurable schemes in post links * VSEphpbb/ticket/14989: [ticket/14989] Allow more admin-configurable schemes in post links
This commit is contained in:
commit
4fd6b0fd88
3 changed files with 50 additions and 0 deletions
|
@ -196,6 +196,7 @@ class acp_board
|
||||||
'allow_post_flash' => array('lang' => 'ALLOW_POST_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'allow_post_flash' => array('lang' => 'ALLOW_POST_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
|
'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
|
||||||
'allow_post_links' => array('lang' => 'ALLOW_POST_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'allow_post_links' => array('lang' => 'ALLOW_POST_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
|
'allowed_schemes_links' => array('lang' => 'ALLOWED_SCHEMES_LINKS', 'validate' => 'string', 'type' => 'text:0:255', 'explain' => true),
|
||||||
'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
|
@ -552,6 +553,12 @@ class acp_board
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Invalidate the text_formatter cache when posting options are changed
|
||||||
|
if ($mode == 'post' && $submit)
|
||||||
|
{
|
||||||
|
$phpbb_container->get('text_formatter.cache')->invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
// Store news and exclude ids
|
// Store news and exclude ids
|
||||||
if ($mode == 'feed' && $submit)
|
if ($mode == 'feed' && $submit)
|
||||||
{
|
{
|
||||||
|
|
|
@ -161,6 +161,8 @@ $lang = array_merge($lang, array(
|
||||||
'ACP_POST_SETTINGS_EXPLAIN' => 'Here you can set all default settings for posting.',
|
'ACP_POST_SETTINGS_EXPLAIN' => 'Here you can set all default settings for posting.',
|
||||||
'ALLOW_POST_LINKS' => 'Allow links in posts/private messages',
|
'ALLOW_POST_LINKS' => 'Allow links in posts/private messages',
|
||||||
'ALLOW_POST_LINKS_EXPLAIN' => 'If disallowed the <code>[URL]</code> BBCode tag and automatic/magic URLs are disabled.',
|
'ALLOW_POST_LINKS_EXPLAIN' => 'If disallowed the <code>[URL]</code> BBCode tag and automatic/magic URLs are disabled.',
|
||||||
|
'ALLOWED_SCHEMES_LINKS' => 'Allowed schemes in links',
|
||||||
|
'ALLOWED_SCHEMES_LINKS_EXPLAIN' => 'Users can only post schemeless URLs or one of the comma-separated list of allowed schemes.',
|
||||||
'ALLOW_POST_FLASH' => 'Allow use of <code>[FLASH]</code> BBCode tag in posts',
|
'ALLOW_POST_FLASH' => 'Allow use of <code>[FLASH]</code> BBCode tag in posts',
|
||||||
'ALLOW_POST_FLASH_EXPLAIN' => 'If disallowed the <code>[FLASH]</code> BBCode tag is disabled in posts. Otherwise the permission system controls which users can use the <code>[FLASH]</code> BBCode tag.',
|
'ALLOW_POST_FLASH_EXPLAIN' => 'If disallowed the <code>[FLASH]</code> BBCode tag is disabled in posts. Otherwise the permission system controls which users can use the <code>[FLASH]</code> BBCode tag.',
|
||||||
|
|
||||||
|
|
|
@ -264,4 +264,45 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
|
||||||
// Test that the preview contains the correct link
|
// Test that the preview contains the correct link
|
||||||
$this->assertEquals($url, $crawler->filter('#preview a')->attr('href'));
|
$this->assertEquals($url, $crawler->filter('#preview a')->attr('href'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_allowed_schemes_links()
|
||||||
|
{
|
||||||
|
$text = 'http://example.org/ tcp://localhost:22/ServiceName';
|
||||||
|
|
||||||
|
$this->login();
|
||||||
|
$this->admin_login();
|
||||||
|
|
||||||
|
// Post with default settings
|
||||||
|
$crawler = self::request('GET', 'posting.php?mode=post&f=2');
|
||||||
|
$form = $crawler->selectButton('Preview')->form(array(
|
||||||
|
'subject' => 'Test subject',
|
||||||
|
'message' => $text,
|
||||||
|
));
|
||||||
|
$crawler = self::submit($form);
|
||||||
|
$this->assertContains(
|
||||||
|
'<a href="http://example.org/" class="postlink">http://example.org/</a> tcp://localhost:22/ServiceName',
|
||||||
|
$crawler->filter('#preview .content')->html()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Update allowed schemes
|
||||||
|
$crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post');
|
||||||
|
$form = $crawler->selectButton('Submit')->form();
|
||||||
|
$values = $form->getValues();
|
||||||
|
$values['config[allowed_schemes_links]'] = 'https,tcp';
|
||||||
|
$form->setValues($values);
|
||||||
|
$crawler = self::submit($form);
|
||||||
|
$this->assertEquals(1, $crawler->filter('.successbox')->count());
|
||||||
|
|
||||||
|
// Post with new settings
|
||||||
|
$crawler = self::request('GET', 'posting.php?mode=post&f=2');
|
||||||
|
$form = $crawler->selectButton('Preview')->form(array(
|
||||||
|
'subject' => 'Test subject',
|
||||||
|
'message' => $text,
|
||||||
|
));
|
||||||
|
$crawler = self::submit($form);
|
||||||
|
$this->assertContains(
|
||||||
|
'http://example.org/ <a href="tcp://localhost:22/ServiceName" class="postlink">tcp://localhost:22/ServiceName</a>',
|
||||||
|
$crawler->filter('#preview .content')->html()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue