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],
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;
var today = new Date().toJSON().slice(0, 10).split('-');
var input = prompt('Paginatitel', '');
if (!input) return false;
- var url = today[0] + '/' + today[1] + '/' + today[2] + '-' +
+ var url = today[0] + '/' + today[1] + '-' + today[2] + '-' +
input.toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
var title = encodeURIComponent(input.trim());
window.location = '/nieuws/'+url+'?edit='+title+'#edit';
<?php
include 'nieuws.inc.php';
-@list ($year, $month, $page) = explode('/', trim($Args, '/'));
+@list ($year, $page) = explode('/', trim($Args, '/'));
-if ($page) {
+if ($page and !is_numeric($page)) {
$edit = !empty($User['admin']) ? htmlspecialchars(@$_GET['edit']) : NULL;
print shownewsarticle($Args, FALSE, $edit);
return 1;
if ($year) {
ob_clean();
if (is_numeric($year)) {
- $title = "Nieuws ".($month ? $monthname[$month].' ' : '').$year;
- $match = implode('/', [
- $Page, $year, $month ? sprintf('%02d', $month) : '??',
- ]);
+ $title = "Nieuws ".($page ? $monthname[$page].' ' : '').$year;
+ $match = "$Page/$year/";
+ if ($page) $match .= sprintf('%02d-', $page);
}
else {
$title = "Nieuws vóór 2000";
- $match = "$Page/19??/??";
+ $match = "$Page/19??/";
}
print "<h2>$title</h2>\n\n";
print '<div id="news">'."\n\n";
- shownews($match);
+ shownews(glob($match.'*.html'));
print "</div>\n\n";
return 1;
}
foreach (array_reverse(glob("$Page/2???")) as $page) {
$year = basename($page, '.html');
printf('<h3><a href="/%s">%s</a></h3>'."\n", $page, $year);
- printtoc("$page/??");
+ printtoc($page);
}
-if ($pages = glob("$Page/19??/??/*.html")) {
+if ($pages = glob("$Page/19??/*.html")) {
printf('<h3><a href="/%s">%s</a></h3>'."\n", "$Page/oud", 'Eerder');
printtoc($pages);
}