From: Mischa POSLAWSKY Date: Thu, 1 Nov 2018 01:15:03 +0000 (+0100) Subject: nieuws: ignore missing day in partial article dates X-Git-Tag: v3.8~14 X-Git-Url: http://git.shiar.net/minimedit.git/commitdiff_plain/cf16f4e70f57705e5f6308c10c3af3586b4b3940 nieuws: ignore missing day in partial article dates Excelsior feature broken in commit v2.6-9-g3da476bb04 (2018-06-08) [nieuws: parse date using single regexp] causing mismatch and PHP warnings. --- diff --git a/nieuws.inc.php b/nieuws.inc.php index 35ae092..e298569 100644 --- a/nieuws.inc.php +++ b/nieuws.inc.php @@ -9,7 +9,7 @@ function showdate($parts) { global $monthname; return implode(' ', array_filter([ - intval($parts[3]), $parts[2] > 0 ? $monthname[intval($parts[2])] : '', $parts[1], + intval(@$parts[3]), $parts[2] > 0 ? $monthname[intval($parts[2])] : '', $parts[1], count($parts) > 6 ? "$parts[4]:$parts[5]" : '', ])); } @@ -60,7 +60,7 @@ class ArchiveArticle function dateparts() { - preg_match('', $this->page, $ymd); + preg_match('< / (\d{4}) [/-] (\d{2}) (?:- (\d{2}) )? - >x', $this->page, $ymd); return $ymd; }