X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fupload%2FUploadBase.php;h=89ce2b3a167f545fff51c1384efd7bba51a0ac53;hb=343c01d56b8539d0d70d10841c0123b7cce3cd18;hp=e74f52083c3f3cbf51ddb5276f3ecfe8a65c66e1;hpb=ea7c8b6f8babba9aaed733524ad886efea907c02;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index e74f52083c..89ce2b3a16 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -171,6 +171,7 @@ abstract class UploadBase { return null; } + /** @var UploadBase $handler */ $handler = new $className; $handler->initializeFromRequest( $request ); @@ -377,11 +378,12 @@ abstract class UploadBase { } /** - * Verify the mime type. + * Verify the MIME type. * - * @note Only checks that it is not an evil mime. The does it have - * correct extension given its mime type check is in verifyFile. - * @param string $mime Representing the mime + * @note Only checks that it is not an evil MIME. The "does it have + * correct extension given its MIME type?" check is in verifyFile. + * in `verifyFile()` that MIME type and file extension correlate. + * @param string $mime Representing the MIME * @return mixed True if the file is verified, an array otherwise */ protected function verifyMimeType( $mime ) { @@ -396,7 +398,7 @@ abstract class UploadBase { return array( 'filetype-badmime', $mime ); } - # Check IE type + # Check what Internet Explorer would detect $fp = fopen( $this->mTempPath, 'rb' ); $chunk = fread( $fp, 256 ); fclose( $fp ); @@ -487,7 +489,7 @@ abstract class UploadBase { $this->mFileProps = FSFile::getPropsFromPath( $this->mTempPath, $this->mFinalExtension ); - # check mime type, if desired + # check MIME type, if desired $mime = $this->mFileProps['file-mime']; $status = $this->verifyMimeType( $mime ); if ( $status !== true ) { @@ -881,7 +883,7 @@ abstract class UploadBase { /** * Return the local file and initializes if necessary. * - * @return LocalFile|null + * @return LocalFile|UploadStashFile|null */ public function getLocalFile() { if ( is_null( $this->mLocalFile ) ) { @@ -995,9 +997,9 @@ abstract class UploadBase { } /** - * Checks if the mime type of the uploaded file matches the file extension. + * Checks if the MIME type of the uploaded file matches the file extension. * - * @param string $mime The mime type of the uploaded file + * @param string $mime The MIME type of the uploaded file * @param string $extension The filename extension that the file is to be served with * @return bool */ @@ -1050,7 +1052,7 @@ abstract class UploadBase { * positives in some situations. * * @param string $file Pathname to the temporary upload file - * @param string $mime The mime type of the file + * @param string $mime The MIME type of the file * @param string $extension The extension of the file * @return bool True if the file contains something looking like embedded scripts */ @@ -1295,7 +1297,8 @@ abstract class UploadBase { * @param array $attribs * @return bool */ - public function checkSvgScriptCallback( $element, $attribs ) { + public function checkSvgScriptCallback( $element, $attribs, $data = null ) { + list( $namespace, $strippedElement ) = $this->splitXmlNamespace( $element ); // We specifically don't include: @@ -1379,6 +1382,14 @@ abstract class UploadBase { return true; } + # Check