Index: trunk/phase3/includes/specials/SpecialUpload.php |
— | — | @@ -59,9 +59,6 @@ |
60 | 60 | # filename and description |
61 | 61 | return; |
62 | 62 | } |
63 | | - //if it was posted check for the token (no remote POST'ing with user credentials) |
64 | | - $token = $request->getVal( 'wpEditToken' ); |
65 | | - $this->mTokenOk = $wgUser->matchEditToken( $token ); |
66 | 63 | |
67 | 64 | # Placeholders for text injection by hooks (empty per default) |
68 | 65 | $this->uploadFormTextTop = ""; |
— | — | @@ -73,13 +70,24 @@ |
74 | 71 | $this->mCopyrightStatus = $request->getText( 'wpUploadCopyStatus' ); |
75 | 72 | $this->mCopyrightSource = $request->getText( 'wpUploadSource' ); |
76 | 73 | $this->mWatchthis = $request->getBool( 'wpWatchthis' ); |
77 | | - $this->mSourceType = $request->getText( 'wpSourceType' ); |
| 74 | + $this->mSourceType = $request->getVal( 'wpSourceType', 'file' ); |
78 | 75 | $this->mDestWarningAck = $request->getText( 'wpDestFileWarningAck' ); |
79 | 76 | |
80 | 77 | $this->mReUpload = $request->getCheck( 'wpReUpload' ); // retrying upload |
81 | 78 | |
82 | 79 | $this->mAction = $request->getVal( 'action' ); |
83 | 80 | $this->mUpload = UploadBase::createFromRequest( $request ); |
| 81 | + |
| 82 | + // If it was posted check for the token (no remote POST'ing with user credentials) |
| 83 | + $token = $request->getVal( 'wpEditToken' ); |
| 84 | + if( $this->mSourceType == 'file' && $token == null ) { |
| 85 | + // Skip token check for file uploads as that can't be faked via JS... |
| 86 | + // Some client-side tools don't expect to need to send wpEditToken |
| 87 | + // with their submissions, as that's new in 1.16. |
| 88 | + $this->mTokenOk = true; |
| 89 | + } else { |
| 90 | + $this->mTokenOk = $wgUser->matchEditToken( $token ); |
| 91 | + } |
84 | 92 | } |
85 | 93 | |
86 | 94 | public function userCanExecute( $user ) { |