X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/686de24f732b400e770df83b469c37bf4e6d4874..acc39fd2f0eaf516dbb534232ed5f631c269886b:/nieuws.inc.php?ds=inline
diff --git a/nieuws.inc.php b/nieuws.inc.php
index 3f3f163..57c53fc 100644
--- a/nieuws.inc.php
+++ b/nieuws.inc.php
@@ -14,6 +14,15 @@ function shownewsdate($url)
]));
}
+function shownewsimage($url)
+{
+ foreach (['jpg', 'png'] as $ext) {
+ if (file_exists("$url.$ext")) {
+ return "$url.$ext";
+ }
+ }
+}
+
function shownewsarticle($url, $link = TRUE, $title = NULL)
{
$html = ob_get_clean();
@@ -27,21 +36,39 @@ function shownewsarticle($url, $link = TRUE, $title = NULL)
getoutput([1 => ' '.$date.'']),
$url
);
+
+ if (!$link and $image = shownewsimage($url)) {
+ global $Place;
+ $Place['image'] = "https://lijtweg.nl/thumb/600x/".$image;
+ ob_start();
+ print '[[1]]';
+ $html .= getoutput([
+ 1 => sprintf("\n".'
', "/thumb/640x/".$image),
+ ]);
+ }
+
return preg_replace('{(.*?)
}', $title, $html);
}
function shownews($input, $limit = 1000)
{
if (!is_array($input)) $input = glob("$input/*.html");
- foreach (array_reverse($input) as $url) {
- print "";
+ print ''."\n\n";
+ foreach (array_reverse($input) as $filename) {
+ $url = preg_replace('/\.html$/', '', $filename);
+ print '- ';
+ if ($image = shownewsimage($url)) {
+ printf('', "/thumb/300x/".$image);
+ }
+ print '';
ob_start();
- include $url;
- print shownewsarticle(preg_replace('/\.html$/', '', $url));
- print "\n\n";
+ include $filename;
+ print shownewsarticle($url);
+ print "
\n\n";
if (--$limit <= 0) break;
}
+ print "\n\n";
}
function printtoc($input)