diff --git a/phpmyfaq/attachment.php b/phpmyfaq/attachment.php index 0e4eee8bc4..7017b243da 100644 --- a/phpmyfaq/attachment.php +++ b/phpmyfaq/attachment.php @@ -98,7 +98,7 @@ } if ( - $attachment && ($faqConfig->get('records.allowDownloadsForGuests') || + $attachment && $attachment->getRecordId() > 0 && ($faqConfig->get('records.allowDownloadsForGuests') || (($groupPermission || ($groupPermission && $userPermission)) && isset($permission['dlattachment']))) ) { try { @@ -108,7 +108,7 @@ } exit(0); } else { - $attachmentErrors[] = Translation::get('err_NotAuth'); + $attachmentErrors[] = Translation::get('msgAttachmentInvalid'); } // If we're here, there was an error with file download diff --git a/phpmyfaq/src/phpMyFAQ/Attachment/AttachmentAbstract.php b/phpmyfaq/src/phpMyFAQ/Attachment/AttachmentAbstract.php index 9d08592829..0198312e85 100644 --- a/phpmyfaq/src/phpMyFAQ/Attachment/AttachmentAbstract.php +++ b/phpmyfaq/src/phpMyFAQ/Attachment/AttachmentAbstract.php @@ -215,7 +215,7 @@ public function setId(int $id): void */ public function getRecordId(): int { - return $this->recordId; + return $this->recordId ?? 0; } /**