[Mediawiki-l] Pass admin ritghts to a function

Reizer Gábor reizer.gabor at gmail.com
Wed Oct 24 21:27:16 UTC 2007


Hi,

 

How can I make an Admin object in PHP? How can I pass admin ritghts to the
following function:

 

function execute( $par ) {

                        global $wgRequest;

                        global $wgOut;

                        global $wgUser;

                        global $wgParser;

                        global $wgScriptPath;

                        global $wgServer;

 

                        $page = isset( $par ) ? $par : $wgRequest->getText(
'page' );

                        $title = Title::newFromText( $page );

                        $article = new Article ($title);

                        $wgOut->setPrintable();

                        $wgOut->disable();

                        $parserOptions = ParserOptions::newFromUser( $wgUser
);

                        $parserOptions->setEditSection( false );

                        $parserOptions->setTidy(true);

                        $wgParser->mShowToc = false;

                        $parserOutput = $wgParser->parse(
$article->preSaveTransform( $article->getContent() ) ."\n\n",

                                        $title, $parserOptions );

 

 

I tried to use my MW for giving PDF file to another software. I simply tried
to use PDFExport for it. The external software give the appropriate URL to
PdfExport.php and the PDF is ready.

If user rights is default there is no problem. 
After I changed the user rights (see below), there is not any content in the
generated PDF file, except the navigation menu on the left-hand side of the
wiki's page.

User rights:
 $wgGroupPermissions['*'    ]['read']         = false; 
 $wgGroupPermissions['user' ]['read']         = true;
 $wgWhitelistRead = array("Main Page", 'Special:PdfPrint',
'Special:Userlogin',);

How can I get the whole content of the page? Can I somehow change the USER
ID and pass admin rights (first of all reading right) in the PdfExport.php?
Any other solution?

 

Please write me soon. 
Regards,
Gábor

 



More information about the MediaWiki-l mailing list