nieuws: archive pages by year only
[minimedit.git] / nieuws.inc.php
index f4d42d8d82223a9b3898ca8a91abb6622e5ba390..8af5694a62dfb5e2c12987d57561e8921c9891a5 100644 (file)
@@ -7,7 +7,7 @@ $monthname = ['?',
 
 function shownewsdate($url)
 {
-       if (!preg_match('</(\d{4})/(\d{2})/(\d{2})->', $url, $parts)) return;
+       if (!preg_match('</(\d{4})/(\d{2})-(\d{2})->', $url, $parts)) return;
        global $monthname;
        return implode(' ', array_filter([
                intval($parts[3]), $parts[2] > 0 ? $monthname[intval($parts[2])] : '', $parts[1],
@@ -30,10 +30,10 @@ function shownewsarticle($url, $link = TRUE, $title = NULL)
        return preg_replace('{<h2>(.*?)</h2>}', $title, $html);
 }
 
-function shownews($root, $limit = 1000)
+function shownews($input, $limit = 1000)
 {
-       if (strpos($root, '/') === FALSE) $root .= '/*';
-       foreach (array_reverse(glob("$root/*.html")) as $url) {
+       if (!is_array($input)) $input = glob("$input/*.html");
+       foreach (array_reverse($input) as $url) {
                print "<article>";
                ob_start();
                include $url;