X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/328e964708c7e9dc479a25f9358b2d03e9d7f66c..4867902ad83bc343db74316e54058d85627ec5f2:/nieuws.inc.php diff --git a/nieuws.inc.php b/nieuws.inc.php index 7e723e4..3d88a26 100644 --- a/nieuws.inc.php +++ b/nieuws.inc.php @@ -6,12 +6,11 @@ $monthname = ['?', function shownewsdate($url) { - $parts = pathinfo($url); - $year = pathinfo($parts['dirname'], PATHINFO_FILENAME); - @list ($month, $day) = explode('-', $parts['filename'], 3); + if (!preg_match('', $url, $parts)) return; global $monthname; - return sprintf('%s %s %s', - intval($day), $monthname[intval($month)], $year); + return implode(' ', array_filter([ + intval($parts[3]), $parts[2] > 0 ? $monthname[intval($parts[2])] : '', $parts[1], + ])); } function shownewsarticle($url, $link = TRUE, $title = NULL) @@ -44,10 +43,11 @@ function shownews($root, $limit = 5) } } -function printtoc($root) +function printtoc($input) { + if (!is_array($input)) $input = glob("$input/*.html"); print '