Some fixes for local only groups and one for mail check.

This commit is contained in:
Retro_Guy 2023-05-12 14:02:39 -07:00
parent 1bf1353c63
commit fcde930e54
3 changed files with 21 additions and 14 deletions

View File

@ -166,22 +166,26 @@ if($unread) {
echo '</tr></table>'; echo '</tr></table>';
echo '</p>'; echo '</p>';
function check_unread_mail() { function check_unread_mail() {
global $CONFIG, $spooldir; global $CONFIG, $spooldir;
if(isset($_COOKIE['mail_name'])) { if(isset($_COOKIE['mail_name'])) {
$name = strtolower($_COOKIE['mail_name']); $name = strtolower($_COOKIE['mail_name']);
$database = $spooldir.'/mail.db3'; $database = $spooldir.'/mail.db3';
$dbh = head_mail_db_open($database); if(is_file($database)) {
$query = $dbh->prepare('SELECT * FROM messages where rcpt_to=:rcpt_to'); $dbh = head_mail_db_open($database);
$query->execute(['rcpt_to' => $name]); $query = $dbh->prepare('SELECT * FROM messages where rcpt_to=:rcpt_to');
$newmail = false; $query->execute(['rcpt_to' => $name]);
while (($row = $query->fetch()) !== false) { $newmail = false;
if(($row['rcpt_viewed'] != 'true') && ($row['to_hide'] !='true')) { while (($row = $query->fetch()) !== false) {
$newmail = true; if(($row['rcpt_viewed'] != 'true') && ($row['to_hide'] !='true')) {
$newmail = true;
}
} }
} $dbh = null;
$dbh = null; return $newmail;
return $newmail; } else {
return false;
} }
}
} }
function head_mail_db_open($database, $table='messages') { function head_mail_db_open($database, $table='messages') {

View File

@ -276,8 +276,9 @@ function display_threads($threads, $oldest) {
echo '<table cellspacing="0" width="100%" class="np_results_table">'; echo '<table cellspacing="0" width="100%" class="np_results_table">';
if(!isset($threads)) { if(!isset($threads)) {
$threads = (object)[]; $threads = (object)[];
} else {
krsort($threads);
} }
krsort($threads);
$results = 0; $results = 0;
foreach($threads as $key => $value) { foreach($threads as $key => $value) {
$target = $this_overboard['msgids'][$value]; $target = $this_overboard['msgids'][$value];

View File

@ -115,7 +115,9 @@ if(isset($frames_on) && $frames_on === true) {
// $ns=nntp_open($server,$port); // $ns=nntp_open($server,$port);
flush(); flush();
$headers = thread_load($group); $headers = thread_load($group);
$article_count=count($headers); if($headers) {
$article_count=count($headers);
}
if ($articles_per_page != 0) { if ($articles_per_page != 0) {
if ((!isset($first)) || (!isset($last))) { if ((!isset($first)) || (!isset($last))) {
if ($startpage=="first") { if ($startpage=="first") {
@ -134,7 +136,7 @@ if(isset($frames_on) && $frames_on === true) {
} else { } else {
// oh no, the replies will not be shown, this makes life hard... // oh no, the replies will not be shown, this makes life hard...
$pagecount=0; $pagecount=0;
if(count($headers) > 0 && is_array($headers)) { if(($headers) && (count($headers) > 0 && is_array($headers))) {
foreach($headers as $h) { foreach($headers as $h) {
if($h->isAnswer==false) if($h->isAnswer==false)
$pagecount++; $pagecount++;