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 '</p>';
function check_unread_mail() {
global $CONFIG, $spooldir;
global $CONFIG, $spooldir;
if(isset($_COOKIE['mail_name'])) {
$name = strtolower($_COOKIE['mail_name']);
$database = $spooldir.'/mail.db3';
$dbh = head_mail_db_open($database);
$query = $dbh->prepare('SELECT * FROM messages where rcpt_to=:rcpt_to');
$query->execute(['rcpt_to' => $name]);
$newmail = false;
while (($row = $query->fetch()) !== false) {
if(($row['rcpt_viewed'] != 'true') && ($row['to_hide'] !='true')) {
$newmail = true;
if(is_file($database)) {
$dbh = head_mail_db_open($database);
$query = $dbh->prepare('SELECT * FROM messages where rcpt_to=:rcpt_to');
$query->execute(['rcpt_to' => $name]);
$newmail = false;
while (($row = $query->fetch()) !== false) {
if(($row['rcpt_viewed'] != 'true') && ($row['to_hide'] !='true')) {
$newmail = true;
}
}
}
$dbh = null;
return $newmail;
$dbh = null;
return $newmail;
} else {
return false;
}
}
}
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">';
if(!isset($threads)) {
$threads = (object)[];
} else {
krsort($threads);
}
krsort($threads);
$results = 0;
foreach($threads as $key => $value) {
$target = $this_overboard['msgids'][$value];

View File

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