From f2d0ac7341aaa2ba7522256c728e01a1da1af7f9 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Wed, 23 Apr 2025 19:34:49 +0200 Subject: [PATCH 1/3] functions.php: minor format --- inc/functions.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index a37e2001..11a1a40b 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2228,20 +2228,15 @@ function markup(&$body, $track_cites = false) { $clauses = array_unique($clauses); if ($board['uri'] != $_board) { - if (!openBoard($_board)){ - if (in_array($_board,array_keys($config['boards_alias']))){ - $_board = $config['boards_alias'][$_board]; - if (openBoard($_board)){ - - } - else { + if (!openBoard($_board)) { + if (\in_array($_board, \array_keys($config['boards_alias']))) { + $_board = $config['boards_alias'][$_board]; + if (!openBoard($_board)) { continue; // Unknown board - } - } - else { + } + } else { continue; // Unknown board } - } } From 439730f216e2fb0b4485b731535e7f7f4e2158d8 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Wed, 23 Apr 2025 19:52:10 +0200 Subject: [PATCH 2/3] 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]); } } From a28d9a42463c76e646fe4e7b4ed679cc2f5a6311 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Wed, 23 Apr 2025 19:55:19 +0200 Subject: [PATCH 3/3] functions.php: minor code semplification for crossbooard citations --- inc/functions.php | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 6c0c6033..c9f6657e 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2277,31 +2277,22 @@ function markup(&$body, $track_cites = false) { if ($cite) { if (isset($cited_posts[$_board][$cite])) { $link = $cited_posts[$_board][$cite]; - if (isset($original_board)){ - $replacement = '' . - '>>>/' . $original_board . '/' . $cite . + '>>>/' . $replacement_board . '/' . $cite . ''; + if ($track_cites && $config['track_cites']) { + $tracked_cites[] = [ $_board, $cite ]; } - else { - $replacement = '' . - '>>>/' . $_board . '/' . $cite . - ''; - - } - - if ($track_cites && $config['track_cites']) - $tracked_cites[] = array($_board, $cite); } else { $replacement = ">>>/$_board/$cite"; } - } elseif(isset($crossboard_indexes[$_board])) { + } elseif (isset($crossboard_indexes[$_board])) { $replacement = '' . '>>>/' . $_board . '/' . '';