Make new mail notification more obvious and cleanup rslight-lib.php

This commit is contained in:
Retro_Guy 2023-05-16 15:28:04 -07:00
parent 49a15058f3
commit ba92f8dd2f
2 changed files with 20 additions and 9 deletions

View File

@ -159,7 +159,7 @@ foreach($menulist as $menu) {
echo '</td>'; echo '</td>';
} }
if($unread) { if($unread) {
$motd = 'You have unread mail. <a href="../spoolnews/mail.php">Click Here</a>'; $motd = '<center>*** You have unread mail. <a href="../spoolnews/mail.php">Click Here</a> ***</center>';
} }
if(strlen($motd) > 0) { if(strlen($motd) > 0) {
echo '<div class="np_last_posted_date"><h1 class="np_thread_headline">'.$motd.'</h1></div>'; echo '<div class="np_last_posted_date"><h1 class="np_thread_headline">'.$motd.'</h1></div>';

View File

@ -269,6 +269,8 @@ function prepare_post($filename) {
if(stripos($line, "Newsgroups: ") === 0) { if(stripos($line, "Newsgroups: ") === 0) {
$ngroups=explode(': ', $line); $ngroups=explode(': ', $line);
$newsgroups=$ngroups[1]; $newsgroups=$ngroups[1];
$lines++;
break;
} }
} }
$ngroups = preg_split("/(\ |\,)/", trim($newsgroups)); $ngroups = preg_split("/(\ |\,)/", trim($newsgroups));
@ -411,8 +413,17 @@ function process_post($message, $group) {
fputs($postfilehandle,"X-Rslight-Original-Group: ".$orig_newsgroups."\r\n"); fputs($postfilehandle,"X-Rslight-Original-Group: ".$orig_newsgroups."\r\n");
} }
} }
$is_header = 1;
$lines = 0;
foreach($message as $line) { foreach($message as $line) {
if(stripos($line, "Newsgroups: ") === 0) { 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"); fputs($postfilehandle, "Newsgroups: ".$newsgroups."\r\n");
} else { } else {
fputs($postfilehandle, $line."\r\n"); fputs($postfilehandle, $line."\r\n");