diff --git a/Rocksolid_Light/rocksolid/newsportal.php b/Rocksolid_Light/rocksolid/newsportal.php index 96e40bf..c804a22 100644 --- a/Rocksolid_Light/rocksolid/newsportal.php +++ b/Rocksolid_Light/rocksolid/newsportal.php @@ -1128,36 +1128,34 @@ function html_parse($text) function display_links_in_body($text) { - global $config_dir; - preg_match_all('/(https?|ftp|scp|news|gopher|gemini|telnet):\/\/[a-zA-Z0-9.?%=\-\+\;\:\,\~\@\!\(\)\$\#&_\/]+/', $text, $matches); - $found = array(); - $isquote = false; - if (strpos($text, ">") == 0) { - $isquote = true; - echo '
'; - } - foreach ($matches[0] as $match) { - if (! $match) { - continue; - } - if (in_array($match, $found)) { - continue; - } - $found[] = $match; - $linkurl = preg_replace("/(<|>)/", ' ', htmlspecialchars_decode($match)); - $url = preg_replace("/(<|>)/", ' ', $match); - $pattern = preg_quote($url); - $pattern = "!$pattern!"; - $text = preg_replace($pattern, '' . $url . '', $text, 1); - } - if (file_exists($config_dir . '/rewrite_body.inc.php')) { - include ($config_dir . '/rewrite_body.inc.php'); - } - - echo $text; - if ($isquote) { - echo ''; - } + global $config_dir; + preg_match_all('/(https?|ftp|scp|news|gopher|gemini|telnet):\/\/[a-zA-Z0-9.?%=\-\+\;\:\,\~\@\!\(\)\$\#&_\/]+/', $text, $matches); + $isquote = false; + if (strpos($text, ">") == 0) { + $isquote = true; + echo '
'; + } + foreach ($matches[0] as $match) { + if (! $match) { + continue; + } + // Get rid of unwanted trailing characters + $match = rtrim(htmlspecialchars_decode($match), '/>,"'); + $match = htmlspecialchars($match); + $linkurl = preg_replace("/(<|>)/", '', htmlspecialchars_decode($match)); + $url = preg_replace("/(<|>)/", ' ', $match); + $pattern = preg_quote($url); + $pattern = "!$pattern!"; + $text = preg_replace($pattern, '' . $url . '', $text, 1); + } + if (file_exists($config_dir . '/rewrite_body.inc.php')) { + include ($config_dir . '/rewrite_body.inc.php'); + } + + echo $text; + if ($isquote) { + echo ''; + } } /* diff --git a/Rocksolid_Light/rocksolid/overboard.php b/Rocksolid_Light/rocksolid/overboard.php index 02afa8c..157681a 100644 --- a/Rocksolid_Light/rocksolid/overboard.php +++ b/Rocksolid_Light/rocksolid/overboard.php @@ -308,12 +308,6 @@ function display_threads($threads, $oldest) $style = 0; $results = 0; foreach ($nicole as $key => $value) { - // Skip if not in registered users sub list - if (! $foundgroup_head = check_group_for_user($key, $userdata, $user_config, true)) { - // testing: continuing here may break newsgroup identification - // and not display articles that should be displayed - // continue; - } $target_head = $this_overboard['msgids'][$key]; if (! isset($target_head['msgid'])) { $target_head = get_data_from_msgid($key); @@ -422,6 +416,9 @@ function display_threads($threads, $oldest) } } $display .= ''; + if ($results > ($maxdisplay - 1)) { + break; + } } $display .= ""; diff --git a/Rocksolid_Light/rslight/scripts/rslight-lib.php b/Rocksolid_Light/rslight/scripts/rslight-lib.php index d33442d..28d294c 100644 --- a/Rocksolid_Light/rslight/scripts/rslight-lib.php +++ b/Rocksolid_Light/rslight/scripts/rslight-lib.php @@ -356,6 +356,7 @@ function process_post($message, $group) $body = ""; $ref = 0; $sub = 0; + $ng = 0; $response = ""; $bytes = 0; $lines = 0; @@ -372,6 +373,23 @@ function process_post($message, $group) if (strpos($line, ': ') !== false) { $ref = 0; $sub = 0; + $ng = 0; + } else { + if (preg_match('/^\s/', $line)) { + if ($ng == 1) { + $newsgroups = $newsgroups . ',' . trim($line); + $newsgroups = preg_replace('/\,\,/', ',', $newsgroups); + continue; + } + if ($ref == 1) { + $references = $references . $line; + continue; + } + if ($sub == 1) { + $subject = $subject . $line; + continue; + } + } } if (stripos($line, "Path: ") === 0) { $response = "441 Posting failed (Header preloading denied)\r\n"; @@ -403,18 +421,14 @@ function process_post($message, $group) if (stripos($line, "Newsgroups: ") === 0) { $ngroups = explode(': ', $line); $newsgroups = $ngroups[1]; + $ng = 1; } if (stripos($line, "References: ") === 0) { $references_line = explode(': ', $line); $references = $references_line[1]; $ref = 1; } - if (preg_match('/^\s/', $line) && $ref == 1) { - $references = $references . $line; - } - if (preg_match('/^\s/', $line) && $sub == 1) { - $subject = $subject . $line; - } + if (stripos($line, "Message-ID: ") !== false) { $mid = explode(': ', $line); $no_mid = 0; @@ -470,6 +484,7 @@ function process_post($message, $group) } $is_header = 1; $lines = 0; + $ng = 0; foreach ($message as $line) { if (trim($line) == "" || $lines > 0) { $is_header = 0; @@ -477,7 +492,17 @@ function process_post($message, $group) } if (stripos($line, "Newsgroups: ") === 0 && $is_header == 1) { fputs($postfilehandle, "Newsgroups: " . $newsgroups . "\r\n"); + $ng = 1; } else { + if (strpos($line, ': ') !== false) { + $ng = 0; + } else { + if (preg_match('/^\s/', $line)) { + if ($ng == 1) { + continue; + } + } + } fputs($postfilehandle, $line . "\r\n"); } } @@ -1125,7 +1150,7 @@ function insert_article($section, $nntp_group, $filename, $subject_i, $from_i, $ { global $enable_rslight, $spooldir, $CONFIG, $OVERRIDES, $logdir, $lockdir, $logfile; - if(is_moderated($nntp_group)) { + if (is_moderated($nntp_group)) { file_put_contents($logfile, "\n" . format_log_date() . " " . $section . " Moderated group... Queuing local post: " . $nntp_group, FILE_APPEND); $return_val = "240 Article received OK (queued for moderation)\r\n"; return ($return_val); diff --git a/Rocksolid_Light/rslight/scripts/spoolnews.php b/Rocksolid_Light/rslight/scripts/spoolnews.php index 8fccc26..b5c6bfe 100644 --- a/Rocksolid_Light/rslight/scripts/spoolnews.php +++ b/Rocksolid_Light/rslight/scripts/spoolnews.php @@ -217,6 +217,7 @@ function get_articles($ns, $group) $local = get_next_article_number($group); } # Split group response line to get last article number + # $article is the next number we want, not the last we retrieved $detail = explode(" ", $response); if (! isset($article)) { $article = $detail[2]; @@ -227,6 +228,11 @@ function get_articles($ns, $group) if ($article < $detail[2]) { $article = $detail[2]; } + if ($article > $detail[3]) { + file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " " . $CONFIG['remote_server'] . " for " . $group . " We are up to date", FILE_APPEND); + // Just in case we have an error and $article is too large: + $article = $detail[3] + 1; + } else { // Get overview from server $server_overview = array(); $re = false; @@ -292,6 +298,7 @@ function get_articles($ns, $group) $bytes = 0; $ref = 0; $sub = 0; + $ng = 0; $banned = false; $integrity = false; $is_header = 1; @@ -312,6 +319,7 @@ function get_articles($ns, $group) if (strpos($response, ': ') !== false) { $ref = 0; $sub = 0; + $ng = 0; } // Find article date if (stripos($response, "Date: ") === 0) { @@ -372,6 +380,7 @@ function get_articles($ns, $group) $current_article['xref'] .= ' ' . $agroup . ':' . $artnum; } } + $ng = 1; } if (stripos($response, "Xref: ") === 0) { if (isset($CONFIG['enable_nntp']) && $CONFIG['enable_nntp'] == true) { @@ -388,6 +397,11 @@ function get_articles($ns, $group) $references = $this_references[1]; $ref = 1; } + if (preg_match('/^\s/', $response) && $ng == 1) { + $addgroups = preg_split("/\ |\,/", trim($response)); + $allgroups = array_merge($allgroups, $addgroups); + } + if (preg_match('/^\s/', $response) && $ref == 1) { $references = $references . $response; } @@ -516,6 +530,7 @@ function get_articles($ns, $group) } } } + } // END GET INDIVIDUAL ARTICLE $article --; // $local--; @@ -533,32 +548,8 @@ function get_articles($ns, $group) } } # Save config - $grouplist = file($remote_groupfile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); - $saveconfig = fopen($remote_groupfile, 'w+'); - foreach ($grouplist as $savegroup) { - $name = explode(':', $savegroup); - if (strcmp($name[0], $group) == 0) { - fputs($saveconfig, $group . ":" . $article . "\n"); - } else { - fputs($saveconfig, $savegroup . "\n"); - } - } - fclose($saveconfig); - $grouplist = file($local_groupfile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); - $saveconfig = fopen($local_groupfile, 'w+'); - foreach ($grouplist as $savegroup) { - $name = explode(':', $savegroup); - if (strcmp($name[0], $group) == 0) { - fputs($saveconfig, $group . ":" . $local . "\n"); - } else { - fputs($saveconfig, $savegroup . "\n"); - } - } - fclose($saveconfig); - if ($CONFIG['article_database'] == '1') { - $article_dbh = null; - } - $dbh = null; + save_config_value($remote_groupfile, $group, $article, true); + save_config_value($local_groupfile, $group, $local, true); } function create_spool_groups($in_groups, $out_groups) diff --git a/Rocksolid_Light/version.txt b/Rocksolid_Light/version.txt index 91bd098..28620ec 100644 --- a/Rocksolid_Light/version.txt +++ b/Rocksolid_Light/version.txt @@ -1 +1 @@ -0.9.87 +0.9.875