X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/3da476bb04d8dcb7545a5c7eb328054c7ee20df3..686de24f732b400e770df83b469c37bf4e6d4874:/nieuws.inc.php
diff --git a/nieuws.inc.php b/nieuws.inc.php
index f9fec6a..3f3f163 100644
--- a/nieuws.inc.php
+++ b/nieuws.inc.php
@@ -1,4 +1,5 @@
', $url, $parts)) return;
+ if (!preg_match('(\d{4})/(\d{2})-(\d{2})->', $url, $parts)) return;
global $monthname;
return implode(' ', array_filter([
- intval($parts[3]), $monthname[intval($parts[2])], $parts[1],
+ intval($parts[3]), $parts[2] > 0 ? $monthname[intval($parts[2])] : '', $parts[1],
]));
}
@@ -24,29 +25,30 @@ function shownewsarticle($url, $link = TRUE, $title = NULL)
$title = sprintf(
$link ? '
' : '%s
',
getoutput([1 => ' '.$date.'']),
- preg_replace('/\.html$/', '', $url)
+ $url
);
return preg_replace('{(.*?)
}', $title, $html);
}
-function shownews($root, $limit = 5)
+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 "";
ob_start();
include $url;
- print shownewsarticle($url);
+ print shownewsarticle(preg_replace('/\.html$/', '', $url));
print "\n\n";
if (--$limit <= 0) break;
}
}
-function printtoc($root)
+function printtoc($input)
{
+ if (!is_array($input)) $input = glob("$input/*.html");
print '';
- foreach (array_reverse(glob("$root/*.html")) as $page) {
+ foreach (array_reverse($input) as $page) {
$title = fgets(fopen($page, 'r'));
$title = strip_tags($title);
$linkurl = preg_replace('/\.html$/', '', $page);