nieuws: ignore missing image/contents of new articles
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 17 Sep 2018 15:43:01 +0000 (17:43 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 17 Sep 2018 19:01:38 +0000 (21:01 +0200)
Cover image feature was not tested on article creation, causing harmless but
alarming PHP errors.

nieuws.inc.php
nieuws/index.php

index 930eb00a2c96a8b4cb415472a462d7fe20148702..54853158a6a18ea14514757469d470d9bb4c8f34 100644 (file)
@@ -29,6 +29,7 @@ class ArchiveArticle
 
        function file()
        {
+               if (!file_exists($this->page)) return;
                return fopen($this->page, 'r');
        }
 
index ad85011716c9825248995d28d4573d12ac67a5c8..18f44660d24312bf194fdeea9db70752d8070e96 100644 (file)
@@ -13,7 +13,7 @@ if ($page and !is_numeric($page)) {
        $article = new ArchiveArticle("$Page$Args.html");
        $Place[1] = ' <small class="date">'.$article->date.'</small>';
        print preg_replace('{(?<=<h2>)(.*?)(?=</h2>)}', ($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'])) {