diff --git a/action.php b/action.php index 8b5a69c0..a558ba83 100644 --- a/action.php +++ b/action.php @@ -348,10 +348,17 @@ 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 @@ -359,8 +366,9 @@ protected function p_wiki_dw2pdf($id, $rev = '', $date_at = '') { $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; }