From 234326791b1e8177eb475bffc5956d7086cfac4e Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 24 Jun 2019 16:12:57 +0200 Subject: [PATCH] page: promote news article class to represent all pages --- nieuws.inc.php => article.inc.php | 0 login/index.php | 1 - nieuws.php | 2 -- nieuws/feed/index.php | 1 - nieuws/index.php | 15 ++++++--------- page.php | 3 +++ search.php | 2 -- 7 files changed, 9 insertions(+), 15 deletions(-) rename nieuws.inc.php => article.inc.php (100%) diff --git a/nieuws.inc.php b/article.inc.php similarity index 100% rename from nieuws.inc.php rename to article.inc.php diff --git a/login/index.php b/login/index.php index 9ebc4cb..978709e 100644 --- a/login/index.php +++ b/login/index.php @@ -41,7 +41,6 @@ if (empty($User)) { $Place['warn'] = $message; $Place['title'] = 'Inloggen'; if (isset($_REQUEST['goto'])) { - require_once 'nieuws.inc.php'; $target = ltrim($_REQUEST['goto'], '/'); $target = new ArchiveArticle("$target.html"); if ($target->file) { diff --git a/nieuws.php b/nieuws.php index 2514438..15a0dfb 100644 --- a/nieuws.php +++ b/nieuws.php @@ -1,6 +1,4 @@ " rel="self" /> Lijtweg admin) { if ($page and !is_numeric($page)) { $edit = $User && $User->admin ? htmlspecialchars(@$_GET['edit']) : NULL; - $article = new ArchiveArticle("$Page$Args.html"); - $Place['title'] = $edit ?: $article->title; - if ($article->file) { - $Place['description'] = $article->teaser; + $Place['title'] = $edit ?: $Article->title; + if ($Article->file) { + $Place['description'] = $Article->teaser; } - $Place[1] = ' '.$article->date.''; + $Place[1] = ' '.$Article->date.''; print preg_replace('{(?<=

)(.*?)(?=

)}', ($edit ?: '\1').' [[1]]', ob_get_clean()); - if ($article->file and $article->image) { - $Place['image'] = "/".$article->thumb('600x'); + if ($Article->file and $Article->image) { + $Place['image'] = "/".$Article->thumb('600x'); } if ($User and $User->admin) { $taglist = []; diff --git a/page.php b/page.php index 894efc0..fb39f51 100644 --- a/page.php +++ b/page.php @@ -165,6 +165,9 @@ elseif ($User and $User->admin) { # load static contents +require_once('article.inc.php'); +$Article = new ArchiveArticle($staticpage); + ob_start(); # page body ob_start(); # inner html print '
'."\n\n"; diff --git a/search.php b/search.php index 0b15607..20c89f8 100644 --- a/search.php +++ b/search.php @@ -35,8 +35,6 @@ if (isset($Place['verbose'])) { ); } -require_once('nieuws.inc.php'); - if (!$results) { print "Niets gevonden."; return; -- 2.30.0