nieuws: treat years before 2000 as single page
[minimedit.git] / nieuws.php
index 84a6172638cd446dc98a342f333497065bdfa9e4..b28f72bbf406f556a124ebb02a9867a4b310aed7 100644 (file)
@@ -11,15 +11,28 @@ if ($page) {
 
 if ($year) {
        ob_clean();
-       print "<h2>Nieuws $year</h2>\n\n";
-
+       if (is_numeric($year)) {
+               $title = "Nieuws ".($month ? $monthname[$month].' ' : '').$year;
+               $match = implode('/', [
+                       $Page, $year, $month ? sprintf('%02d', $month) : '??',
+               ]);
+       }
+       else {
+               $title = "Nieuws vóór 2000";
+               $match = "$Page/19??/??";
+       }
+
+       print "<h2>$title</h2>\n\n";
        print '<div id="news">'."\n\n";
-       shownews("$Page/$year/??", 100);
+       shownews($match, 100);
        print "</div>\n\n";
-
        return 1;
 }
 
+if ($Args) {
+       return;
+}
+
 print '<div id="news">'."\n\n";
 
 foreach (array_reverse(glob("$Page/2???")) as $page) {
@@ -28,6 +41,11 @@ foreach (array_reverse(glob("$Page/2???")) as $page) {
        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'])) {