Check that database exists before using for last article info

This commit is contained in:
Retro_Guy 2021-12-16 03:08:22 +00:00
parent e8ab8d2ba2
commit a96819261f
1 changed files with 10 additions and 9 deletions

View File

@ -814,15 +814,16 @@ function thread_format_lastmessage($c,$group='') {
if($CONFIG['article_database'] == '1') { if($CONFIG['article_database'] == '1') {
$database = $spooldir.'/'.$group.'-articles.db3'; $database = $spooldir.'/'.$group.'-articles.db3';
$table = 'articles'; $table = 'articles';
$dbh = article_db_open($database, $table); if(is_file($database)) {
$stmt = $dbh->prepare("SELECT * FROM $table WHERE date=:date ORDER BY date DESC"); $dbh = article_db_open($database, $table);
$stmt->bindParam(':date', $c->date_thread); $stmt = $dbh->prepare("SELECT * FROM $table WHERE date=:date ORDER BY date DESC");
$stmt->execute(); $stmt->bindParam(':date', $c->date_thread);
if($found = $stmt->fetch()) { $stmt->execute();
$ovfound = 1; if($found = $stmt->fetch()) {
}; $ovfound = 1;
$dbh = null; };
$dbh = null;
}
$fromline = address_decode(headerDecode($found['name']),"nirgendwo"); $fromline = address_decode(headerDecode($found['name']),"nirgendwo");
if (!isset($fromline[0]["host"])) $fromline[0]["host"]=""; if (!isset($fromline[0]["host"])) $fromline[0]["host"]="";
$name_from=$fromline[0]["mailbox"]."@".$fromline[0]["host"]; $name_from=$fromline[0]["mailbox"]."@".$fromline[0]["host"];