X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/328e964708c7e9dc479a25f9358b2d03e9d7f66c..c3518f67a1134e20a497dbfc3161353b650e279d:/nieuws.php?ds=inline
diff --git a/nieuws.php b/nieuws.php
index 84a6172..2514438 100644
--- a/nieuws.php
+++ b/nieuws.php
@@ -1,35 +1,75 @@
';
+ 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(
+ '
',
+ $article->link, $article->title, $article->date
+ );
+ print $article->body;
+ print '
';
+ print "\n\n";
-if ($page) {
- $edit = !empty($User['admin']) ? htmlspecialchars(@$_GET['edit']) : NULL;
- print shownewsarticle($Args, FALSE, $edit);
- return 1;
+ if (--$limit <= 0) break;
+ }
}
-if ($year) {
- ob_clean();
- print "Nieuws $year
\n\n";
-
- print ''."\n\n";
- shownews("$Page/$year/??", 100);
- print "
\n\n";
-
- return 1;
+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('
'."\n", $page, $year);
- printtoc("$page/??");
}
-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(''."\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();