X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/4867902ad83bc343db74316e54058d85627ec5f2..234326791b1e8177eb475bffc5956d7086cfac4e:/nieuws.php diff --git a/nieuws.php b/nieuws.php index b28f72b..15a0dfb 100644 --- a/nieuws.php +++ b/nieuws.php @@ -1,53 +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->body; + print '
'; + print "\n\n"; -@list ($year, $month, $page) = explode('/', trim($Args, '/')); - -if ($page) { - $edit = !empty($User['admin']) ? htmlspecialchars(@$_GET['edit']) : NULL; - print shownewsarticle($Args, FALSE, $edit); - return 1; -} - -if ($year) { - ob_clean(); - if (is_numeric($year)) { - $title = "Nieuws ".($month ? $monthname[$month].' ' : '').$year; - $match = implode('/', [ - $Page, $year, $month ? sprintf('%02d', $month) : '??', - ]); + if (--$limit <= 0) break; } - else { - $title = "Nieuws vóór 2000"; - $match = "$Page/19??/??"; - } - - print "

$title

\n\n"; - print '
'."\n\n"; - shownews($match, 100); - print "
\n\n"; - return 1; } -if ($Args) { - return; +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"; - -foreach (array_reverse(glob("$Page/2???")) as $page) { - $year = basename($page, '.html'); - printf('

    %s

    '."\n", $page, $year); - printtoc("$page/??"); } -if ($pages = glob("$Page/19??/??/*.html")) { - printf('

    %s

    '."\n", "$Page/oud", 'Eerder'); - printtoc($pages); +$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 .= '/????'; } -print "
    \n\n"; - -if (!empty($User['admin'])) { - print ''."\n"; +if (@$Place['view'] === 'toc') { + printtoc($articles); + return; } +ob_start(); +shownews($articles, @$Place['n'] ?: 5); +print getoutput();