Page Disabled"; include "tail.inc"; exit(); } $CONFIG = include ($config_file); $logfile = $logdir . '/overboard.log'; # How many days old should articles be displayed? if (isset($_GET['thisgroup'])) { $article_age = 30; } else { $article_age = 30; } $version = 1.1; # How long in seconds to cache results $cachetime = 60; # Maximum number of articles to show $maxdisplay = 1000; # How many characters of the body to display per article $snippetlength = 240; $spoolpath_regexp = '/' . preg_replace('/\//', '\\/', $spoolpath) . '/'; $thissite = '.'; $groupconfig = $file_groups; $cachefile = $spooldir . "/" . $config_name . "-overboard.dat"; $oldest = (time() - (86400 * $article_age)); $prune = false; if (isset($_GET['time'])) { $user_time = $_GET['time']; if (is_numeric($user_time)) { if (($user_time > time()) || ($user_time < $oldest)) { unset($user_time); } } else { unset($user_time); } } if (isset($_GET['thisgroup'])) { $_GET['thisgroup'] = _rawurldecode($_GET['thisgroup']); if (get_section_by_group($_GET['thisgroup']) == false) { echo "Group not found"; exit(1); } $grouplist = array(); $grouplist[0] = _rawurldecode(_rawurldecode($_GET['thisgroup'])); $cachefile = $spooldir . "/" . $grouplist[0] . "-overboard.dat"; if ($userdata) { $userdata[$grouplist[0]] = time(); file_put_contents($userfile, serialize($userdata)); } } else { $grouplist = file($groupconfig, FILE_IGNORE_NEW_LINES); } show_overboard_header($grouplist); $results = 0; if (! isset($this_overboard['version'])) { $this_overboard['version'] = '0'; } if (is_file($cachefile)) { $stats = stat($cachefile); $this_overboard = unserialize(file_get_contents($cachefile)); $cachedate = ($this_overboard['lastmessage'] - 86400); $oldest = $cachedate; } else { $cachedate = ($oldest - 86400); } if ($this_overboard['version'] !== $version) { unset($this_overboard); if (is_file($cachefile)) { unlink($cachefile); } $this_overboard['version'] = $version; $cachedate = ($oldest - 86400); } # Iterate through groups $database = $spooldir . '/articles-overview.db3'; $table = 'overview'; $dbh = overview_db_open($database, $table); $query = $dbh->prepare('SELECT * FROM ' . $table . ' WHERE newsgroup=:findgroup AND date >= ' . $cachedate . ' ORDER BY date DESC LIMIT ' . $maxdisplay); $articles = array(); $db_articles = array(); foreach ($grouplist as $findgroup) { $groups = preg_split("/(\ |\t)/", $findgroup, 2); $findgroup = $groups[0]; $overboard_noshow = explode(' ', $CONFIG['overboard_noshow']); foreach ($overboard_noshow as $noshow) { if ((strpos($findgroup, $noshow) !== false) && ! isset($_GET['thisgroup'])) { continue 2; } } $thisgroup = preg_replace('/\./', '/', $findgroup); if ($dbh) { $query->execute([ 'findgroup' => $findgroup ]); $i = 0; while (($overviewline = $query->fetch()) !== false) { $articles[] = $spoolpath . $thisgroup . '/' . $overviewline['number']; $db_articles[] = $findgroup . ':' . $overviewline['number'] . ':' . $overviewline['date'] . ':' . $overviewline['name']; $i ++; if ($i > $maxdisplay) { break; } } } } $dbh = null; $files = array(); if ($CONFIG['article_database'] == '1') { foreach ($db_articles as $article) { $order = explode(':', $article); $files[$order[2]] = $article; } } else { foreach ($articles as $article) { if (is_dir($article)) { continue; } $files[filemtime($article)] = $article; } } krsort($files); foreach ($files as $article) { if ($CONFIG['article_database'] == '1') { $data = explode(':', $article); $articledata = np_get_db_article($data[1], $data[0], 0); } else { $articledata = file_get_contents($article); } $bodystart = strpos($articledata, $localeol); $header = substr($articledata, 0, $bodystart); # Find group name and article number if ($CONFIG['article_database'] == '1') { $group = $data[0]; $articlenumber = $data[1]; $groupname = $group; } else { $group = preg_replace($spoolpath_regexp, '', $article); $group = preg_replace('/\//', '.', $group); $findme = strrpos($group, '.'); $groupname = substr($group, 0, $findme); $articlenumber = substr($group, $findme + 1); } preg_match('/Message-ID:.*/i', $header, $articleid); $getid = explode(": ", $articleid[0]); $thismsgid = $getid[1]; if (isset($this_overboard['msgids'][$thismsgid])) { continue; } $isref = preg_match('/References:.*/i', $header, $ref); if ($isref) { $getrefs = explode(': ', $ref[0]); $ref = preg_split("/[\s]+/", $getrefs[1]); if ($getrefs[1] && $refid = get_data_from_msgid($ref[0])) { // Check that article to link is new enough for newsportal to display $groupinfo = file($spooldir . '/' . $refid["newsgroup"] . '-info.txt'); $range = explode(' ', $groupinfo[1]); if ($refid['number'] > (intval($range[0]) - 1)) { $threadref = $ref[0]; } else { $threadref = false; } } else { $threadref = false; } } else { $threadref = false; } $target = get_data_from_msgid($thismsgid); if ($target['date'] > time()) { continue; } if (! isset($this_overboard['lastmessage'])) { $this_overboard['lastmessage'] = 0; } if ($target['date'] > $this_overboard['lastmessage']) { $this_overboard['lastmessage'] = $target['date']; } if (! isset($this_overboard['threads'][$target['date']])) { $this_overboard['threads'][$target['date']] = $thismsgid; $this_overboard['msgids'][$thismsgid] = $target; if ($threadref) { $this_overboard['threadlink'][$thismsgid] = $threadref; } if ($results ++ > ($maxdisplay - 2)) { break; } } } file_put_contents($cachefile, serialize($this_overboard)); if (isset($user_time)) { $oldest = ($user_time - 900); } else { $oldest = (time() - (86400 * $article_age)); } $results = display_threads($this_overboard['threads'], $oldest); show_overboard_footer(null, $results, null); echo '