Page Disabled"; include "tail.inc"; exit(); } echo '

'; echo '' . basename(getcwd()) . ' / '; if ($search_group) { echo '' . $search_group . ' / '; } echo 'search

'; echo ''; if (isset($search_group)) { $searching = $search_group; } else { $searching = $config_name; } echo ''; echo '
'; echo ''; echo ''; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; if (! isset($_REQUEST['data'])) { echo ''; } else { echo ''; } echo ''; echo ''; echo ''; if (isset($search_group)) { echo ''; } echo ''; if (isset($_GET['data'])) { echo ''; } echo ''; echo ''; echo '
Searching ' . $searching . '
Search Terms: '; } else { echo 'Search Poster: '; } if (isset($_GET['terms'])) { echo '
'; if (isset($_GET['searchpoint']) && $_GET['searchpoint'] == 'Poster') { if ($CONFIG['article_database'] == '1') { echo 'Body '; } echo 'Subject '; echo 'Poster '; echo 'Message-ID'; } else { if ($CONFIG['article_database'] == '1') { echo ' Body '; } echo 'Subject '; echo 'Poster '; echo 'Message-ID'; } echo '
'; // Block poster if (isset($_COOKIE['mail_name'])) { if (isset($_REQUEST['data'])) { echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; if (isset($_GET['data'])) { echo ''; } echo ''; echo ''; // Password confirmation echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
Hide posts by ' . $_GET['terms'] . '
'; echo '
Enter your password: '; echo '
(refresh pages if articles still appear)
'; } } // END Block poster exit(0); } if (isset($frames_on) && $frames_on === true) { ?> '".$_POST['block_poster']."' successfully added to your blocklist"; echo '
You may edit your blocklist on your Configuration Page'; } else { echo '
Password Incorrect.
Click Back to try again
'; } exit(0); } ob_start(); if (isset($search_group)) { echo '

'; echo '' . basename(getcwd()) . ' / '; echo '' . $search_group . ' / '; echo 'search results for: ' . $_POST['terms'] . '

'; // Newsgroups button (hidden) echo ''; echo '
'; echo ''; echo '
'; echo ''; echo ''; } else { echo '

'; echo '' . basename(getcwd()) . ' / '; echo 'search results for: ' . $_POST['terms'] . '

'; echo ''; // Newsgroups button (hidden) echo ''; echo '
'; echo '
'; echo ''; echo '
'; echo '
'; } echo ''; # Iterate through groups $results = 0; if (isset($_COOKIE['tzo'])) { $offset = $_COOKIE['tzo']; } else { $offset = $CONFIG['timezone']; } $overview = array(); if ($_POST['searchpoint'] == 'body') { $overview = get_body_search($search_group, $_POST['terms']); } else { if (isset($_REQUEST['data'])) { $overview = get_header_search($search_group, base64_decode(urldecode($_REQUEST['data']))); } else { $overview = get_header_search($search_group, $_POST['terms']); } } foreach ($overview as $overviewline) { /* Find section for links */ $menulist = file($config_dir . "menu.conf", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach ($menulist as $menu) { if ($menu[0] == '#') { continue; } $menuitem = explode(':', $menu); $glfp = fopen($config_dir . $menuitem[0] . "/groups.txt", 'r'); $section = ""; while ($gl = fgets($glfp)) { $group_name = preg_split("/( |\t)/", $gl, 2); if (stripos(trim($overviewline['newsgroup']), trim($group_name[0])) !== false) { $section = $menuitem[0]; break 2; } } } fclose($glfp); # Generate link $url = "../" . $section . "/article-flat.php?id=" . $overviewline['number'] . "&group=" . urlencode($overviewline['newsgroup']) . "#" . $overviewline['number']; $groupurl = "../" . $section . "/thread.php?group=" . urlencode($overviewline['newsgroup']); $fromoutput = explode("<", html_entity_decode($overviewline['name'])); // Use local timezone if possible $ts = new DateTime(date($text_header["date_format"], $overviewline['date']), new DateTimeZone('UTC')); $ts->add(DateInterval::createFromDateString($offset . ' minutes')); if ($offset != 0) { $newdate = $ts->format('D, j M Y H:i'); } else { $newdate = $ts->format($text_header["date_format"]); } unset($ts); $fromline = address_decode(headerDecode($overviewline['name']), "nowhere"); if (! isset($fromline[0]["personal"])) { $lastname = $fromline[0]["mailbox"]; ; } else { $lastname = $fromline[0]["personal"]; } if (($results % 2) != 0) { echo ''; if ($results ++ > ($maxdisplay - 2)) break; } echo '
'; } else { echo '
'; } echo '

'; echo '' . htmlspecialchars(headerDecode($overviewline['subject'])) . "\r\n"; echo '

'; echo '' . $overviewline['newsgroup'] . ''; echo '

'; $fromline = address_decode($overviewline['name'], "nowhere"); if (! isset($fromline[0]["host"])) $fromline[0]["host"] = ""; $name_from = $fromline[0]["mailbox"] . "@" . $fromline[0]["host"]; $name_username = $fromline[0]["mailbox"]; if (! isset($fromline[0]["personal"])) { $poster_name = $fromline[0]["mailbox"]; } else { $poster_name = $fromline[0]["personal"]; } if (trim($poster_name) == '') { $fromoutput = explode("<", html_entity_decode($c->name)); if (strlen($fromoutput[0]) < 1) { $poster_name = $fromoutput[1]; } else { $poster_name = $fromoutput[0]; } } $poster_name = trim(mb_decode_mimeheader($poster_name), " \n\r\t\v\0\""); echo '

Posted: ' . $newdate . ' by: ' . create_name_link($poster_name, $name_from) . '

'; if ($_POST['searchpoint'] == 'body') { $snip = strip_tags(quoted_printable_decode($overviewline['snippet']), ''); } else { $snip = strip_tags(quoted_printable_decode($overviewline['search_snippet']), ''); $snip = substr($snip, 0, $snippet_size); } echo $snip; echo '
'; echo "

" . $results . " matching articles found.

\r\n"; # echo "
Rocksolid Overboard version ".$version; include "tail.inc"; $thispage = ob_get_contents(); ob_end_clean(); echo $thispage; function get_body_search($group, $terms) { GLOBAL $CONFIG, $config_name, $spooldir, $snippet_size; $terms = preg_replace("/'/", ' ', $terms); $terms = trim($terms); if ($terms[0] !== '"' || substr($terms, - 1) !== '"') { $terms = preg_replace('/"/', '', $terms); $terms = preg_replace("/\ /", '" "', $terms); $terms = preg_replace('/"NEAR"/', 'NEAR', $terms); $terms = preg_replace('/"AND"/', 'AND', $terms); $terms = preg_replace('/"OR"/', 'OR', $terms); $terms = preg_replace('/"NOT"/', 'NOT', $terms); $terms = '"' . $terms . '"'; } if ($group != '') { $grouplist[0] = $group; } else { $local_groupfile = $spooldir . "/" . $config_name . "/local_groups.txt"; $grouplist = file($local_groupfile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); } foreach ($grouplist as $thisgroup) { $name = explode(':', $thisgroup); $group = $name[0]; $database = $spooldir . '/' . $group . '-articles.db3'; if (! is_file($database)) { continue; } $dbh = article_db_open($database); $stmt = $dbh->prepare("SELECT snippet(search_fts, 6, '', '', '...', $snippet_size) as snippet, newsgroup, number, name, date, subject, rank FROM search_fts WHERE search_fts MATCH 'search_snippet:$terms' ORDER BY rank"); $stmt->execute(); while ($row = $stmt->fetch()) { $overview[] = $row; } $dbh = null; } // do not perform a usort of an empty search result if ($overview != null) { usort($overview, function ($a, $b) { return $a['rank'] <=> $b['rank']; }); } return $overview; } function get_header_search($group, $terms) { GLOBAL $CONFIG, $config_name, $spooldir, $snippet_size; $terms = preg_replace('/\%/', '\%', $terms); $searchterms = "%" . $terms . "%"; if (isset($group)) { $grouplist[0] = $group; } else { $local_groupfile = $spooldir . "/" . $config_name . "/local_groups.txt"; $grouplist = file($local_groupfile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); } # Prepare search database $database = $spooldir . '/articles-overview.db3'; $table = 'overview'; $dbh = overview_db_open($database, $table); $overview = array(); foreach ($grouplist as $thisgroup) { $name = explode(':', $thisgroup); $group = $name[0]; $article_database = $spooldir . '/' . $group . '-articles.db3'; if (! is_file($article_database)) { continue; } $article_dbh = article_db_open($article_database); $article_stmt = $article_dbh->prepare("SELECT * FROM articles WHERE number=:number"); if (is_multibyte($_POST['terms'])) { $stmt = $dbh->prepare("SELECT * FROM $table WHERE newsgroup=:group"); $stmt->bindParam(':group', $group); $stmt->execute(); while ($found = $stmt->fetch()) { if (stripos(mb_decode_mimeheader($found[$_POST['searchpoint']]), $_POST['terms']) !== false) { $article_stmt->bindParam(':number', $found['number']); $article_stmt->execute(); $found_snip = $article_stmt->fetch(); $found['search_snippet'] = $found_snip['search_snippet']; $found['sort_date'] = $found_snip['date']; $overview[] = $found; } } } else { $stmt = $dbh->prepare("SELECT * FROM $table WHERE newsgroup=:group AND " . $_POST['searchpoint'] . " like :terms ESCAPE '\' ORDER BY date DESC"); $stmt->bindParam(':group', $group); $stmt->bindParam(':terms', $searchterms); $check = "/([a-z]|[0-9]|\!|#|\$|\%|\&|\'|\*|\+|\-|\/|\=|\?|\^|\_|\"|\`|\{|\||\}|\~|\;)" . trim($searchterms, '\%') . "/i"; $stmt->execute(); while ($found = $stmt->fetch()) { if (isset($_REQUEST['data']) && ($_REQUEST['searchpoint'] == 'name')) { if (preg_match($check, $found['name'])) { continue; } } $article_stmt->bindParam(':number', $found['number']); $article_stmt->execute(); $found_snip = $article_stmt->fetch(); $found['search_snippet'] = $found_snip['search_snippet']; $found['sort_date'] = $found_snip['date']; $overview[] = $found; } } $article_dbh = null; } $dbh = null; usort($overview, function ($b, $a) { return $a['sort_date'] <=> $b['sort_date']; }); return $overview; } function highlightStr($haystack, $needle) { preg_match_all("/$needle+/i", $haystack, $matches); if (is_array($matches[0]) && count($matches[0]) >= 1) { foreach ($matches[0] as $match) { $haystack = str_replace($match, '' . $match . '', $haystack); } } return $haystack; } ?>