Revert r44271 "(bug 12998) Weaken DISPLAYTITLE restictions (patch by 'rememberthedot...
[mediawiki.git] / includes / UploadFromStash.php
blob8bff3b49ead8110af571c29910cf93554899773d
1 <?php
3 class UploadFromStash extends UploadBase {
4 static function isValidSessionKey( $key, $sessionData ) {
5 return !empty( $key ) &&
6 is_array( $sessionData ) &&
7 isset( $sessionData[$key] ) &&
8 isset( $sessionData[$key]['version'] ) &&
9 $sessionData[$key]['version'] == self::SESSION_VERSION
12 static function isValidRequest( $request ) {
13 $sessionData = $request->getSessionData('wsUploadData');
14 return self::isValidSessionKey(
15 $request->getInt( 'wpSessionKey' ),
16 $sessionData
20 function initialize( $name, $sessionData ) {
21 /**
22 * Confirming a temporarily stashed upload.
23 * We don't want path names to be forged, so we keep
24 * them in the session on the server and just give
25 * an opaque key to the user agent.
27 $this->initialize( $name,
28 $sessionData['mTempPath'],
29 $sessionData['mFileSize'],
30 false
33 $this->mFileProps = $sessionData['mFileProps'];
35 function initializeFromRequest( &$request ) {
36 $sessionKey = $request->getInt( 'wpSessionKey' );
37 $sessionData = $request->getSessionData('wsUploadData');
39 $desiredDestName = $request->getText( 'wpDestFile' );
40 if( !$desiredDestName )
41 $desiredDestName = $request->getText( 'wpUploadFile' );
43 return $this->initialize( $desiredDestName, $sessionData[$sessionKey] );
46 /**
47 * File has been previously verified so no need to do so again.
49 protected function verifyFile( $tmpfile ) {
50 return true;
52 /**
53 * We're here from "ignore warnings anyway" so return just OK
55 function checkWarnings() {
56 return array();