Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions action.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,19 +348,27 @@ protected function p_wiki_dw2pdf($id, $rev = '', $date_at = '') {

if(!file_exists($file)) return '';

//ensure $id is in global $ID (needed for parsing)
/*
* Ensure that global $ID and $INFO are set to match the page
* to be rendered in order for the rendering and other plugins
* to work properly.
*/
global $ID;
$keep = $ID;
$ID = $id;
global $INFO;
$keepid = $ID;
$keepinfo = $INFO;
$ID = $id;
$INFO = pageinfo();

if($rev || $date_at) {
$ret = p_render('dw2pdf', p_get_instructions(io_readWikiPage($file, $id, $rev)), $info, $date_at); //no caching on old revisions
} else {
$ret = p_cached_output($file, 'dw2pdf', $id);
}

//restore ID (just in case)
$ID = $keep;
// Restore ID and INFO (just in case)
$ID = $keepid;
$INFO = $keepinfo;

return $ret;
}
Expand Down