nieuws: treat years before 2000 as single page
[minimedit.git] / nieuws.php
1 <?php
2 include 'nieuws.inc.php';
3
4 @list ($year, $month, $page) = explode('/', trim($Args, '/'));
5
6 if ($page) {
7         $edit = !empty($User['admin']) ? htmlspecialchars(@$_GET['edit']) : NULL;
8         print shownewsarticle($Args, FALSE, $edit);
9         return 1;
10 }
11
12 if ($year) {
13         ob_clean();
14         if (is_numeric($year)) {
15                 $title = "Nieuws ".($month ? $monthname[$month].' ' : '').$year;
16                 $match = implode('/', [
17                         $Page, $year, $month ? sprintf('%02d', $month) : '??',
18                 ]);
19         }
20         else {
21                 $title = "Nieuws vóór 2000";
22                 $match = "$Page/19??/??";
23         }
24
25         print "<h2>$title</h2>\n\n";
26         print '<div id="news">'."\n\n";
27         shownews($match, 100);
28         print "</div>\n\n";
29         return 1;
30 }
31
32 if ($Args) {
33         return;
34 }
35
36 print '<div id="news">'."\n\n";
37
38 foreach (array_reverse(glob("$Page/2???")) as $page) {
39         $year = basename($page, '.html');
40         printf('<h3><a href="/%s">%s</a></h3>'."\n", $page, $year);
41         printtoc("$page/??");
42 }
43
44 if ($pages = glob("$Page/19??/??/*.html")) {
45         printf('<h3><a href="/%s">%s</a></h3>'."\n", "$Page/oud", 'Eerder');
46         printtoc($pages);
47 }
48
49 print "</div>\n\n";
50
51 if (!empty($User['admin'])) {
52         print '<script src="/nieuws/edit.js"></script>'."\n";
53 }