1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +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

@@ -136,7 +136,6 @@ class data_access
'list' => 9,
'*' => 9,
'email' => 10,
'flash' => 11,
'attachment' => 12,
);

View File

@@ -37,13 +37,6 @@ interface renderer_interface
*/
public function get_viewcensors();
/**
* Return the value of the "viewflash" option
*
* @return bool Option's value
*/
public function get_viewflash();
/**
* Return the value of the "viewimg" option
*
@@ -66,14 +59,6 @@ interface renderer_interface
*/
public function set_viewcensors($value);
/**
* Set the "viewflash" option
*
* @param bool $value Option's value
* @return null
*/
public function set_viewflash($value);
/**
* Set the "viewimg" option
*

View File

@@ -57,7 +57,6 @@ class factory implements \phpbb\textformatter\cache_interface
*/
protected $custom_tokens = array(
'email' => array('{DESCRIPTION}' => '{TEXT}'),
'flash' => array('{WIDTH}' => '{NUMBER1}', '{HEIGHT}' => '{NUMBER2}'),
'img' => array('{URL}' => '{IMAGEURL}'),
'list' => array('{LIST_TYPE}' => '{HASHMAP}'),
'quote' => array('{USERNAME}' => '{TEXT1}'),
@@ -79,7 +78,6 @@ class factory implements \phpbb\textformatter\cache_interface
'code' => '[CODE lang={IDENTIFIER;optional}]{TEXT}[/CODE]',
'color' => '[COLOR={COLOR}]{TEXT}[/COLOR]',
'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}]',
'list' => '[LIST type={HASHMAP=1:decimal,a:lower-alpha,A:upper-alpha,i:lower-roman,I:upper-roman;optional;postFilter=#simpletext} #createChild=LI]{TEXT}[/LIST]',
@@ -268,18 +266,6 @@ class factory implements \phpbb\textformatter\cache_interface
$filter = new RegexpFilter('!^([\p{L}\p{N}\-+,_. ]+)$!Du');
$configurator->attributeFilters->add('#inttext', $filter);
// Create custom filters for Flash restrictions, which use the same values as the image
// restrictions but have their own error message
$configurator->attributeFilters
->add('#flashheight', __NAMESPACE__ . '\\parser::filter_flash_height')
->addParameterByName('max_img_height')
->addParameterByName('logger');
$configurator->attributeFilters
->add('#flashwidth', __NAMESPACE__ . '\\parser::filter_flash_width')
->addParameterByName('max_img_width')
->addParameterByName('logger');
// Create a custom filter for phpBB's per-mode font size limits
$configurator->attributeFilters
->add('#fontsize', __NAMESPACE__ . '\\parser::filter_font_size')
@@ -306,8 +292,8 @@ class factory implements \phpbb\textformatter\cache_interface
$configurator->tags['QUOTE']->nestingLimit = PHP_INT_MAX;
}
// Modify the template to disable images/flash/mentions depending on user's settings
foreach (array('FLASH', 'IMG', 'MENTION') as $name)
// Modify the template to disable images/mentions depending on user's settings
foreach (['IMG', 'MENTION'] as $name)
{
$tag = $configurator->tags[$name];
$tag->template = '<xsl:choose><xsl:when test="$S_VIEW' . $name . '">' . $tag->template . '</xsl:when><xsl:otherwise><xsl:apply-templates/></xsl:otherwise></xsl:choose>';

View File

@@ -218,7 +218,7 @@ class parser implements \phpbb\textformatter\parser_interface
{
$errors[] = array($msg, $context['max_size']);
}
else if (preg_match('/^MAX_(?:FLASH|IMG)_(HEIGHT|WIDTH)_EXCEEDED$/D', $msg, $m))
else if (preg_match('/^MAX_IMG_(HEIGHT|WIDTH)_EXCEEDED$/D', $msg, $m))
{
$errors[] = array($msg, $context['max_' . strtolower($m[1])]);
}
@@ -301,50 +301,6 @@ class parser implements \phpbb\textformatter\parser_interface
}
}
/**
* Filter a flash object's height
*
* @see bbcode_firstpass::bbcode_flash()
*
* @param string $height
* @param integer $max_height
* @param Logger $logger
* @return mixed Original value if valid, FALSE otherwise
*/
public static function filter_flash_height($height, $max_height, Logger $logger)
{
if ($max_height && $height > $max_height)
{
$logger->err('MAX_FLASH_HEIGHT_EXCEEDED', array('max_height' => $max_height));
return false;
}
return $height;
}
/**
* Filter a flash object's width
*
* @see bbcode_firstpass::bbcode_flash()
*
* @param string $width
* @param integer $max_width
* @param Logger $logger
* @return mixed Original value if valid, FALSE otherwise
*/
public static function filter_flash_width($width, $max_width, Logger $logger)
{
if ($max_width && $width > $max_width)
{
$logger->err('MAX_FLASH_WIDTH_EXCEEDED', array('max_width' => $max_width));
return false;
}
return $width;
}
/**
* Filter the value used in a [size] BBCode
*

View File

@@ -48,11 +48,6 @@ class renderer implements \phpbb\textformatter\renderer_interface
*/
protected $viewcensors = false;
/**
* @var bool Status of the viewflash option
*/
protected $viewflash = false;
/**
* @var bool Status of the viewimg option
*/
@@ -167,7 +162,7 @@ class renderer implements \phpbb\textformatter\renderer_interface
/**
* Configure this renderer as per the user's settings
*
* Should set the locale as well as the viewcensor/viewflash/viewimg/viewsmilies options.
* Should set the locale as well as the viewcensor/viewimg/viewsmilies options.
*
* @param \phpbb\user $user
* @param \phpbb\config\config $config
@@ -179,7 +174,6 @@ class renderer implements \phpbb\textformatter\renderer_interface
$censor = $user->optionget('viewcensors') || !$config['allow_nocensors'] || !$auth->acl_get('u_chgcensors');
$this->set_viewcensors($censor);
$this->set_viewflash($user->optionget('viewflash'));
$this->set_viewimg($user->optionget('viewimg'));
$this->set_viewsmilies($user->optionget('viewsmilies'));
$this->set_usemention($config['allow_mentions'] && $auth->acl_get('u_mention'));
@@ -221,14 +215,6 @@ class renderer implements \phpbb\textformatter\renderer_interface
return $this->viewcensors;
}
/**
* {@inheritdoc}
*/
public function get_viewflash()
{
return $this->viewflash;
}
/**
* {@inheritdoc}
*/
@@ -310,15 +296,6 @@ class renderer implements \phpbb\textformatter\renderer_interface
$this->renderer->setParameter('S_VIEWCENSORS', $value);
}
/**
* {@inheritdoc}
*/
public function set_viewflash($value)
{
$this->viewflash = $value;
$this->renderer->setParameter('S_VIEWFLASH', $value);
}
/**
* {@inheritdoc}
*/