page: promote news article class to represent all pages
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 24 Jun 2019 14:12:57 +0000 (16:12 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Fri, 28 Jun 2019 01:20:30 +0000 (03:20 +0200)
article.inc.php [moved from nieuws.inc.php with 100% similarity]
login/index.php
nieuws.php
nieuws/feed/index.php
nieuws/index.php
page.php
search.php

similarity index 100%
rename from nieuws.inc.php
rename to article.inc.php
index 9ebc4cb846159ef04c715e922f9f46d90ef84ec2..978709e5fe5515f51f66ba30f224bb653915dfbd 100644 (file)
@@ -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) {
index 251443842cd67d20105c0af95898bfdb631faeca..15a0dfbc85d0a0ea0f006f01ece45c76b09a90e9 100644 (file)
@@ -1,6 +1,4 @@
 <?php
-include_once 'nieuws.inc.php';
-
 if (!function_exists('shownews')) {
 function shownews($input, $limit = 1000)
 {
index 3bea1b728582a8c820f3bfb0319c2c52cb273b7a..fdb91d5a66b77c0442d1ce9545c3d96f5239db02 100644 (file)
@@ -13,7 +13,6 @@ $siteref = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTT
        <link href="<?= $siteref . $_SERVER['REQUEST_URI'] ?>" rel="self" />
        <author><name>Lijtweg</name></author>
 <?php
-include 'nieuws.inc.php';
 $root = preg_replace('{/feed$}', '', $Page) . "/2???";
 $pages = array_reverse(glob("$root/*.html"));
 
index cc2a8bf870ed0fa150d100f9268841bcb8798438..23cfe4f7b78a3c3ec2beb846d3332921a44d1475 100644 (file)
@@ -1,6 +1,4 @@
 <?php
-include 'nieuws.inc.php';
-
 $replyform = $Page == 'melding' && !empty($User);
 @list ($year, $page) = explode('/', trim($Args, '/'));
 
@@ -10,15 +8,14 @@ if ($User and $User->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] = ' <small class="date">'.$article->date.'</small>';
+       $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) {
-               $Place['image'] = "/".$article->thumb('600x');
+       if ($Article->file and $Article->image) {
+               $Place['image'] = "/".$Article->thumb('600x');
        }
        if ($User and $User->admin) {
                $taglist = [];
index 894efc003cc2671014e5115b2012870a4c55da2e..fb39f5143dfcd68f56aeb9ea07f5025e1ed29b74 100644 (file)
--- 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 '<div class="static">'."\n\n";
index 0b156078e81efee776c3a384c4a4a0b8822995a9..20c89f8625a5f25f7511e5b6057a9a244da7a5ae 100644 (file)
@@ -35,8 +35,6 @@ if (isset($Place['verbose'])) {
        );
 }
 
-require_once('nieuws.inc.php');
-
 if (!$results) {
        print "Niets gevonden.";
        return;