From ba92f8dd2f8171d6f883a912cdfe6818355ed771 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Tue, 16 May 2023 15:28:04 -0700 Subject: [PATCH] Make new mail notification more obvious and cleanup rslight-lib.php --- Rocksolid_Light/common/header.php | 2 +- .../rslight/scripts/rslight-lib.php | 27 +++++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Rocksolid_Light/common/header.php b/Rocksolid_Light/common/header.php index bd39657..f50d481 100644 --- a/Rocksolid_Light/common/header.php +++ b/Rocksolid_Light/common/header.php @@ -159,7 +159,7 @@ foreach($menulist as $menu) { echo ''; } if($unread) { - $motd = 'You have unread mail. Click Here'; + $motd = '
*** You have unread mail. Click Here ***
'; } if(strlen($motd) > 0) { echo '

'.$motd.'

'; diff --git a/Rocksolid_Light/rslight/scripts/rslight-lib.php b/Rocksolid_Light/rslight/scripts/rslight-lib.php index da998a3..e02524a 100755 --- a/Rocksolid_Light/rslight/scripts/rslight-lib.php +++ b/Rocksolid_Light/rslight/scripts/rslight-lib.php @@ -269,6 +269,8 @@ function prepare_post($filename) { if(stripos($line, "Newsgroups: ") === 0) { $ngroups=explode(': ', $line); $newsgroups=$ngroups[1]; + $lines++; + break; } } $ngroups = preg_split("/(\ |\,)/", trim($newsgroups)); @@ -306,7 +308,7 @@ function process_post($message, $group) { $bytes = $bytes + mb_strlen($line, '8bit'); if(trim($line) == "" || $lines > 0) { $is_header=0; - $lines++; + $lines++; } if($is_header == 0) { $body.=$line."\n"; @@ -350,7 +352,7 @@ function process_post($message, $group) { $mid=explode(': ', $line); $no_mid=0; } - } + } } // rewind($message); /* @@ -385,7 +387,7 @@ function process_post($message, $group) { } } } - fclose($glfp); + fclose($glfp); @mkdir($spooldir."/".$section."/outgoing",0755,'recursive'); $postfilename = tempnam($spooldir.'/'.$section.'/outgoing', ''); $postfilehandle = fopen($postfilename, 'wb'); @@ -411,12 +413,21 @@ function process_post($message, $group) { fputs($postfilehandle,"X-Rslight-Original-Group: ".$orig_newsgroups."\r\n"); } } + $is_header = 1; + $lines = 0; foreach($message as $line) { - if(stripos($line, "Newsgroups: ") === 0) { - fputs($postfilehandle, "Newsgroups: ".$newsgroups."\r\n"); - } else { - fputs($postfilehandle, $line."\r\n"); - } + if(trim($line) == "" || $lines > 0) { + $is_header=0; + $lines++; + } + if($is_header == 0) { + $body.=$line."\n"; + } + if(stripos($line, "Newsgroups: ") === 0 && $is_header == 1) { + fputs($postfilehandle, "Newsgroups: ".$newsgroups."\r\n"); + } else { + fputs($postfilehandle, $line."\r\n"); + } } fclose($postfilehandle); unlink($filename);