From 439730f216e2fb0b4485b731535e7f7f4e2158d8 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Wed, 23 Apr 2025 19:52:10 +0200 Subject: [PATCH] functions.php: add crossboard strikethrough for invalid cites --- inc/functions.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 11a1a40b..6c0c6033 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2296,19 +2296,21 @@ function markup(&$body, $track_cites = false) { } - $body = mb_substr_replace($body, $matches[1][0] . $replacement . $matches[4][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0])); - $skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[4][0]) - mb_strlen($matches[0][0]); - if ($track_cites && $config['track_cites']) $tracked_cites[] = array($_board, $cite); + } else { + $replacement = ">>>/$_board/$cite"; } } elseif(isset($crossboard_indexes[$_board])) { $replacement = '' . '>>>/' . $_board . '/' . ''; - $body = mb_substr_replace($body, $matches[1][0] . $replacement . $matches[4][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0])); - $skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[4][0]) - mb_strlen($matches[0][0]); + } else { + $replacement = ">>>/$_board/$cite"; } + + $body = mb_substr_replace($body, $matches[1][0] . $replacement . $matches[4][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0])); + $skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[4][0]) - mb_strlen($matches[0][0]); } }