Skip to content
Snippets Groups Projects
Commit 590de5f7 authored by naudefj's avatar naudefj
Browse files

#163992 by mindless: fix regexp errors/ prevent variable expansion

parent 9fc2c26f
Branches master
Tags 7.x-3.0
No related merge requests found
......@@ -65,7 +65,7 @@ Additional tags:
------------------------------------------------------------------------------
Here are some tags that's not part of the official BBCode implementation.
You may want to add them to your bbcode-filter.inc
You may want to add them to your bbcode-filter.inc file:
- '#\[move(?::\w+)?\](.*?)\[/move(?::\w+)?\]#si' => '<marquee>\\1</marquee>',
......
......@@ -75,7 +75,7 @@ function _bbcode_filter_process(&$body, $format = -1) {
$arr = array(
'tag' => 'size',
'pattern' => '#\[\x07=([\d]+)(?::\w+)?\]([^\x07]*)\[/\x07(?::\w+)?\]#esi',
'replacement' => '"<span style=\"font-size:". _bbcode_round_size_val("$1") ."px\">". stripslashes("$2") ."</span>"',
'replacement' => '"<span style=\"font-size:". _bbcode_round_size_val(\'$1\') ."px\">". str_replace(\'\"\', \'"\', \'$2\') ."</span>"',
'text' => $body);
$body = _bbcode_replace_nest_tag($arr);
} // end processing for [size]
......@@ -127,7 +127,7 @@ function _bbcode_filter_process(&$body, $format = -1) {
// replace to <ol>/<ul> and </ol>/</ul> tags
// It will be better to use &count and do-while, if php 5 or higher.
while (preg_match("#\[\x07[=]*((?-i)[cds1aAiI])*(?::\w+)?\]([^\x07]*)\[/\x07(?::\w+)?\]#si", $body)) {
$body = preg_replace("#\[\x07[=]*((?-i)[cds1aAiI])*(?::\w+)?\]([^\x07]*)\[/\x07(?::\w+)?\]#esi", '"<". $l_type["$1"]["tag"] ." class=\"bb-list\" style=\"list-style-type:". $l_type["$1"]["style"] .";\">". "$2" ."</". $l_type["$1"]["tag"] .">"', $body);
$body = preg_replace("#\[\x07[=]*((?-i)[cds1aAiI])*(?::\w+)?\]([^\x07]*)\[/\x07(?::\w+)?\]#esi", '"<". $l_type[\'$1\']["tag"] ." class=\"bb-list\" style=\"list-style-type:". $l_type[\'$1\']["style"] .";\">". str_replace(\'\"\', \'"\', \'$2\') ."</". $l_type[\'$1\']["tag"] .">"', $body);
}
// remove <br /> tags
......
......@@ -22,6 +22,7 @@ Test [size=1]1px[/size] - too small, normalized to 6px
Test [size=12]12px[/size] text
Test [size=24]24px[/size] text
Test [size=100]100px[/size] - too big, normalized to 48px
[size=10] $_SERVER[PHP_SELF] "quoted" \\e\s\c\aped\" [/size] - watch out for eval
[h3]Font faces[/h3]
Test [font=arial]Arial typeface[/font] text
......@@ -172,14 +173,14 @@ Roman uppercase list (list=I):
[*]z
[/list]
Alfa lowercase list (list=a):
Alpha lowercase list (list=a):
[list=a]
[*]x
[*]y
[*]z
[/list]
Alfa uppercase list (list=A):
Alpha uppercase list (list=A):
[list=A]
[*]x
[*]y
......@@ -217,6 +218,9 @@ Complex nexted list:
[/list]
[/list]
List with php content (watch out for eval):
[list][*] {$var $_SERVER[PHP_SELF] "quoted" \\e\s\c\aped\" [/list]
[h3]Table tags[/h3]
[table]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment