From e6d26c20628195fde6f3edfb31e5db8d31551adf Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 17 Sep 2018 17:43:01 +0200 Subject: [PATCH] nieuws: ignore missing image/contents of new articles Cover image feature was not tested on article creation, causing harmless but alarming PHP errors. --- nieuws.inc.php | 1 + nieuws/index.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/nieuws.inc.php b/nieuws.inc.php index 930eb00..5485315 100644 --- a/nieuws.inc.php +++ b/nieuws.inc.php @@ -29,6 +29,7 @@ class ArchiveArticle function file() { + if (!file_exists($this->page)) return; return fopen($this->page, 'r'); } diff --git a/nieuws/index.php b/nieuws/index.php index ad85011..18f4466 100644 --- a/nieuws/index.php +++ b/nieuws/index.php @@ -13,7 +13,7 @@ if ($page and !is_numeric($page)) { $article = new ArchiveArticle("$Page$Args.html"); $Place[1] = ' '.$article->date.''; print preg_replace('{(?<=

)(.*?)(?=

)}', ($edit ?: '\1').' [[1]]', ob_get_clean()); - if ($article->image) { + if ($article->file and $article->image) { $Place['image'] = "https://lijtweg.nl/".$article->thumb('600x'); } if (!empty($User['admin'])) { -- 2.30.0