Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

### Security
- BBCode plugin: update to version 2.0.4
- An XSS vulnerability in the BBCode plugin has been fixed. ([#941](https://github.com/flatpressblog/flatpress/pull/941))
- An XSS vulnerability in the BBCode plugin has been fixed. ([#941](https://github.com/flatpressblog/flatpress/pull/941), [#945](https://github.com/flatpressblog/flatpress/pull/945))

## Themes
### Changes
Expand Down
24 changes: 13 additions & 11 deletions fp-plugins/bbcode/plugin.bbcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,11 @@ function do_bbcode_img($action, $attributes, $content, $params, $node_object) {
}
}

// Calculating the "loading" attribute of the image.
// For details, see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
// -> "lazy" is default (see https://developer.mozilla.org/en-US/docs/Web/Performance/Lazy_loading)
/**
* Calculating the "loading" attribute of the image.
* For details, see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
* -> "lazy" is default (see https://developer.mozilla.org/en-US/docs/Web/Performance/Lazy_loading)
*/
$loadingValue = 'lazy';
// Use img attribute value if explicitly set
if (isset($attributes ['loading'])) {
Expand Down Expand Up @@ -808,7 +810,8 @@ function do_bbcode_color($action, $attributes, $content, $params, $node_object)
if ($action == 'validate') {
return true;
}
return '<span style="color:' . $attributes ['default'] . ';">' . $content . '</span>';
$color = isset($attributes ['default']) ? $attributes ['default'] : '';
return '<span style="color:' . plugin_bbcode_escape_html_attribute($color) . ';">' . $content . '</span>';
}

/**
Expand Down Expand Up @@ -871,7 +874,8 @@ function do_bbcode_size($action, $attributes, $content, $params, $node_object) {
if ($action == 'validate') {
return true;
}
return '<span style="font-size:' . $attributes ['default'] . ';">' . $content . '</span>';
$size = isset($attributes ['default']) ? $attributes ['default'] : '';
return '<span style="font-size:' . plugin_bbcode_escape_html_attribute($size) . ';">' . $content . '</span>';
}

/**
Expand All @@ -887,7 +891,8 @@ function do_bbcode_size($action, $attributes, $content, $params, $node_object) {
* @return string
*/
function do_bbcode_align($action, $attr, $content, $params, $node_object) {
return '<div style="text-align:' . $attr ['default'] . '">' . $content . '</div>';
$align = isset($attr ['default']) ? $attr ['default'] : '';
return '<div style="text-align:' . plugin_bbcode_escape_html_attribute($align) . '">' . $content . '</div>';
}

/**
Expand Down Expand Up @@ -958,7 +963,7 @@ function &plugin_bbcode_init() {
$bbcode->setGlobalCaseSensitive(false); // don't care about case sensitivity: img == IMG == Img
$bbcode->setMixedAttributeTypes(true);

/*
/**
* Tags that are same in BBCode and HTML ([i]...[/i] => <i>...</i>)
*/
$bbcode_tags_simple = array(
Expand Down Expand Up @@ -997,7 +1002,7 @@ function &plugin_bbcode_init() {
$bbcode->setCodeFlag($bbtag, 'closetag', BBCODE_CLOSETAG_MUSTEXIST);
}

/*
/**
* other tags
*/
// underlined text
Expand Down Expand Up @@ -1568,9 +1573,6 @@ function plugin_bbcode_undoHtml($text) {
return $text;
}

// ------------------------------------------------------------------------------
// obfuscate mail adresses
// ------------------------------------------------------------------------------
/**
* Obfuscates the given email adress with the given mode.
* Thanks for spam-me-not.php to Rolf Offermanns!
Expand Down