From b25d8a0c9f858d69494f34106b06146a36b7380e Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Thu, 7 Jan 2021 22:48:56 -0700 Subject: [PATCH] Fix incorrect checking for high watermark in spoolnews.php --- Rocksolid_Light/rslight/scripts/spoolnews.php | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/Rocksolid_Light/rslight/scripts/spoolnews.php b/Rocksolid_Light/rslight/scripts/spoolnews.php index f4dd391..9ae96ad 100755 --- a/Rocksolid_Light/rslight/scripts/spoolnews.php +++ b/Rocksolid_Light/rslight/scripts/spoolnews.php @@ -148,7 +148,7 @@ function get_articles($ns, $group) { if(isset($CONFIG['enable_nntp']) && $CONFIG['enable_nntp'] == true) { // Try to find last article number in local_groupfile - $local = get_config_value($local_groupfile, $group); + $local = get_high_watermark($group); if(!is_numeric($local)) { $thisgroup = $path."/".preg_replace('/\./', '/', $group); $articles = scandir($thisgroup); @@ -168,7 +168,7 @@ function get_articles($ns, $group) { if($local < 1) $local = 1; } - # Split group config line to get last article number + # Split group response line to get last article number $detail = explode(" ", $response); if (!isset($article)) { $article = $detail[2]; @@ -451,4 +451,27 @@ function nntp2_open($nserver=0,$nport=0) { if ($ns==false) echo "

".$text_error["connection_failed"]."

"; return $ns; } + +function get_high_watermark($group) { + global $local_groupfile; + + if ($configFileHandle = @fopen($local_groupfile, 'r')) + { + while (!feof($configFileHandle)) + { + $buffer = fgets($configFileHandle); + if(strpos($buffer, $group.':') !== FALSE) { + $dataline=$buffer; + fclose($configFileHandle); + $datafound = explode(':',$dataline); + return trim($datafound[1]); + } + } + fclose($configFileHandle); + return FALSE; + } else { + return FALSE; + } +} + ?>