nieuws: ignore missing page description in new articles
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 28 Apr 2019 23:22:49 +0000 (01:22 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Sun, 28 Apr 2019 23:25:50 +0000 (01:25 +0200)
Silence PHP warnings on article creation since v3.8-15-g628a397729
(2019-03-02) [nieuws: first paragraph teaser as page description]
in the same fashion as commit v3.6-26-ge6d26c2062 (2018-09-17)
[nieuws: ignore missing image/contents of new articles].

nieuws/index.php

index 71048d50cc64228b11989ebd56d83f17997d891a..21ee366b22643230f01b4cfc222e93b991f0340d 100644 (file)
@@ -12,7 +12,9 @@ if ($page and !is_numeric($page)) {
        $edit = !empty($User['admin']) ? htmlspecialchars(@$_GET['edit']) : NULL;
        $article = new ArchiveArticle("$Page$Args.html");
        $Place['title'] = $edit ?: $article->title;
-       $Place['description'] = $article->teaser;
+       if ($article->file) {
+               $Place['description'] = $article->teaser;
+       }
        $Place[1] = ' <small class="date">'.$article->date.'</small>';
        print preg_replace('{(?<=<h2>)(.*?)(?=</h2>)}', ($edit ?: '\1').' [[1]]', ob_get_clean());
        if ($article->file and $article->image) {