parse AT parameter: first strtotime then timestamp

remove config option
This commit is contained in:
lisps 2014-09-29 10:13:57 +02:00
parent 1d053a561d
commit 80d9f3ddb3
5 changed files with 21 additions and 21 deletions

View File

@ -155,7 +155,6 @@ $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

View File

@ -50,13 +50,16 @@ $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();
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;
}
}
}
@ -64,16 +67,16 @@ if($DATE_AT && $conf['date_at_format']) {
if($DATE_AT) {
$pagelog = new PageChangeLog($ID);
$rev_t = $pagelog->getLastRevisionAt($DATE_AT);
if($rev_t === '') {
$REV = '';
} else if ($rev_t === false) {
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);
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;
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;
}

View File

@ -367,6 +367,6 @@ $lang['currentns'] = 'Current namespace';
$lang['searchresult'] = 'Search Result';
$lang['plainhtml'] = 'Plain HTML';
$lang['wikimarkup'] = 'Wiki Markup';
$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".';
$lang['page_nonexist_rev'] = 'Page did not exist at %s. It was subsequently created at <a href="%s">%s</a>.';
$lang['unable_to_parse_date'] = 'Unable to parse at parameter "%s".';
//Setup VIM: ex: et ts=2 :

View File

@ -172,7 +172,6 @@ $lang['xsendfile'] = 'Use the X-Sendfile header to let the webserver deliver s
$lang['renderer_xhtml'] = 'Renderer to use for main (xhtml) wiki output';
$lang['renderer__core'] = '%s (dokuwiki core)';
$lang['renderer__plugin'] = '%s (plugin)';
$lang['date_at_format'] = 'Date at format (see PHP\'s <a href="http://www.php.net/manual/datetime.formats.php">datetime.formats</a> information). If empty UNIX timestamp format will be used.';
/* Network Options */
$lang['dnslookups'] = 'DokuWiki will lookup hostnames for remote IP addresses of users editing pages. If you have a slow or non working DNS server or don\'t want this feature, disable this option';

View File

@ -209,7 +209,6 @@ $meta['broken_iua'] = array('onoff');
$meta['xsendfile'] = array('multichoice','_choices' => array(0,1,2,3),'_caution' => 'warning');
$meta['renderer_xhtml'] = array('renderer','_format' => 'xhtml','_choices' => array('xhtml'),'_caution' => 'warning');
$meta['readdircache'] = array('numeric');
$meta['date_at_format'] = array('string');
$meta['_network'] = array('fieldset');
$meta['dnslookups'] = array('onoff');