nieuws: archive pages by year only
[minimedit.git] / nieuws / index.php
1 <?php
2 include 'nieuws.inc.php';
3
4 @list ($year, $page) = explode('/', trim($Args, '/'));
5
6 if ($page and !is_numeric($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 ".($page ? $monthname[$page].' ' : '').$year;
16                 $match = "$Page/$year/";
17                 if ($page) $match .= sprintf('%02d-', $page);
18         }
19         else {
20                 $title = "Nieuws vóór 2000";
21                 $match = "$Page/19??/";
22         }
23
24         print "<h2>$title</h2>\n\n";
25         print '<div id="news">'."\n\n";
26         shownews(glob($match.'*.html'));
27         print "</div>\n\n";
28         return 1;
29 }
30
31 if ($Args) {
32         return;
33 }
34
35 print '<div id="news">'."\n\n";
36
37 foreach (array_reverse(glob("$Page/2???")) as $page) {
38         $year = basename($page, '.html');
39         printf('<h3><a href="/%s">%s</a></h3>'."\n", $page, $year);
40         printtoc($page);
41 }
42
43 if ($pages = glob("$Page/19??/*.html")) {
44         printf('<h3><a href="/%s">%s</a></h3>'."\n", "$Page/oud", 'Eerder');
45         printtoc($pages);
46 }
47
48 print "</div>\n\n";
49
50 if (!empty($User['admin'])) {
51         print '<script src="/nieuws/edit.js"></script>'."\n";
52 }