'; $spoolpath_regexp = '/'.preg_replace('/\//', '\\/', $spoolpath).'/'; $thissite = '.'; $groupconfig=$file_groups; $cachefile=$spooldir."/".$config_name."-overboard.cache"; $oldest = (time() - (86400 * $article_age)); if (isset($_GET['thisgroup'])) { $grouplist = array(); $grouplist[0] = _rawurldecode(_rawurldecode($_GET['thisgroup'])); $cachefile=$cachefile.'.'.$grouplist[0]; } else { $grouplist = file($groupconfig, FILE_IGNORE_NEW_LINES); } /* If cache is less than ? seconds old, use it */ if(is_file($cachefile)) { $stats = stat($cachefile); if($stats[9] > (time() - 60)) { echo file_get_contents($cachefile); exit(0); } } ob_start(); # Iterate through groups $articles = array(); foreach($grouplist as $findgroup) { $groups = explode(" ", $findgroup); $findgroup = $groups[0]; $none=0; $overboard_noshow = explode(' ', $CONFIG['overboard_noshow']); foreach($overboard_noshow as $noshow) { if ((strpos($findgroup, $noshow) !== false) && !isset($_GET['thisgroup'])) { $none=1; break; } } if($none == 1) { continue; } $thisgroup = preg_replace('/\./', '/', $findgroup); if (!is_dir($spoolpath.$thisgroup)) { continue; } $stats = stat($spoolpath.$thisgroup); if($stats[9] > $oldest) { $newarticles = scandir($spoolpath.$thisgroup); foreach($newarticles as $newarticle) { $newarticle = $spoolpath.$thisgroup."/".$newarticle; $stats = stat($newarticle); if($stats[9] > $oldest && $stats[7] > 0) { $articles[] = $newarticle; } } } } if (isset($_GET['thisgroup'])) { echo '

'; echo ''.basename(getcwd()).' / '; echo ''.htmlspecialchars(group_display_name($grouplist[0])).' / '; echo ' latest

'; echo ''; // Refresh button echo ''; // Article List button echo ''; // Newsgroups button (hidden) if(isset($frames_on) && $frames_on === true) { echo ''; } echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; echo '
'; echo ''; echo '
'; echo '
'; } else { echo '

'; echo ''.basename(getcwd()).' / '; echo 'latest messages

'; echo ''; // Refresh button echo ''; // Newsgroups button (hidden) if(isset($frames_on) && $frames_on === true) { echo ''; } echo '
'; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; echo ''; echo '
'; echo '
'; } $results=0; $files = array(); foreach($articles as $article) { if(is_dir($article)) { continue; } $files[filemtime($article)] = $article; } krsort($files); echo ''; //date_default_timezone_set(timezone_name_from_abbr("", $CONFIG['timezone'] * 3600, 0)); foreach($files as $article) { $articledata = file_get_contents($article); $bodystart = strpos($articledata, $localeol); $header = substr($articledata, 0, $bodystart); $body = substr($articledata, $bodystart+1); $body = substr($body, strpos($body, PHP_EOL)); if(($multi = strpos($body, 'Content-Type: text/plain')) != false) { $bodystart = strpos($body, $localeol); $body = substr($body, $bodystart+1); $body = substr($body, strpos($body, PHP_EOL)); } # Find group name and article number $group = preg_replace($spoolpath_regexp, '', $article); $group = preg_replace('/\//', '.', $group); $findme = strrpos($group, '.'); $groupname = substr($group, 0, $findme); $articlenumber = substr($group, $findme+1); # Generate link $url = $thissite."/article-flat.php?id=".$articlenumber."&group="._rawurlencode($groupname)."#".$articlenumber; $groupurl = $thissite."/thread.php?group="._rawurlencode($groupname); preg_match('/Subject:.*/', $header, $subject); $output = explode("Subject: ",$subject[0], 2); preg_match('/Date:.*/', $header, $articledate); $dateoutput = explode("Date: ",$articledate[0]); preg_match('/Content-Transfer-Encoding:.*/', $header, $te); $content_transfer_encoding = explode("Content-Transfer-Encoding: ", $te[0]); preg_match('/.*charset=.*/', $header, $te); $content_type = explode("Content-Type: text/plain; charset=", $te[0]); $date_interval = get_date_interval($dateoutput[1]); preg_match('/Content-Transfer-Encoding:.*/', $header, $encoding); $this_encoding = explode("Content-Transfer-Encoding: ", $encoding[0]); if(trim($this_encoding[1]) == "base64") { $body=base64_decode($body); } preg_match('/From:.*/', htmlspecialchars($header), $articlefrom); $isfrom = explode("From: ", $articlefrom[0]); $articlefrom[0] = $isfrom[1]; $fromoutput = explode("<", html_entity_decode($articlefrom[0])); // Just an email address? if(strlen($fromoutput[0]) < 2) { preg_match("/\<([^\)]*)\@/", html_entity_decode($articlefrom[0]), $fromaddress); $fromoutput[0] = $fromaddress[1]; } if(strpos($fromoutput[0], "(")) { preg_match("/\(([^\)]*)\)/", html_entity_decode($articlefrom[0]), $fromaddress); $fromoutput[0] = $fromaddress[1]; } if(($results % 2) != 0){ echo ''; if($results++ > ($maxdisplay - 2)) break; } echo '
'; } else { echo '
'; } echo '

'; echo ''.mb_decode_mimeheader($output[1])."\r\n"; echo '

'; echo ''.$groupname.''; echo '

'; if((isset($CONFIG['hide_email']) && $CONFIG['hide_email'] == true) && (strpos($fromoutput[0], '@') !== false)) { $poster_name = truncate_email($fromoutput[0]); } else { $poster_name = $fromoutput[0]; } $poster_name = trim($poster_name, "\""); echo '

Posted: '.$date_interval.' by: '.create_name_link($poster_name).'

'; // echo '

Posted: '.$date_interval.' by: '.mb_decode_mimeheader($fromoutput[0]).'

'; # Try to display useful snippet if($stop=strpos($body, "begin 644 ")) $body=substr($body, 0, $stop); // TEST $body = quoted_printable_decode($body); $mysnippet = recode_charset($body, $content_type[1], "utf8"); if($bodyend=strrpos($mysnippet, "\n---\n")) { $mysnippet = substr($mysnippet, 0, $bodyend); } else { if($bodyend=strrpos($mysnippet, "\n-- ")) { $mysnippet = substr($mysnippet, 0, $bodyend); } else { if($bodyend=strrpos($mysnippet, "\n.")) { $mysnippet = substr($mysnippet, 0, $bodyend); } } } if($quoteend=strrpos($mysnippet, $quotefinder)) { if($quoteend > (strlen($mysnippet) - $snippetshort)) { $quoteend = (strlen($mysnippet) - $snippetlength); if ($quoteend < 0) $quoteend = 0; $mysnippet = substr($mysnippet, $quoteend); $mysnippet = substr($mysnippet, strpos($mysnippet, ' ')); } else { $mysnippet = substr($mysnippet, strrpos($mysnippet, $quotefinder) + 1); $tempsnippet = substr($mysnippet, strpos($mysnippet, PHP_EOL)); if(strlen($tempsnippet) >= $snippetshort) $mysnippet = $tempsnippet; } } $mysnippet = substr($mysnippet, 0, $snippetlength); $snippet = $mysnippet."

\r\n"; $displayresult = explode('<', $snippet); // $echobody=quoted_printable_decode(mb_decode_mimeheader(highlightStr($displayresult[0], $terms))); $echobody=$displayresult[0]; echo "

".$echobody."

\r\n"; echo '
'; echo "

".$results." recent articles found.

\r\n"; #echo "
Rocksolid Overboard version ".$version; $iscached = "

cached copy: ".date("D M j G:i:s T Y", time())."

\r\n"; include "tail.inc"; $thispage = ob_get_contents(); ob_end_clean(); echo $thispage; if(count($articles) > 0) { $cacheFileHandle = fopen($cachefile, "w+"); fwrite($cacheFileHandle, $thispage); fwrite($cacheFileHandle, $iscached); fclose($cacheFileHandle); } ?>