re bug #25523: add mime.info and mime.types for *.dwg files so that when people add...
[lhc/web/wiklou.git] / includes / upload / UploadFromStash.php
index 9b386b9..804db6b 100644 (file)
@@ -19,32 +19,34 @@ class UploadFromStash extends UploadBase {
        public static function isValidRequest( $request ) {
                $sessionData = $request->getSessionData( UploadBase::SESSION_KEYNAME );
                return self::isValidSessionKey(
-                       $request->getInt( 'wpSessionKey' ),
+                       $request->getText( 'wpSessionKey' ),
                        $sessionData
                );
        }
 
        public function initialize( $name, $sessionKey, $sessionData ) {
-                       /**
-                        * Confirming a temporarily stashed upload.
-                        * We don't want path names to be forged, so we keep
-                        * them in the session on the server and just give
-                        * an opaque key to the user agent.
-                        */
+               /**
+                * Confirming a temporarily stashed upload.
+                * We don't want path names to be forged, so we keep
+                * them in the session on the server and just give
+                * an opaque key to the user agent.
+                */
 
-                       $this->initializePathInfo( $name,
-                               $this->getRealPath ( $sessionData['mTempPath'] ),
-                               $sessionData['mFileSize'],
-                               false
-                       );
-                       
-                       $this->mSessionKey = $sessionKey;
-                       $this->mVirtualTempPath = $sessionData['mTempPath'];
-                       $this->mFileProps = $sessionData['mFileProps'];
+               $this->initializePathInfo( $name,
+                       $this->getRealPath ( $sessionData['mTempPath'] ),
+                       $sessionData['mFileSize'],
+                       false
+               );
+
+               $this->mSessionKey = $sessionKey;
+               $this->mVirtualTempPath = $sessionData['mTempPath'];
+               $this->mFileProps = $sessionData['mFileProps'];
+               $this->mSourceType = isset( $sessionData['mSourceType'] ) ?
+                       $sessionData['mSourceType'] : null;
        }
 
        public function initializeFromRequest( &$request ) {
-               $sessionKey = $request->getInt( 'wpSessionKey' );
+               $sessionKey = $request->getText( 'wpSessionKey' );
                $sessionData = $request->getSessionData( UploadBase::SESSION_KEYNAME );
 
                $desiredDestName = $request->getText( 'wpDestFile' );
@@ -53,6 +55,10 @@ class UploadFromStash extends UploadBase {
                return $this->initialize( $desiredDestName, $sessionKey, $sessionData[$sessionKey] );
        }
 
+       public function getSourceType() { 
+               return $this->mSourceType; 
+       }
+
        /**
         * File has been previously verified so no need to do so again.
         */