diff options
author | lisps <stummp@loewen.de> | 2014-03-19 10:32:55 +0100 |
---|---|---|
committer | lisps <stummp@loewen.de> | 2014-03-19 10:32:55 +0100 |
commit | 7b62b42de1887c3627c727f0483aea41556742d4 (patch) | |
tree | 96dbc0f8ab18df7212ebc3dfd6d5f1434ef34335 | |
parent | e310313d794a3336d279ee09973508e794dbf08e (diff) | |
download | dokuwiki-7b62b42de1887c3627c727f0483aea41556742d4.tar.gz dokuwiki-7b62b42de1887c3627c727f0483aea41556742d4.zip |
add config date_at_format
change translation message
-rw-r--r-- | conf/dokuwiki.php | 1 | ||||
-rw-r--r-- | doku.php | 21 | ||||
-rw-r--r-- | inc/common.php | 1 | ||||
-rw-r--r-- | inc/lang/en/lang.php | 3 |
4 files changed, 23 insertions, 3 deletions
diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php index bdc9739d1..f92e81e8c 100644 --- a/conf/dokuwiki.php +++ b/conf/dokuwiki.php @@ -155,6 +155,7 @@ $conf['broken_iua'] = 0; //Platform with broken ignore_user_abor $conf['xsendfile'] = 0; //Use X-Sendfile (1 = lighttpd, 2 = standard) $conf['renderer_xhtml'] = 'xhtml'; //renderer to use for main page generation $conf['readdircache'] = 0; //time cache in second for the readdir operation, 0 to deactivate. +$conf['date_at_format'] = 'Y-m-d-H:i:s'; /* Network Settings */ $conf['dnslookups'] = 1; //disable to disallow IP to hostname lookups @@ -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; diff --git a/inc/common.php b/inc/common.php index 0b15c284d..44cfe91ba 100644 --- a/inc/common.php +++ b/inc/common.php @@ -395,6 +395,7 @@ function wl($id = '', $urlParameters = '', $absolute = false, $separator = '& global $conf; if(is_array($urlParameters)) { if(isset($urlParameters['rev']) && !$urlParameters['rev']) unset($urlParameters['rev']); + if(isset($urlParameters['at']) && $conf['date_at_format']) $urlParameters['at'] = date($conf['date_at_format'],$urlParameters['at']); $urlParameters = buildURLparams($urlParameters, $separator); } else { $urlParameters = str_replace(',', $separator, $urlParameters); diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php index 278be82cd..2fee15853 100644 --- a/inc/lang/en/lang.php +++ b/inc/lang/en/lang.php @@ -366,5 +366,6 @@ $lang['currentns'] = 'Current namespace'; $lang['searchresult'] = 'Search Result'; $lang['plainhtml'] = 'Plain HTML'; $lang['wikimarkup'] = 'Wiki Markup'; -$lang['page_nonexist_rev'] = "Page has not existed with revision %d, try %d"; +$lang['page_nonexist_rev'] = 'Page did not exist at %s. It was subsequently created at %s.'; +$lang['unable_to_parse_date'] = 'Unable to parse at parameter "%s" with format "%s".'; //Setup VIM: ex: et ts=2 : |