From 3dfb0bcae979e62cbf928c7a05eb1ae568c4ae33 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 6 Sep 2022 09:21:39 +0000 Subject: do not wrap multi line code blocks into pre tag --- include/bbcode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/bbcode.php') diff --git a/include/bbcode.php b/include/bbcode.php index 794cb25d0..7c2ba30f8 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -947,7 +947,7 @@ function bb_code_unprotect_sub($match) { function bb_code($match) { if(strpos($match[0], PHP_EOL)) - return '
' . bb_code_protect(trim($match[1])) . '
'; + return '' . bb_code_protect(trim($match[1])) . ''; else return '' . bb_code_protect(trim($match[1])) . ''; } -- cgit v1.2.3 From 1a75066616c3723bd546c474c4e336805c8125da Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 6 Sep 2022 10:27:01 +0000 Subject: revert: do not wrap multi line code blocks into pre tag --- include/bbcode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/bbcode.php') diff --git a/include/bbcode.php b/include/bbcode.php index 7c2ba30f8..794cb25d0 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -947,7 +947,7 @@ function bb_code_unprotect_sub($match) { function bb_code($match) { if(strpos($match[0], PHP_EOL)) - return '' . bb_code_protect(trim($match[1])) . ''; + return '
' . bb_code_protect(trim($match[1])) . '
'; else return '' . bb_code_protect(trim($match[1])) . ''; } -- cgit v1.2.3 From fcfb9e975836c4abbbfd339d46bf8ea937747e57 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 7 Sep 2022 12:50:46 +0000 Subject: fix random php warnings --- include/bbcode.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'include/bbcode.php') diff --git a/include/bbcode.php b/include/bbcode.php index 794cb25d0..100991afd 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -502,32 +502,37 @@ function bb_ShareAttributes($match) { $author = ""; preg_match("/author='(.*?)'/ism", $attributes, $matches); - if ($matches[1] != "") + if (isset($matches[1]) && $matches[1] !== '') { $author = urldecode($matches[1]); + } $link = ""; preg_match("/link='(.*?)'/ism", $attributes, $matches); - if ($matches[1] != "") + if (isset($matches[1]) && $matches[1] !== '') { $link = $matches[1]; + } $avatar = ""; preg_match("/avatar='(.*?)'/ism", $attributes, $matches); - if ($matches[1] != "") + if (isset($matches[1]) && $matches[1] !== '') { $avatar = $matches[1]; + } $profile = ""; preg_match("/profile='(.*?)'/ism", $attributes, $matches); - if ($matches[1] != "") + if (isset($matches[1]) && $matches[1] !== '') { $profile = $matches[1]; + } $posted = ""; preg_match("/posted='(.*?)'/ism", $attributes, $matches); - if ($matches[1] != "") + if (isset($matches[1]) && $matches[1] !== '') { $posted = $matches[1]; + } $auth = ""; preg_match("/auth='(.*?)'/ism", $attributes, $matches); - if ($matches[1] != "") { + if (isset($matches[1]) && $matches[1] !== '') { if($matches[1] === 'true') $auth = true; else -- cgit v1.2.3 From 990a3af2a7349e07c10224cf2a023d179ecfd6ca Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 8 Sep 2022 20:02:22 +0000 Subject: php8: random cleanup and warning fixes --- include/bbcode.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'include/bbcode.php') diff --git a/include/bbcode.php b/include/bbcode.php index 100991afd..6ec24fa0b 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -367,26 +367,30 @@ function bb_format_attachdata($body) { if($data) { $txt = ''; - if($data['url'] && $data['title']) { + if(isset($data['url']) && isset($data['title'])) { $txt .= "\n\n" . '[url=' . $data['url'] . ']' . $data['title'] . '[/url]'; } else { - if($data['url']) { + if(isset($data['url'])) { $txt .= "\n\n" . $data['url']; } - if($data['title']) { + if(isset($data['title'])) { $txt .= "\n\n" . $data['title']; } } - if($data['preview']) { + + if(isset($data['preview'])) { $txt .= "\n\n" . '[img]' . $data['preview'] . '[/img]'; } - if($data['image']) { + + if(isset($data['image'])) { $txt .= "\n\n" . '[img]' . $data['image'] . '[/img]'; } + if(isset($data['text'])) { + $txt .= "\n\n" . $data['text']; + } - $txt .= "\n\n" . $data['text']; return preg_replace('/\[attachment(.*?)\](.*?)\[\/attachment\]/ism',$txt,$body); } -- cgit v1.2.3