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));
@ -306,7 +308,7 @@ function process_post($message, $group) {
$bytes = $bytes + mb_strlen($line, '8bit'); $bytes = $bytes + mb_strlen($line, '8bit');
if(trim($line) == "" || $lines > 0) { if(trim($line) == "" || $lines > 0) {
$is_header=0; $is_header=0;
$lines++; $lines++;
} }
if($is_header == 0) { if($is_header == 0) {
$body.=$line."\n"; $body.=$line."\n";
@ -350,7 +352,7 @@ function process_post($message, $group) {
$mid=explode(': ', $line); $mid=explode(': ', $line);
$no_mid=0; $no_mid=0;
} }
} }
} }
// rewind($message); // rewind($message);
/* /*
@ -385,7 +387,7 @@ function process_post($message, $group) {
} }
} }
} }
fclose($glfp); fclose($glfp);
@mkdir($spooldir."/".$section."/outgoing",0755,'recursive'); @mkdir($spooldir."/".$section."/outgoing",0755,'recursive');
$postfilename = tempnam($spooldir.'/'.$section.'/outgoing', ''); $postfilename = tempnam($spooldir.'/'.$section.'/outgoing', '');
$postfilehandle = fopen($postfilename, 'wb'); $postfilehandle = fopen($postfilename, 'wb');
@ -411,12 +413,21 @@ 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) {
fputs($postfilehandle, "Newsgroups: ".$newsgroups."\r\n"); $is_header=0;
} else { $lines++;
fputs($postfilehandle, $line."\r\n"); }
} 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); fclose($postfilehandle);
unlink($filename); unlink($filename);