<?php
-include 'nieuws.inc.php';
+$replyform = $Page->handler == 'melding' && $User->login;
+@list ($year, $page) = explode('/', trim($Page->path, '/'));
-@list ($year, $page) = explode('/', trim($Args, '/'));
+if ($User->admin("edit {$Page->handler}")) {
+ print '<script src="/nieuws/edit.js"></script>'."\n";
+}
if ($page and !is_numeric($page)) {
- $edit = !empty($User['admin']) ? htmlspecialchars(@$_GET['edit']) : NULL;
- print shownewsarticle($Args, FALSE, $edit);
- return 1;
+ $Page->meta['og:type'] = 'article';
+ $edit = $User->admin("edit {$Page->link}") ? htmlspecialchars(@$_GET['edit']) : NULL;
+ if ($edit) {
+ $Page->title = $edit;
+ }
+ if ($Page->dateparts) {
+ $Place[1] = ' <small class="date">'.$Page->date.'</small>';
+ }
+ else {
+ $Place[1] = '';
+ }
+ print preg_replace('{(?<=<h2>)(.*?)(?=</h2>)}', ($edit ?: '\1').' [[1]]', $Page->raw);
+ if ($User->admin("edit {$Page->link}")) {
+ $taglist = [];
+ foreach (glob("{$Page->handler}/.tags/*") as $tagpath) {
+ $tagname = pathinfo($tagpath, PATHINFO_BASENAME);
+ $tagvalue = file_exists("$tagpath/$year-$page.html");
+ $tagtarget = is_writable($tagpath);
+ $taglist[] = sprintf(
+ '<input type="checkbox" name="%s" value="%s" id="%s"%s%s />' .
+ '<label for="%3$s"> %s</label>',
+ "tags[$tagname]", $tagname, "tag-$tagname",
+ $tagvalue ? ' checked' : '',
+ ' disabled',
+ ucfirst($tagname)
+ );
+ }
+ if ($taglist) {
+ printf('<p class="tags"><strong>Tags:</strong> %s</p>'."\n",
+ implode("\n\t", $taglist)
+ );
+ }
+ }
+ if ($replyform) {
+ print $Page->widget('reply');
+ }
+ return;
}
if ($year) {
- ob_clean();
- if (is_numeric($year)) {
- $title = "Nieuws ".($page ? $monthname[$page].' ' : '').$year;
- $match = "$Page/$year/";
- if ($page) $match .= sprintf('%02d-', $page);
+ $match = $Page->handler;
+ $title = "Nieuws";
+ if (is_numeric($year) and $year > 999) {
+ $match .= "/$year";
+ if (is_numeric($page)) {
+ $title .= ' '.$monthname[intval($page)];
+ $match .= sprintf('%02d-', $page);
+ }
+ $title .= ' '.$year;
}
- else {
- $title = "Nieuws vóór 2000";
- $match = "$Page/19??/";
+ elseif ($year === '19') {
+ $match .= "/19??";
+ $title .= " vóór 2000";
+ }
+ elseif (file_exists("{$Page->handler}/.tags/$year")) {
+ $match .= "/.tags/$year";
+ $title .= " met $year";
}
print "<h2>$title</h2>\n\n";
- print '<div id="news">'."\n\n";
- shownews(glob($match.'*.html'));
- print "</div>\n\n";
- return 1;
-}
-
-if ($Args) {
+ print $Page->widget('nieuws', [$match]);
return;
}
-
-print '<div id="news">'."\n\n";
-
-foreach (array_reverse(glob("$Page/2???")) as $page) {
- $year = basename($page, '.html');
- printf('<h3><a href="/%s">%s</a></h3>'."\n", $page, $year);
- printtoc($page);
-}
-
-if ($pages = glob("$Page/19??/*.html")) {
- printf('<h3><a href="/%s">%s</a></h3>'."\n", "$Page/oud", 'Eerder');
- printtoc($pages);
-}
-
-print "</div>\n\n";
-
-if (!empty($User['admin'])) {
- print '<script src="/nieuws/edit.js"></script>'."\n";
-}