From fcde930e54e780f7cdf5bfbcdb52179846ce1605 Mon Sep 17 00:00:00 2001
From: Retro_Guy
Date: Fri, 12 May 2023 14:02:39 -0700
Subject: [PATCH] Some fixes for local only groups and one for mail check.
---
Rocksolid_Light/common/header.php | 26 ++++++++++++++-----------
Rocksolid_Light/rocksolid/overboard.php | 3 ++-
Rocksolid_Light/rocksolid/thread.php | 6 ++++--
3 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/Rocksolid_Light/common/header.php b/Rocksolid_Light/common/header.php
index c6e0a23..057a2a4 100644
--- a/Rocksolid_Light/common/header.php
+++ b/Rocksolid_Light/common/header.php
@@ -166,22 +166,26 @@ if($unread) {
echo '';
echo '
';
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') {
diff --git a/Rocksolid_Light/rocksolid/overboard.php b/Rocksolid_Light/rocksolid/overboard.php
index 0a851c3..cae9d4f 100755
--- a/Rocksolid_Light/rocksolid/overboard.php
+++ b/Rocksolid_Light/rocksolid/overboard.php
@@ -276,8 +276,9 @@ function display_threads($threads, $oldest) {
echo '';
if(!isset($threads)) {
$threads = (object)[];
+ } else {
+ krsort($threads);
}
- krsort($threads);
$results = 0;
foreach($threads as $key => $value) {
$target = $this_overboard['msgids'][$value];
diff --git a/Rocksolid_Light/rocksolid/thread.php b/Rocksolid_Light/rocksolid/thread.php
index 4ba17df..a407a87 100644
--- a/Rocksolid_Light/rocksolid/thread.php
+++ b/Rocksolid_Light/rocksolid/thread.php
@@ -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++;