1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-03 23:37:39 +02:00

[ticket/16574] Remove flash BBcode

PHPBB3-16574
This commit is contained in:
Jakub Senko
2020-10-01 10:01:47 +02:00
committed by Marc Alexander
parent d714c6db19
commit 28f98402f3
56 changed files with 115 additions and 647 deletions

View File

@@ -202,11 +202,6 @@ class bbcode_firstpass extends bbcode
return $bbcode_class->validate_email($match[1], $match[2]);
}
)),
'flash' => array('bbcode_id' => BBCODE_ID_FLASH, 'regexp' => array('#\[flash=([0-9]+),([0-9]+)\](.*?)\[/flash\]#ui' => function ($match) use($bbcode_class)
{
return $bbcode_class->bbcode_flash($match[1], $match[2], $match[3]);
}
))
);
// Zero the parsed items array
@@ -410,60 +405,6 @@ class bbcode_firstpass extends bbcode
return '[img:' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($in) . '[/img:' . $this->bbcode_uid . ']';
}
/**
* Parse flash tag
*/
function bbcode_flash($width, $height, $in)
{
global $user, $config;
if (!$this->check_bbcode('flash', $in))
{
return $in;
}
$in = trim($in);
$error = false;
// Do not allow 0-sizes generally being entered
if ($width <= 0 || $height <= 0)
{
return '[flash=' . $width . ',' . $height . ']' . $in . '[/flash]';
}
$in = str_replace(' ', '%20', $in);
// Make sure $in is a URL.
if (!preg_match('#^' . get_preg_expression('url') . '$#iu', $in) &&
!preg_match('#^' . get_preg_expression('www_url') . '$#iu', $in))
{
return '[flash=' . $width . ',' . $height . ']' . $in . '[/flash]';
}
// Apply the same size checks on flash files as on images
if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width'])
{
if ($config['max_' . $this->mode . '_img_height'] && $config['max_' . $this->mode . '_img_height'] < $height)
{
$error = true;
$this->warn_msg[] = $user->lang('MAX_FLASH_HEIGHT_EXCEEDED', (int) $config['max_' . $this->mode . '_img_height']);
}
if ($config['max_' . $this->mode . '_img_width'] && $config['max_' . $this->mode . '_img_width'] < $width)
{
$error = true;
$this->warn_msg[] = $user->lang('MAX_FLASH_WIDTH_EXCEEDED', (int) $config['max_' . $this->mode . '_img_width']);
}
}
if ($error || $this->path_in_domain($in))
{
return '[flash=' . $width . ',' . $height . ']' . $in . '[/flash]';
}
return '[flash=' . $width . ',' . $height . ':' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($in) . '[/flash:' . $this->bbcode_uid . ']';
}
/**
* Parse inline attachments [ia]
*/
@@ -1100,7 +1041,6 @@ class parse_message extends bbcode_firstpass
var $message_status = '';
var $allow_img_bbcode = true;
var $allow_flash_bbcode = true;
var $allow_quote_bbcode = true;
var $allow_url_bbcode = true;
@@ -1123,7 +1063,7 @@ class parse_message extends bbcode_firstpass
/**
* Parse Message
*/
function parse($allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $update_this_message = true, $mode = 'post')
function parse($allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $update_this_message = true, $mode = 'post')
{
global $config, $user, $phpbb_dispatcher, $phpbb_container;
@@ -1138,7 +1078,6 @@ class parse_message extends bbcode_firstpass
}
$this->allow_img_bbcode = $allow_img_bbcode;
$this->allow_flash_bbcode = $allow_flash_bbcode;
$this->allow_quote_bbcode = $allow_quote_bbcode;
$this->allow_url_bbcode = $allow_url_bbcode;
@@ -1182,7 +1121,6 @@ class parse_message extends bbcode_firstpass
* @var bool allow_magic_url Do we allow magic urls
* @var bool allow_smilies Do we allow smilies
* @var bool allow_img_bbcode Do we allow image BBCode
* @var bool allow_flash_bbcode Do we allow flash BBCode
* @var bool allow_quote_bbcode Do we allow quote BBCode
* @var bool allow_url_bbcode Do we allow url BBCode
* @var bool update_this_message Do we alter the parsed message
@@ -1194,6 +1132,7 @@ class parse_message extends bbcode_firstpass
* @var array warn_msg Array of the warning messages
* @since 3.1.2-RC1
* @changed 3.1.3-RC1 Added vars $bbcode_bitfield and $bbcode_uid
* @changed 4.0.0-a1 Removed $allow_flash_bbcode
*/
$message = $this->message;
$warn_msg = $this->warn_msg;
@@ -1205,7 +1144,6 @@ class parse_message extends bbcode_firstpass
'allow_magic_url',
'allow_smilies',
'allow_img_bbcode',
'allow_flash_bbcode',
'allow_quote_bbcode',
'allow_url_bbcode',
'update_this_message',
@@ -1234,7 +1172,6 @@ class parse_message extends bbcode_firstpass
($allow_magic_url) ? $parser->enable_magic_url() : $parser->disable_magic_url();
($allow_smilies) ? $parser->enable_smilies() : $parser->disable_smilies();
($allow_img_bbcode) ? $parser->enable_bbcode('img') : $parser->disable_bbcode('img');
($allow_flash_bbcode) ? $parser->enable_bbcode('flash') : $parser->disable_bbcode('flash');
($allow_quote_bbcode) ? $parser->enable_bbcode('quote') : $parser->disable_bbcode('quote');
($allow_url_bbcode) ? $parser->enable_bbcode('url') : $parser->disable_bbcode('url');
@@ -1343,7 +1280,7 @@ class parse_message extends bbcode_firstpass
if (!preg_match('/^<[rt][ >]/', $this->message))
{
// Force updating message - of course.
$this->parse($allow_bbcode, $allow_magic_url, $allow_smilies, $this->allow_img_bbcode, $this->allow_flash_bbcode, $this->allow_quote_bbcode, $this->allow_url_bbcode, true);
$this->parse($allow_bbcode, $allow_magic_url, $allow_smilies, $this->allow_img_bbcode, $this->allow_quote_bbcode, $this->allow_url_bbcode, true);
}
// There's a bug when previewing a topic with no poll, because the empty title of the poll
@@ -1919,7 +1856,7 @@ class parse_message extends bbcode_firstpass
foreach ($poll['poll_options'] as &$poll_option)
{
$this->message = $poll_option;
$poll_option = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false, 'poll');
$poll_option = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, $config['allow_post_links'], false, 'poll');
}
unset($poll_option);
$poll['poll_option_text'] = implode("\n", $poll['poll_options']);
@@ -1936,7 +1873,7 @@ class parse_message extends bbcode_firstpass
{
$this->warn_msg[] = $user->lang['POLL_TITLE_TOO_LONG'];
}
$poll['poll_title'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false, 'poll');
$poll['poll_title'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, $config['allow_post_links'], false, 'poll');
if (strlen($poll['poll_title']) > 255)
{
$this->warn_msg[] = $user->lang['POLL_TITLE_COMP_TOO_LONG'];