/**
* Verify whether the upload is sane.
- * @return mixed self::OK or else an array with error information
+ * @return mixed Const self::OK or else an array with error information
*/
public function verifyUpload() {
wfProfileIn( __METHOD__ );
}
/**
- * 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 ) {
global $wgVerifyMimeType;
wfProfileIn( __METHOD__ );
if ( $wgVerifyMimeType ) {
- wfDebug( "\n\nmime: <$mime> extension: <{$this->mFinalExtension}>\n\n" );
+ wfDebug( "mime: <$mime> extension: <{$this->mFinalExtension}>\n" );
global $wgMimeTypeBlacklist;
if ( $this->checkFileExtension( $mime, $wgMimeTypeBlacklist ) ) {
wfProfileOut( __METHOD__ );
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 );
$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 ) {
* isAllowed() should be called as well for generic is-user-blocked or
* can-user-upload checking.
*
- * @param User $user object to verify the permissions against
+ * @param User $user User object to verify the permissions against
* @return mixed An array as returned by getUserPermissionsErrors or true
* in case the user has proper permissions.
*/
}
/**
- * 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
*/
* 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
*/
/**
* Callback to filter SVG Processing Instructions.
- * @param string $target processing instruction name
- * @param string $data processing instruction attribute and value
+ * @param string $target Processing instruction name
+ * @param string $data Processing instruction attribute and value
* @return bool (true if the filter identified something bad)
*/
public static function checkSvgPICallback( $target, $data ) {