diff options
Diffstat (limited to 'doku.php')
-rw-r--r-- | doku.php | 39 |
1 files changed, 37 insertions, 2 deletions
@@ -9,7 +9,7 @@ */ // update message version -$updateVersion = 45; +$updateVersion = 46.1; // xdebug_start_profiling(); @@ -34,6 +34,7 @@ $QUERY = trim($INPUT->str('id')); $ID = getID(); $REV = $INPUT->int('rev'); +$DATE_AT = $INPUT->str('at'); $IDX = $INPUT->str('idx'); $DATE = $INPUT->int('date'); $RANGE = $INPUT->str('range'); @@ -47,7 +48,41 @@ $PRE = cleanText(substr($INPUT->post->str('prefix'), 0, -1)); $SUF = cleanText($INPUT->post->str('suffix')); $SUM = $INPUT->post->str('summary'); -//make info about the selected page available + +//parse DATE_AT +if($DATE_AT) { + $date_parse = strtotime($DATE_AT); + if($date_parse) { + $DATE_AT = $date_parse; + } else { // check for UNIX Timestamp + $date_parse = @date('Ymd',$DATE_AT); + if(!$date_parse || $date_parse === '19700101') { + msg(sprintf($lang['unable_to_parse_date'], $DATE_AT)); + $DATE_AT = null; + } + } +} + +//check for existing $REV related to $DATE_AT +if($DATE_AT) { + $pagelog = new PageChangeLog($ID); + $rev_t = $pagelog->getLastRevisionAt($DATE_AT); + if($rev_t === '') { //current revision + $REV = null; + $DATE_AT = null; + } else if ($rev_t === false) { //page did not exist + $rev_n = $pagelog->getRelativeRevision($DATE_AT,+1); + msg(sprintf($lang['page_nonexist_rev'], + strftime($conf['dformat'],$DATE_AT), + wl($ID, array('rev' => $rev_n)), + strftime($conf['dformat'],$rev_n))); + $REV = $DATE_AT; //will result in a page not exists message + } else { + $REV = $rev_t; + } +} + +//make infos about the selected page available $INFO = pageinfo(); //export minimal info to JS, plugins can add more |