From 92f3c5ae2191dbffcc327dd1068e692467dc24dd Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 18 Feb 2021 09:36:22 +0000 Subject: backward compatibility with recent crypto changes --- include/bbcode.php | 66 +++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'include/bbcode.php') diff --git a/include/bbcode.php b/include/bbcode.php index 6bb33671e..2832a7627 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -80,7 +80,7 @@ function tryoembed($match) { return $match[0]; $html = oembed_format_object($o); - return $html; + return $html; } @@ -92,7 +92,7 @@ function nakedoembed($match) { // this function no longer performs oembed on naked links // because they author may have created naked links intentionally. // Now it just strips zids on naked links. - + return str_replace($url,$strip_url,$match[0]); } @@ -283,7 +283,7 @@ function bb_svg($match) { $params = str_replace(['
', '"'], [ '', '"'],$match[1]); $Text = str_replace([ '[',']' ], [ '<','>' ], $match[2]); - + $output = '' . str_replace(['
', '"', ' '], [ '', '"', ' '],$Text) . ''; $purify = new SvgSanitizer(); @@ -641,24 +641,24 @@ function bb_definitionList($match) { // The bbcode transformation will be: // [*=term-text] description-text =>
term-text
description-text - // then after all replacements have been made, the extra
at the start of the + // then after all replacements have been made, the extra at the start of the // first line can be removed. HTML5 allows the tag to be missing from the end of the last line. // Using '(?\n"; $eatLeadingSpaces = '(?: |[ \t])*'; // prevent spaces infront of [*= from adding another line to the previous element $listElements = preg_replace('/^(\n|
)/', '', $match[2]); // ltrim the first newline $listElements = preg_replace( - '/' . $eatLeadingSpaces . '\[\*=([[:print:]]*?)(?$1
', + '/' . $eatLeadingSpaces . '\[\*=([[:print:]]*?)(?$1
', $listElements ); // Unescape any \] inside the
tags $listElements = preg_replace_callback('/
(.*?)<\/dt>/ism', 'bb_definitionList_unescapeBraces', $listElements); - + // Remove the extra at the start of the string, if there is one. $firstOpenTag = strpos($listElements, '
'); $firstCloseTag = strpos($listElements, $closeDescriptionTag); - if ($firstCloseTag !== false && ($firstOpenTag === false || ($firstCloseTag < $firstOpenTag))) { + if ($firstCloseTag !== false && ($firstOpenTag === false || ($firstCloseTag < $firstOpenTag))) { $listElements = preg_replace( '/<\/dd>/ism', '', $listElements, 1); } @@ -802,7 +802,7 @@ function bb_imgoptions($match) { // $Text = preg_replace_callback("/\[([zi])mg([ \=])(.*?)\](.*?)\[\/[zi]mg\]/ism",'bb_imgoptions',$Text); // alt text cannot contain ']' - + // [img|zmg=wwwxhhh float=left|right alt=alt text]url[/img|zmg] $local_match = null; @@ -818,7 +818,7 @@ function bb_imgoptions($match) { if ($x) { $alt = $matches[1]; } - + $x = preg_match("/alt=\"\;(.*?)\"\;/ism", $attributes, $matches); if ($x) { $alt = $matches[1]; @@ -828,7 +828,7 @@ function bb_imgoptions($match) { if ($x) { $width = $matches[1]; } - + $x = preg_match("/width=\"\;(.*?)\"\;/ism", $attributes, $matches); if ($x) { $width = $matches[1]; @@ -838,7 +838,7 @@ function bb_imgoptions($match) { if ($x) { $height = $matches[1]; } - + $x = preg_match("/height=\"\;(.*?)\"\;/ism", $attributes, $matches); if ($x) { $height = $matches[1]; @@ -848,14 +848,14 @@ function bb_imgoptions($match) { if ($x) { $style = $matches[1]; } - + $x = preg_match("/style=\"\;(.*?)\"\;/ism", $attributes, $matches); if ($x) { $style = $matches[1]; } // legacy img options - + if ($match[2] === '=') { // pull out (optional) legacy size declarations first if (preg_match("/([0-9]*)x([0-9]*)/ism",$match[3],$local_match)) { @@ -873,16 +873,16 @@ function bb_imgoptions($match) { $float = 'right'; $match[3] = substr($match[3],$n + 11); } - + // finally alt text which extends to the close of the tag if ((! $alt) && ($n = strpos($match[3],'alt=') !== false)) { $alt = substr($match[3],$n + 4); } // now assemble the resulting img tag from these components - + $output = ''; - + return $output; - + } function bb_code_protect($s) { @@ -935,7 +935,7 @@ function bb_code_options($match) { } if($pre) { return '
' . bb_code_protect(trim($match[2])) . '
'; - } else { + } else { return '' . bb_code_protect(trim($match[2])) . ''; } } @@ -949,7 +949,7 @@ function bb_fixtable_lf($match) { // remove extraneous whitespace between table element tags since newlines will all // be converted to '
' and turn your neatly crafted tables into a whole lot of // empty space. - + $x = preg_replace("/\]\s+\[/",'][',$match[1]); return '[table]' . $x . '[/table]'; @@ -991,7 +991,7 @@ function parseIdentityAwareHTML($Text) { } if (strpos($Text,'[pre]') !== false) { $Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_spacefy',$Text); - } + } // process [observer] tags before we do anything else because we might // be stripping away stuff that then doesn't need to be worked on anymore @@ -1012,7 +1012,7 @@ function parseIdentityAwareHTML($Text) { $Text = preg_replace("/\[observer\=0\](.*?)\[\/observer\]/ism", '$1', $Text); $Text = preg_replace("/\[rpost(=.*?)?\](.*?)\[\/rpost\]/ism", '', $Text); } - } + } // replace [observer.baseurl] if ($observer) { $s1 = ''; @@ -1033,11 +1033,11 @@ function parseIdentityAwareHTML($Text) { $Text = str_replace('[observer.webname]','',$Text); $Text = str_replace('[observer.photo]','', $Text); } - + $Text = str_replace(array('[baseurl]','[sitename]'),array(z_root(),get_config('system','sitename')),$Text); - - // Unhide all [noparse] contained bbtags unspacefying them + + // Unhide all [noparse] contained bbtags unspacefying them // and triming the [noparse] tag. if (strpos($Text,'[noparse]') !== false) { $Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_unspacefy_and_trim', $Text); @@ -1251,7 +1251,7 @@ function bbcode($Text, $options = []) { $Text = preg_replace("/\[map\]/", '
', $Text); } } - + // Check for bold text if (strpos($Text,'[b]') !== false) { $Text = preg_replace("(\[b\](.*?)\[\/b\])ism", '$1', $Text); @@ -1377,8 +1377,8 @@ function bbcode($Text, $options = []) { $Text = preg_replace("/\[li\](.*?)\[\/li\]/ism", '
  • $1
  • ', $Text); // [dl] tags have an optional [dl terms="bi"] form where bold/italic/underline/mono/large - // etc. style may be specified for the "terms" in the definition list. The quotation marks - // are also optional. The regex looks intimidating, but breaks down as: + // etc. style may be specified for the "terms" in the definition list. The quotation marks + // are also optional. The regex looks intimidating, but breaks down as: // "[dl" "]" "[/dl]" // where optional-termStyles are: "terms=" $Text = preg_replace_callback('/\[dl[[:space:]]*(?:terms=(?:"|")?([a-zA-Z]+)(?:"|")?)?\](.*?)\[\/dl\]/ism', 'bb_definitionList', $Text); @@ -1564,7 +1564,7 @@ function bbcode($Text, $options = []) { // If we found an event earlier, strip out all the event code and replace with a reformatted version. // Replace the event-start section with the entire formatted event. The other bbcode is stripped. - // Summary (e.g. title) is required, earlier revisions only required description (in addition to + // Summary (e.g. title) is required, earlier revisions only required description (in addition to // start which is always required). Allow desc with a missing summary for compatibility. if ((x($ev,'desc') || x($ev,'summary')) && x($ev,'dtstart')) { @@ -1573,7 +1573,7 @@ function bbcode($Text, $options = []) { $sub = str_replace('$',"\0",$sub); - $Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/ism",$sub,$Text); + $Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/ism",$sub,$Text); $Text = preg_replace("/\[event\](.*?)\[\/event\]/ism",'',$Text); $Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism",'',$Text); @@ -1588,7 +1588,7 @@ function bbcode($Text, $options = []) { } - // Unhide all [noparse] contained bbtags unspacefying them + // Unhide all [noparse] contained bbtags unspacefying them // and triming the [noparse] tag. if (strpos($Text,'[noparse]') !== false) { $Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_unspacefy_and_trim', $Text); -- cgit v1.2.3