From bc9001203ae4017fd51eaa376e78f09cc613b8f0 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Thu, 10 Oct 2024 05:04:24 -0700 Subject: [PATCH] Use function for rewrite_body. --- Rocksolid_Light/rocksolid/newsportal.php | 13 +++++++++---- Rocksolid_Light/rocksolid/overboard.php | 12 +++--------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Rocksolid_Light/rocksolid/newsportal.php b/Rocksolid_Light/rocksolid/newsportal.php index facdff3..70c4555 100644 --- a/Rocksolid_Light/rocksolid/newsportal.php +++ b/Rocksolid_Light/rocksolid/newsportal.php @@ -1130,6 +1130,14 @@ function html_parse($text) return ($ntext); } +function rewrite_body($text) { + global $config_dir; + if (file_exists($config_dir . '/rewrite_body.inc.php')) { + include($config_dir . '/rewrite_body.inc.php'); + } + return $text; +} + function display_links_in_body($text) { global $config_dir; @@ -1152,10 +1160,7 @@ function display_links_in_body($text) $pattern = "!$pattern!"; $text = preg_replace($pattern, '' . $url . '', $text, 1); } - if (file_exists($config_dir . '/rewrite_body.inc.php')) { - include($config_dir . '/rewrite_body.inc.php'); - } - + $text = rewrite_body($text); echo $text; if ($isquote) { echo ''; diff --git a/Rocksolid_Light/rocksolid/overboard.php b/Rocksolid_Light/rocksolid/overboard.php index 71e117f..96d4085 100644 --- a/Rocksolid_Light/rocksolid/overboard.php +++ b/Rocksolid_Light/rocksolid/overboard.php @@ -379,9 +379,7 @@ function display_threads($threads, $oldest) $article = get_db_data_from_msgid($target_head['msgid'], $target_head['newsgroup'], 1); $text = $article['search_snippet']; - if (file_exists($config_dir . '/rewrite_body.inc.php')) { - include ($config_dir . '/rewrite_body.inc.php'); - } + $text = rewrite_body($text); $display .= strip_tags(wordwrap(substr($text, 0, $snippetlength), ($snippetlength / 2), "
\n", true)); } } @@ -420,9 +418,7 @@ function display_threads($threads, $oldest) if ($CONFIG['article_database'] == '1') { $article = get_db_data_from_msgid($target['msgid'], $target['newsgroup'], 1); $text = $article['search_snippet']; - if (file_exists($config_dir . '/rewrite_body.inc.php')) { - include ($config_dir . '/rewrite_body.inc.php'); - } + $text = rewrite_body($text); $display .= strip_tags(html_parse(text2html(substr($text, 0, $snippetlength)))); // $display .= strip_tags(htmlentities(substr($text, 0, $snippetlength))); } @@ -559,9 +555,7 @@ function display_flat($threads, $oldest) if ($CONFIG['article_database'] == '1') { $article = get_db_data_from_msgid($target['msgid'], $target['newsgroup'], 1); $text = $article['search_snippet']; - if (file_exists($config_dir . '/rewrite_body.inc.php')) { - include ($config_dir . '/rewrite_body.inc.php'); - } + $text = rewrite_body($text); $display .= strip_tags(html_parse(text2html(substr($text, 0, $snippetlength)))); //$display .= htmlentities(substr($text, 0, $snippetlength)); }