Use function for rewrite_body.

This commit is contained in:
Retro_Guy 2024-10-10 05:04:24 -07:00
parent 0105aaacee
commit bc9001203a
2 changed files with 12 additions and 13 deletions

View File

@ -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, '<a href="' . $linkurl . '" rel="nofollow" target="_blank">' . $url . '</a>', $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 '</blockquote>';

View File

@ -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), "<br />\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));
}