More cleanup in overboard.php

This commit is contained in:
Retro_Guy 2021-03-06 19:06:18 -07:00
parent cc4aaea153
commit ae3db9cec1

View File

@ -60,8 +60,6 @@ $maxdisplay = 1000;
# How many characters of the body to display per article # How many characters of the body to display per article
$snippetlength = 240; $snippetlength = 240;
# How short of a snippet is ok
$snippetshort = 20;
$spoolpath_regexp = '/'.preg_replace('/\//', '\\/', $spoolpath).'/'; $spoolpath_regexp = '/'.preg_replace('/\//', '\\/', $spoolpath).'/';
$thissite = '.'; $thissite = '.';
@ -292,26 +290,15 @@ foreach($files as $article) {
} }
} }
} }
$keywords = preg_split("/\n[^<]{0,5}>/", $mysnippet); $mysnippet = preg_replace('/\n.{0,5}>(.*)/', '', $mysnippet);
$newsnippet = preg_replace('/^.+\n/', '', end($keywords));
$quoteend = strlen($mysnippet) - strlen($newsnippet);
if($quoteend) { $snipstart = strpos($mysnippet, ":\n");
if($quoteend > (strlen($mysnippet) - $snippetshort)) { if(substr_count(trim(substr($mysnippet, 0, $snipstart)), "\n") < 2) {
$quoteend = (strlen($mysnippet) - $snippetlength); $mysnippet = substr($mysnippet, $snipstart + 1, $snippetlength);
if ($quoteend < 0) } else {
$quoteend = 0; $mysnippet = substr($mysnippet, 0, $snippetlength);
$mysnippet = substr($mysnippet, $quoteend); }
$mysnippet = substr($mysnippet, strpos($mysnippet, ' ')); echo "<p class=np_ob_body>".$mysnippet."</p>\r\n";
} else {
$mysnippet = substr($mysnippet, $quoteend);
}
}
$mysnippet = substr($mysnippet, 0, $snippetlength);
$snippet = $mysnippet."<br /><br />\r\n";
$displayresult = explode('<', $snippet);
$echobody=$displayresult[0];
echo "<p class=np_ob_body>".$echobody."</p>\r\n";
echo '</td></tr>'; echo '</td></tr>';
if($results++ > ($maxdisplay - 2)) if($results++ > ($maxdisplay - 2))
break; break;