page: header metadata from article object
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 24 Jun 2019 14:56:41 +0000 (16:56 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Fri, 28 Jun 2019 01:20:30 +0000 (03:20 +0200)
foto/index.php
head.inc.php
login/emulate/index.php
login/index.php
nieuws/index.php

index f438cb96a7f92dc4e8f9ad86375f4cc19ad0201e..358ef942aae9bf492c13358ad22b6cb685fbd4c1 100644 (file)
@@ -19,7 +19,7 @@ if ($User and $User->admin) {
 $nav = explode('/', $rootdir);
 $nav[0] = "Foto's"; # override of root 'foto'
 $title = array_pop($nav);
 $nav = explode('/', $rootdir);
 $nav[0] = "Foto's"; # override of root 'foto'
 $title = array_pop($nav);
-$Place['title'] = implode(' ', $nav) . ': ' . $title;
+$Article->title = implode(' ', $nav) . ': ' . $title;
 
 $link = '';
 print "<h2>";
 
 $link = '';
 print "<h2>";
@@ -79,7 +79,7 @@ if ($imgs = glob("$rootdir/*.jpg")) {
        foreach ($imgs as $img) {
                if ($img == "$rootdir/index.jpg") {
                        # cover image of current album
        foreach ($imgs as $img) {
                if ($img == "$rootdir/index.jpg") {
                        # cover image of current album
-                       $Place['image'] = "/thumb/640x/$img";
+                       $Article->image = "/$img";
                        continue;
                }
                if (!is_link($img)) continue;
                        continue;
                }
                if (!is_link($img)) continue;
index 1e57e666a369877183a7326fa472bf9a716544db..68ec4ca96f08789b20cd815aaccd9f945e14062f 100644 (file)
@@ -2,16 +2,16 @@
 <html lang="nl">
 <head>
        <meta charset="utf-8" />
 <html lang="nl">
 <head>
        <meta charset="utf-8" />
-<?php if (!empty($Place['title'])) { ?>
-       <title><?= htmlspecialchars($Place['title']) ?></title>
+<?php if ($Article->title) { ?>
+       <title><?= htmlspecialchars($Article->safetitle) ?></title>
 <?php } ?>
 <?php if (!empty($Place['description'])) { ?>
        <meta name="description" property="og:description" content="<?= strip_tags($Place['description']) ?>" />
 <?php } ?>
        <meta name="viewport" content="width=device-width" />
        <!--[if lt IE 9]><script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script><![endif]-->
 <?php } ?>
 <?php if (!empty($Place['description'])) { ?>
        <meta name="description" property="og:description" content="<?= strip_tags($Place['description']) ?>" />
 <?php } ?>
        <meta name="viewport" content="width=device-width" />
        <!--[if lt IE 9]><script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script><![endif]-->
-<?php if (!empty($Place['image'])) { ?>
-       <meta property="og:image" content="https://<?= $_SERVER['HTTP_HOST'] . htmlspecialchars($Place['image']) ?>" />
+<?php if ($Article->image) { ?>
+       <meta property="og:image" content="https://<?= $_SERVER['HTTP_HOST'] . '/' . htmlspecialchars($Article->thumb('640x')) ?>" />
 <?php } ?>
 </head>
 <body>
 <?php } ?>
 </head>
 <body>
index 9d76ebb9c9174351612f62812416d57362a0d2ea..f7b59bc4d279f8feb23912da4a4003880ae0ddb8 100644 (file)
@@ -12,7 +12,7 @@ catch (Exception $e) {
 
 $Place['login/name'] = $user->name ?: 'bewoner';
 $Place['user'] = $user->login;
 
 $Place['login/name'] = $user->name ?: 'bewoner';
 $Place['user'] = $user->login;
-$Place['title'] = "Login {$user->login}";
+$Article->title = "Login {$user->login}";
 if ( $password = trim(@file_get_contents("{$user->dir}/.passwd")) ) {
        if (substr($password, 0, 1) == '$') {
                $password = NULL; // hashed
 if ( $password = trim(@file_get_contents("{$user->dir}/.passwd")) ) {
        if (substr($password, 0, 1) == '$') {
                $password = NULL; // hashed
index 978709e5fe5515f51f66ba30f224bb653915dfbd..fc721b1a70d4dcac5a508ba21899067449756bb0 100644 (file)
@@ -39,13 +39,13 @@ if (empty($User)) {
        ob_clean();
        require_once 'login/form.inc.php';
        $Place['warn'] = $message;
        ob_clean();
        require_once 'login/form.inc.php';
        $Place['warn'] = $message;
-       $Place['title'] = 'Inloggen';
+       $Article->title = 'Inloggen';
        if (isset($_REQUEST['goto'])) {
                $target = ltrim($_REQUEST['goto'], '/');
                $target = new ArchiveArticle("$target.html");
                if ($target->file) {
                        if ($target->title) {
        if (isset($_REQUEST['goto'])) {
                $target = ltrim($_REQUEST['goto'], '/');
                $target = new ArchiveArticle("$target.html");
                if ($target->file) {
                        if ($target->title) {
-                               $Place['title'] .= ' voor ' . $target->title;
+                               $Article->title .= ' voor ' . $target->title;
                        }
                }
        }
                        }
                }
        }
index 23cfe4f7b78a3c3ec2beb846d3332921a44d1475..18416b32ad342377fe3a5283608b05940e76e99c 100644 (file)
@@ -8,15 +8,14 @@ if ($User and $User->admin) {
 
 if ($page and !is_numeric($page)) {
        $edit = $User && $User->admin ? htmlspecialchars(@$_GET['edit']) : NULL;
 
 if ($page and !is_numeric($page)) {
        $edit = $User && $User->admin ? htmlspecialchars(@$_GET['edit']) : NULL;
-       $Place['title'] = $edit ?: $Article->title;
+       if ($edit) {
+               $Article->title = $edit;
+       }
        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) {
                $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) {
-               $Place['image'] = "/".$Article->thumb('600x');
-       }
        if ($User and $User->admin) {
                $taglist = [];
                foreach (glob("$Page/.tags/*") as $tagpath) {
        if ($User and $User->admin) {
                $taglist = [];
                foreach (glob("$Page/.tags/*") as $tagpath) {