From 7b62b42de1887c3627c727f0483aea41556742d4 Mon Sep 17 00:00:00 2001 From: lisps Date: Wed, 19 Mar 2014 10:32:55 +0100 Subject: add config date_at_format change translation message --- doku.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'doku.php') diff --git a/doku.php b/doku.php index d984d90e8..733730913 100644 --- a/doku.php +++ b/doku.php @@ -34,7 +34,7 @@ $QUERY = trim($INPUT->str('id')); $ID = getID(); $REV = $INPUT->int('rev'); -$DATE_AT = $INPUT->int('at'); +$DATE_AT = $INPUT->str('at'); $IDX = $INPUT->str('idx'); $DATE = $INPUT->int('date'); $RANGE = $INPUT->str('range'); @@ -48,6 +48,19 @@ $PRE = cleanText(substr($INPUT->post->str('prefix'), 0, -1)); $SUF = cleanText($INPUT->post->str('suffix')); $SUM = $INPUT->post->str('summary'); + +//parse DATE_AT +if($DATE_AT && $conf['date_at_format']) { + $date_o = DateTime::createFromFormat($conf['date_at_format'],$DATE_AT); + if(!$date_o) { + msg(sprintf($lang['unable_to_parse_date'], $DATE_AT,$conf['date_at_format'])); + $DATE_AT = null; + } else { + $DATE_AT = $date_o->getTimestamp(); + } +} + +//check for existing $REV related to $DATE_AT if($DATE_AT) { $pagelog = new PageChangeLog($ID); $rev_t = $pagelog->getLastRevisionAt($DATE_AT); @@ -55,7 +68,11 @@ if($DATE_AT) { $REV = ''; } else if ($rev_t === false) { $rev_n = $pagelog->getRelativeRevision($DATE_AT,+1); - msg(sprintf($lang['page_nonexist_rev'], $DATE_AT,$rev_n)); + if($conf['date_at_format']) { + msg(sprintf($lang['page_nonexist_rev'], date($conf['date_at_format'],$DATE_AT),date($conf['date_at_format'],$rev_n))); + } else { + msg(sprintf($lang['page_nonexist_rev'], $DATE_AT,$rev_n)); + } $REV = $DATE_AT; } else { $REV = $rev_t; -- cgit v1.2.3