Merge "(bug 26585) Detect CSV/array values in $_SERVER['REMOTE_ADDR']."
[lhc/web/wiklou.git] / includes / api / ApiQueryRevisions.php
index 3590093..881b797 100644 (file)
@@ -196,8 +196,9 @@ class ApiQueryRevisions extends ApiQueryBase {
 
                if ( isset( $prop['content'] ) || !is_null( $this->difftotext ) ) {
                        // For each page we will request, the user must have read rights for that page
+                       $user = $this->getUser();
                        foreach ( $pageSet->getGoodTitles() as $title ) {
-                               if ( !$title->userCan( 'read' ) ) {
+                               if ( !$title->userCan( 'read', $user ) ) {
                                        $this->dieUsage(
                                                'The current user is not allowed to read ' . $title->getPrefixedText(),
                                                'accessdenied' );
@@ -539,7 +540,7 @@ class ApiQueryRevisions extends ApiQueryBase {
                                }
                        }
                        if ( $this->parseContent ) {
-                               $po = $content->getParserOutput( $title, ParserOptions::newFromContext( $this->getContext() ) );
+                               $po = $content->getParserOutput( $title, $revision->getId(), ParserOptions::newFromContext( $this->getContext() ) );
                                $text = $po->getText();
                        }
 
@@ -612,7 +613,7 @@ class ApiQueryRevisions extends ApiQueryBase {
                        return 'private';
                }
                if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) {
-                       // formatComment() calls wfMsg() among other things
+                       // formatComment() calls wfMessage() among other things
                        return 'anon-public-user-private';
                }
                return 'public';
@@ -804,10 +805,10 @@ class ApiQueryRevisions extends ApiQueryBase {
                return array_merge( parent::getPossibleErrors(), array(
                        array( 'nosuchrevid', 'diffto' ),
                        array( 'code' => 'revids', 'info' => 'The revids= parameter may not be used with the list options '
-                                                                                                       . '(limit, startid, endid, dirNewer, start, end).' ),
+                                       . '(limit, startid, endid, dirNewer, start, end).' ),
                        array( 'code' => 'multpages', 'info' => 'titles, pageids or a generator was used to supply multiple pages, '
-                                                                                                       . ' but the limit, startid, endid, dirNewer, user, excludeuser, '
-                                                                                                       . 'start and end parameters may only be used on a single page.' ),
+                                       . ' but the limit, startid, endid, dirNewer, user, excludeuser, '
+                                       . 'start and end parameters may only be used on a single page.' ),
                        array( 'code' => 'diffto', 'info' => 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"' ),
                        array( 'code' => 'badparams', 'info' => 'start and startid cannot be used together' ),
                        array( 'code' => 'badparams', 'info' => 'end and endid cannot be used together' ),