X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/f74276ad4a38479c8a5f7ccf065ab576cf2d192d..1abb286e88defee799e43cdd296914f74f722bde:/nieuws.php diff --git a/nieuws.php b/nieuws.php index 157986c..0dc8d7d 100644 --- a/nieuws.php +++ b/nieuws.php @@ -1,19 +1,73 @@ '; + if ($article->thumb) { + $imgattr = ' class="left"'; + if (preg_match('{ (\s alt="[^"]+") }x', $article->img, $img)) { + $imgattr .= $img[0]; # preserve alt value + } + printf('', $article->thumb, $imgattr); + } + print '
'; + printf( + '

%s %s

', + $article->link, $article->title, $article->date + ); + print $article->story; + print '
'; + print "\n\n"; -if ($Args) { - $edit = !empty($User['admin']) ? htmlspecialchars(@$_GET['edit']) : NULL; - print shownewsarticle($Args, FALSE, $edit); - return; + if (--$limit <= 0) break; + } } -ob_clean(); -print "

Nieuwsarchief

\n\n"; +function printtoc($input, $class = FALSE) +{ + if (!is_array($input)) $input = glob("$input/*.html"); + print ''; + foreach (array_reverse($input) as $page) { + $article = new ArchiveArticle($page); + $html = $article->safetitle; + $dateparts = $article->dateparts; + if ($class) { + $dateparts[0] = NULL; # omit year + } + $html .= sprintf(' %s', showdate($dateparts)); + if ($class == 'gallery' and $article->img) { + $html = "
$html
"; + $html = sprintf('', $article->thumb(200)) . $html; + } + $html = sprintf('%s', $article->link, $html); + print "
  • $html
  • \n"; + } + print "\n"; +} +} -print '
    '."\n\n"; -shownews($Page, 20); -print "
    \n\n"; +$articles = (ltrim($Args, '/') ?: 'nieuws'); +if (strpos($articles, '/') === FALSE) { + if (@$Place['view'] === 'toc') { + foreach (array_reverse(glob("$articles/2???")) as $page) { + $year = basename($page, '.html'); + printf('

    %s

    '."\n", $page, $year); + printtoc($page, 'gallery'); + } + return; + } + $articles .= '/????'; +} -if (!empty($User['admin'])) { - print ''."\n"; +if (@$Place['view'] === 'toc') { + printtoc($articles); + return; } +ob_start(); +shownews($articles, @$Place['n'] ?: 5); +print getoutput();