splitbrain / dokuwiki-plugin-dw2pdf

A fork of Luigi Micco's PDF export plugin for DokuWiki
http://www.dokuwiki.org/plugin:dw2pdf
55 stars 68 forks source link

Last modified timestamp does not reflect timezone offset #239

Closed issmirnov closed 7 years ago

issmirnov commented 8 years ago

Hi,

I'm running the latest version of Dokuwiki, with Lotar's Bootstrap 3 theme. I made an export of a page on my wiki and noticed that the "last modified" timestamp seems to be GMT.

Is this a quick fix?

dougti commented 7 years ago

The author has used the gmdate() function, instead of the date() function, which returns the time in GMT/UTC. They've also hard-coded the string "GMT" into the headers.

root@portal:/var/www/html/wiki/lib/plugins/dw2pdf# egrep -irn "(gmdate|GMT)" . ./mpdf/includes/out.php:17: header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); ./mpdf/includes/out.php:18: header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); ./mpdf/includes/out.php:29: header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); ./mpdf/includes/out.php:30: header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); ./mpdf/mpdf.php:8307: header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); ./mpdf/mpdf.php:8308: header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); ./mpdf/mpdf.php:8320: header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); ./mpdf/mpdf.php:8321: header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');

I replaced all of those instances with the following: header('Expires: Sat, 26 Jul 1997 05:00:00 UTC'); header('Last-Modified: '.date('D, d M Y H:i:s T').'');

The T is the abbreviation for the timezone set in your php.ini. If a timezone isn't set, then mpdf already includes a conditional statement to set it to London/Europe.

Klap-in commented 7 years ago

the mPDF library has been updated. It sets a timezone by itself, overwriting current settings. Last release has improved this.

So far I have seen the export via dw2pdf doesn't touch the header(..) lines you list here, but uses the DokuWiki's http client code.

So I expect this issue is solved by the improvements of mPDF.