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