From: Mischa POSLAWSKY Date: Mon, 17 Sep 2018 15:43:01 +0000 (+0200) Subject: nieuws: ignore missing image/contents of new articles X-Git-Tag: v3.7~1 X-Git-Url: http://git.shiar.nl/minimedit.git/commitdiff_plain/e6d26c20628195fde6f3edfb31e5db8d31551adf nieuws: ignore missing image/contents of new articles Cover image feature was not tested on article creation, causing harmless but alarming PHP errors. --- 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'])) {