Foxtrott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176784

Change subject: autoedit: Fix checking the edittoken
......................................................................

autoedit: Fix checking the edittoken

EditPage::tokenOk() does more than just return the tokenOk member variable. It
recreates that variable from its request parameter. This means we have to store
the request and give it to EditPage::tokenOk() again (and again) on each call.

Change-Id: Ibe84605fb4a0c72b3816d31cfa4eeeb4e5ed69f8
---
M includes/SF_AutoeditAPI.php
M includes/SF_ParserFunctions.php
2 files changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/84/176784/1

diff --git a/includes/SF_AutoeditAPI.php b/includes/SF_AutoeditAPI.php
index d2f2dd2..2d0135a 100644
--- a/includes/SF_AutoeditAPI.php
+++ b/includes/SF_AutoeditAPI.php
@@ -357,7 +357,7 @@
                                        'wpSummary' => '',
                                        'wpStarttime' => wfTimestampNow(),
                                        'wpEdittime' => '',
-                                       'wpEditToken' => isset( 
$this->mOptions[ 'token' ] ) ? $this->mOptions[ 'token' ] : '',
+                                       'wpEditToken' => isset( 
$this->mOptions[ 'token' ] ) ? $this->mOptions[ 'token' ] : 
$this->getUser()->getEditToken(),
                                        'action' => 'submit',
                                ),
                                $this->mOptions
@@ -372,6 +372,7 @@
 
                // and import it into the edit page
                $editor->importFormData( $request );
+               $editor->sfFauxRequest = $request;
 
                return $editor;
        }
@@ -446,7 +447,7 @@
                        $this->getUser()->spreadAnyEditBlock();
 
                        foreach ( $permErrors as $error ) {
-                               $this->logMessage( wfMessage( $error )->parse() 
);
+                               $this->logMessage( call_user_func_array( 
'wfMessage', $error )->parse() );
                        }
 
                        return;
@@ -456,7 +457,7 @@
                # Allow bots to exempt some edits from bot flagging
                $bot = $this->getUser()->isAllowed( 'bot' ) && $editor->bot;
 
-               $request = $this->getRequest();
+               $request = $editor->sfFauxRequest;
                if ( $editor->tokenOk( $request ) ) {
                        $status = $editor->internalAttemptSave( $resultDetails, 
$bot );
                } else {
diff --git a/includes/SF_ParserFunctions.php b/includes/SF_ParserFunctions.php
index 5573f2b..49e8768 100644
--- a/includes/SF_ParserFunctions.php
+++ b/includes/SF_ParserFunctions.php
@@ -542,7 +542,7 @@
        }
 
 
-       static function renderAutoEdit( &$parser ) {
+       static function renderAutoEdit( Parser &$parser ) {
                // set defaults
                $formcontent = '';
                $linkString = null;

-- 
To view, visit https://gerrit.wikimedia.org/r/176784
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe84605fb4a0c72b3816d31cfa4eeeb4e5ed69f8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Foxtrott <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to